comparison Discovery/Src/base.c @ 427:b1091e183d52 ImprovmentNVM_2

Activated ringbuffer for settings: In previous versions the settings have always been writte to the ring start address causing additional ~200ms for sector erase. The settings are now continously written (~8ms). At shutdown the settings are written to ring start for compability reasons. In case of a reset the SW will scan the ringbuffer for the latest available block and restore it.
author ideenmodellierer
date Sun, 16 Feb 2020 22:04:52 +0100
parents b67327177159
children f1257a32f2d4
comparison
equal deleted inserted replaced
426:514e6269256f 427:b1091e183d52
453 settingsGetPointer()->totalDiveCounter = totalDiveCounterFound; 453 settingsGetPointer()->totalDiveCounter = totalDiveCounterFound;
454 454
455 if( settingsGetPointer()->debugModeOnStart ) 455 if( settingsGetPointer()->debugModeOnStart )
456 { 456 {
457 settingsGetPointer()->debugModeOnStart = 0; 457 settingsGetPointer()->debugModeOnStart = 0;
458 ext_flash_write_settings(); 458 ext_flash_write_settings(0);
459 setDebugMode(); 459 setDebugMode();
460 openInfo( StIDEBUG ); 460 openInfo( StIDEBUG );
461 } 461 }
462 InitMotionDetection(); 462 InitMotionDetection();
463 463
479 tCCR_control(); 479 tCCR_control();
480 if( tComm_control() )// will stop while loop if tComm Mode started until exit from UART 480 if( tComm_control() )// will stop while loop if tComm Mode started until exit from UART
481 { 481 {
482 createDiveSettings(); 482 createDiveSettings();
483 updateMenu(); 483 updateMenu();
484 ext_flash_write_settings(); 484 ext_flash_write_settings(0);
485 } 485 }
486 486
487 /* check if tasks depending on global state are pending */ 487 /* check if tasks depending on global state are pending */
488 get_globalStateList(&status); 488 get_globalStateList(&status);
489 if(status.base == BaseHome) 489 if(status.base == BaseHome)
490 { 490 {
491 tMenuEdit_writeSettingsToFlash(); // takes 900 ms!! 491 tMenuEdit_writeSettingsToFlash();
492 } 492 }
493 493
494 DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */ 494 DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */
495 495
496 deco_loop(); 496 deco_loop();
918 { 918 {
919 /* not at the moment of testing */ 919 /* not at the moment of testing */
920 // ext_flash_erase_firmware_if_not_empty(); 920 // ext_flash_erase_firmware_if_not_empty();
921 GFX_logoAutoOff(); 921 GFX_logoAutoOff();
922 ext_flash_write_devicedata(true); /* write data at default position */ 922 ext_flash_write_devicedata(true); /* write data at default position */
923 ext_flash_write_settings(true); /* write data at default position */
923 set_globalState(StStop); 924 set_globalState(StStop);
924 } 925 }
925 926
926 927
927 // ----------------------------- 928 // -----------------------------