comparison Discovery/Src/settings.c @ 210:b2a9e9b02df0 cv-persistent

New feature: make selected customviews persistent Add the set of selected customviews during dive time to the persistent settings. Nothing has changed to the menu, so a user still has to access the on/off page from the simulator or during an actual dive, but once changed here, the settings are preserved for later dives. It feels a bit as waste of menu space to add a second page for something that is already available. And further, I have to admit the adding a page is rather complex to get the navigation right, so that is a 2nd argument not to add a page. Further, getting this one setting saved to the persist preferences is a bit of a hack. Misused an existing global bool value (WriteSettings) to force a actual write despite not being in surface mode. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Tue, 26 Mar 2019 13:00:15 +0100
parents c659fda83e44
children 26c874cdde0d
comparison
equal deleted inserted replaced
209:2de856965c55 210:b2a9e9b02df0
80 80
81 /* always adjust check_and_correct_settings() accordingly 81 /* always adjust check_and_correct_settings() accordingly
82 * There might even be entries with fixed values that have no range 82 * There might even be entries with fixed values that have no range
83 */ 83 */
84 const SSettings SettingsStandard = { 84 const SSettings SettingsStandard = {
85 .header = 0xFFFF0018, 85 .header = 0xFFFF0019,
86 .warning_blink_dsec = 8 * 2, 86 .warning_blink_dsec = 8 * 2,
87 .lastDiveLogId = 0, 87 .lastDiveLogId = 0,
88 .logFlashNextSampleStartAddress = 0, 88 .logFlashNextSampleStartAddress = 0,
89 89
90 .gas[0].oxygen_percentage = 21, 90 .gas[0].oxygen_percentage = 21,
304 .FactoryButtonBase = DEFAULT_BUTTONRESPONSIVENESS_GUI, 304 .FactoryButtonBase = DEFAULT_BUTTONRESPONSIVENESS_GUI,
305 .FactoryButtonBalance[0] = 3, 305 .FactoryButtonBalance[0] = 3,
306 .FactoryButtonBalance[1] = 3, 306 .FactoryButtonBalance[1] = 3,
307 .FactoryButtonBalance[2] = 3, 307 .FactoryButtonBalance[2] = 3,
308 .FlipDisplay = 0, 308 .FlipDisplay = 0,
309 .cv_configuration = 0xFFFFFFFF,
309 }; 310 };
310 311
311 /* Private function prototypes -----------------------------------------------*/ 312 /* Private function prototypes -----------------------------------------------*/
312 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 313 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
313 314
444 pSettings->FactoryButtonBalance[2] = pStandard->FactoryButtonBalance[2]; 445 pSettings->FactoryButtonBalance[2] = pStandard->FactoryButtonBalance[2];
445 // no break 446 // no break
446 case 0xFFFF0017: 447 case 0xFFFF0017:
447 pSettings->FlipDisplay = 0; 448 pSettings->FlipDisplay = 0;
448 // no break 449 // no break
450 case 0xFFFF0018:
451 pSettings->cv_configuration = 0xFFFFFFFF;
452 // no break
449 default: 453 default:
450 pSettings->header = pStandard->header; 454 pSettings->header = pStandard->header;
451 break; // no break before!! 455 break; // no break before!!
452 } 456 }
453 } 457 }
454 458
455 459