Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditXtra.c @ 654:890440ab993a
Introduced new menu tab for addition CCR options:
The Xtra menu tab was only used in dive mode before. The tab is now enabled in surface mode and provide access to scrubber timer functionality. To enables this infrastructure (structure, multilanguage strings etc.) have been added to the sourcecode.
author | Ideenmodellierer |
---|---|
date | Sun, 25 Apr 2021 20:41:19 +0200 |
parents | ff2b393e290f |
children | 1b995079c045 |
comparison
equal
deleted
inserted
replaced
653:269e57ac4e56 | 654:890440ab993a |
---|---|
42 void openEdit_ResetStopwatch(void); | 42 void openEdit_ResetStopwatch(void); |
43 void openEdit_SimFollowDecostops(void); | 43 void openEdit_SimFollowDecostops(void); |
44 void openEdit_SetManualMarker(void); | 44 void openEdit_SetManualMarker(void); |
45 void openEdit_SetEndDive(void); | 45 void openEdit_SetEndDive(void); |
46 void openEdit_CalibViewport(void); | 46 void openEdit_CalibViewport(void); |
47 static void openEdit_ScrubberTimer(uint8_t line); | |
48 static void openEdit_ScrubberReset(void); | |
49 static void openEdit_ScrubberTimerMode(void); | |
47 | 50 |
48 /* Announced function prototypes -----------------------------------------------*/ | 51 /* Announced function prototypes -----------------------------------------------*/ |
49 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 52 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
53 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
50 | 54 |
51 /* Exported functions --------------------------------------------------------*/ | 55 /* Exported functions --------------------------------------------------------*/ |
52 | 56 |
53 void openEdit_Xtra(uint8_t line) | 57 void openEdit_Xtra(uint8_t line) |
54 { | 58 { |
55 set_globalState_Menu_Line(line); | 59 set_globalState_Menu_Line(line); |
56 resetMenuEdit(CLUT_MenuPageXtra); | 60 resetMenuEdit(CLUT_MenuPageXtra); |
57 | 61 |
58 switch(line) | 62 /* DIVE MODE */ |
59 { | 63 if(actual_menu_content != MENU_SURFACE) |
60 case 1: | 64 { |
61 default: | 65 switch(line) |
62 openEdit_ResetStopwatch(); | 66 { |
63 break; | 67 case 1: |
64 case 2: | 68 default: |
65 openEdit_CompassHeading(); | 69 openEdit_ResetStopwatch(); |
66 break; | 70 break; |
67 case 3: | 71 case 2: |
68 openEdit_SetManualMarker(); | 72 openEdit_CompassHeading(); |
69 break; | 73 break; |
70 case 4: | 74 case 3: |
71 openEdit_CalibViewport(); | 75 openEdit_SetManualMarker(); |
72 break; | 76 break; |
73 case 5: | 77 case 4: |
74 if(is_stateUsedSetToSim()) | 78 openEdit_CalibViewport(); |
75 { | 79 break; |
76 openEdit_SimFollowDecostops(); | 80 case 5: |
77 } | 81 if(is_stateUsedSetToSim()) |
78 else | 82 { |
79 { | 83 openEdit_SimFollowDecostops(); |
80 openEdit_SetEndDive(); | 84 } |
81 } | 85 else |
82 break; | 86 { |
87 openEdit_SetEndDive(); | |
88 } | |
89 break; | |
90 } | |
91 } | |
92 else /* surface mode */ | |
93 { | |
94 switch(line) | |
95 { | |
96 case 1: openEdit_ScrubberTimer(line); | |
97 break; | |
98 case 2: openEdit_ScrubberReset(); | |
99 break; | |
100 case 3: openEdit_ScrubberTimerMode(); | |
101 break; | |
102 default: | |
103 break; | |
104 } | |
83 } | 105 } |
84 } | 106 } |
85 | 107 |
86 /* Private functions ---------------------------------------------------------*/ | 108 /* Private functions ---------------------------------------------------------*/ |
87 void openEdit_ResetStopwatch(void) | 109 void openEdit_ResetStopwatch(void) |
111 void openEdit_CalibViewport(void) | 133 void openEdit_CalibViewport(void) |
112 { | 134 { |
113 calibrateViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); | 135 calibrateViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); |
114 suspendMotionDetection(0); /* exit to focus mode directly */ | 136 suspendMotionDetection(0); /* exit to focus mode directly */ |
115 exitMenuEdit_to_Home(); | 137 exitMenuEdit_to_Home(); |
138 } | |
139 | |
140 | |
141 | |
142 static void openEdit_ScrubberTimer(uint8_t line) | |
143 { | |
144 uint16_t localScrubTimer; | |
145 uint16_t y_line; | |
146 | |
147 char text[32]; | |
148 SSettings *pSettings = settingsGetPointer(); | |
149 localScrubTimer = pSettings->scrubTimerMax; | |
150 | |
151 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); | |
152 | |
153 text[0] = '\001'; | |
154 text[1] = TXT_ScrubTime; | |
155 text[2] = 0; | |
156 write_topline(text); | |
157 | |
158 text[0] = '\002'; | |
159 strcpy(&text[1],"\016\016"); | |
160 text[3] = TXT_Minutes; | |
161 text[4] = 0; | |
162 write_label_fix( 20, 800, y_line, &FontT48, TXT_ScrubTime); | |
163 write_label_var( 435, 780, y_line, &FontT48, text); | |
164 write_field_udigit(StMXTRA_ScrubTimer_Max_Minutes, 600, 779, y_line, &FontT48, "###", (uint32_t)localScrubTimer, 0, 0, 0); | |
165 | |
166 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
167 | |
168 setEvent(StMXTRA_ScrubTimer_Max_Minutes, (uint32_t)OnAction_ScrubberTimer); | |
169 startEdit(); | |
170 } | |
171 | |
172 static void openEdit_ScrubberReset(void) | |
173 { | |
174 SSettings *pSettings; | |
175 pSettings = settingsGetPointer(); | |
176 pSettings->scrubTimerCur = pSettings->scrubTimerMax; | |
177 exitMenuEdit_to_Menu_with_Menu_Update(); | |
178 } | |
179 | |
180 static void openEdit_ScrubberTimerMode(void) | |
181 { | |
182 uint8_t newMode; | |
183 SSettings *pSettings; | |
184 pSettings = settingsGetPointer(); | |
185 newMode = pSettings->scrubTimerMode + 1; | |
186 if(newMode >= SCRUB_TIMER_END) | |
187 { | |
188 newMode = SCRUB_TIMER_OFF; | |
189 } | |
190 pSettings->scrubTimerMode = newMode; | |
191 exitMenuEdit_to_Menu_with_Menu_Update(); | |
116 } | 192 } |
117 | 193 |
118 void refresh_CompassHeading(void) | 194 void refresh_CompassHeading(void) |
119 { | 195 { |
120 uint16_t heading; | 196 uint16_t heading; |
147 { | 223 { |
148 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; | 224 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
149 exitMenuEdit_to_Home_with_Menu_Update(); | 225 exitMenuEdit_to_Home_with_Menu_Update(); |
150 return EXIT_TO_HOME; | 226 return EXIT_TO_HOME; |
151 } | 227 } |
228 | |
229 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
230 { | |
231 SSettings *pSettings; | |
232 uint8_t digitContentNew = EXIT_TO_MENU; | |
233 uint32_t newScrubberTime; | |
234 | |
235 if(action == ACTION_BUTTON_ENTER) | |
236 { | |
237 return digitContent; | |
238 } | |
239 if(action == ACTION_BUTTON_ENTER_FINAL) | |
240 { | |
241 evaluateNewString(editId, &newScrubberTime, 0, 0, 0); | |
242 | |
243 if(newScrubberTime > MAX_SCRUBBER_TIME) | |
244 newScrubberTime = MAX_SCRUBBER_TIME; | |
245 | |
246 pSettings = settingsGetPointer(); | |
247 pSettings->scrubTimerMax = newScrubberTime; | |
248 if(pSettings->scrubTimerCur > newScrubberTime) | |
249 { | |
250 pSettings->scrubTimerCur = newScrubberTime; | |
251 } | |
252 | |
253 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); | |
254 digitContentNew = UPDATE_AND_EXIT_TO_MENU; | |
255 } | |
256 if(action == ACTION_BUTTON_NEXT) | |
257 { | |
258 digitContentNew = digitContent + 1; | |
259 if(digitContentNew > '9') | |
260 digitContentNew = '0'; | |
261 } | |
262 if(action == ACTION_BUTTON_BACK) | |
263 { | |
264 digitContentNew = digitContent - 1; | |
265 if(digitContentNew < '0') | |
266 digitContentNew = '9'; | |
267 } | |
268 return digitContentNew; | |
269 } | |
270 |