comparison Discovery/Src/tMenuEditHardware.c @ 138:cc9c18075e00 FlipDisplay

Removed no longer supported scooter code
author Ideenmodellierer
date Sat, 23 Feb 2019 21:10:51 +0100
parents b7689d9e888a
children e141b571a03d
comparison
equal deleted inserted replaced
137:9eda5a75c5fd 138:cc9c18075e00
27 ////////////////////////////////////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////
28 28
29 /* Includes ------------------------------------------------------------------*/ 29 /* Includes ------------------------------------------------------------------*/
30 #include "tMenuEditHardware.h" 30 #include "tMenuEditHardware.h"
31 31
32 //#include "bonex4.h"
33 #include "externCPU2bootloader.h" 32 #include "externCPU2bootloader.h"
34 #include "gfx_fonts.h" 33 #include "gfx_fonts.h"
35 #include "ostc.h" 34 #include "ostc.h"
36 #include "tCCR.h" 35 #include "tCCR.h"
37 #include "tMenuEdit.h" 36 #include "tMenuEdit.h"
46 void openEdit_Compass(void); 45 void openEdit_Compass(void);
47 void openEdit_O2Sensors(void); 46 void openEdit_O2Sensors(void);
48 void openEdit_Brightness(void); 47 void openEdit_Brightness(void);
49 //void openEdit_Luftintegration(void); 48 //void openEdit_Luftintegration(void);
50 void openEdit_ButtonSens(void); 49 void openEdit_ButtonSens(void);
51 void openEdit_ScooterControl(void);
52 void openEdit_FlipDisplay(void); 50 void openEdit_FlipDisplay(void);
53 51
54 /* Announced function prototypes -----------------------------------------------*/ 52 /* Announced function prototypes -----------------------------------------------*/
55 uint8_t OnAction_Compass (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 53 uint8_t OnAction_Compass (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
56 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 54 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
60 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 58 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
61 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 59 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
62 uint8_t OnAction_O2_Fallback (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 60 uint8_t OnAction_O2_Fallback (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
63 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 61 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
64 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 62 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
65 uint8_t OnAction_ScooterDrag (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
66 uint8_t OnAction_ScooterLoad (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
67 uint8_t OnAction_ScooterBatt (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
68 // nicht notwending uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 63 // nicht notwending uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
69 // nicht notwending uint8_t OnAction_ScooterControl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 64
71 /* Exported functions --------------------------------------------------------*/ 65 /* Exported functions --------------------------------------------------------*/
72 66
73 void openEdit_Hardware(uint8_t line) 67 void openEdit_Hardware(uint8_t line)
74 { 68 {
92 break; 86 break;
93 case 5: 87 case 5:
94 openEdit_ButtonSens(); 88 openEdit_ButtonSens();
95 break; 89 break;
96 case 6: 90 case 6:
97 if(getLicence() == LICENCEBONEX) 91 openEdit_FlipDisplay();
98 {
99 openEdit_ScooterControl();
100 }
101 else
102 {
103 openEdit_FlipDisplay();
104 }
105 break; 92 break;
106 } 93 }
107 } 94 }
108 95
109 /* Private functions ---------------------------------------------------------*/ 96 /* Private functions ---------------------------------------------------------*/
150 137
151 138
152 exitEditWithUpdate(); 139 exitEditWithUpdate();
153 exitMenuEdit_to_Home(); 140 exitMenuEdit_to_Home();
154 } 141 }
155 /*
156 void refresh_ScooterControl(void)
157 {
158 char text[256];
159
160 text[0] = '\001';
161 text[1] = TXT_2BYTE;
162 text[2] = TXT2BYTE_ScooterSetup;
163 text[3] = 0;
164 write_topline(text);
165
166 // drag
167 text[0] = TXT_2BYTE;
168 text[1] = TXT2BYTE_ScooterDrag;
169 text[2] = 0;
170 write_label_var( 30, 180, ME_Y_LINE1, &FontT48, text);
171 // load
172 text[0] = TXT_2BYTE;
173 text[1] = TXT2BYTE_ScooterLoad;
174 text[2] = 0;
175 write_label_var( 30, 180, ME_Y_LINE2, &FontT48, text);
176 // batt type
177 text[0] = TXT_2BYTE;
178 text[1] = TXT2BYTE_ScooterBattTyp;
179 text[2] = 0;
180 write_label_var( 30, 180, ME_Y_LINE3, &FontT48, text);
181
182 // drag
183 text[0] = TXT_2BYTE;
184 text[1] = 0;
185 text[2] = 0;
186 switch(settingsGetPointer()->scooterDrag)
187 {
188 case 0:
189 text[1] = TXT2BYTE_ScooterD0Apnoe;
190 break;
191 case 1:
192 text[1] = TXT2BYTE_ScooterD1Scuba;
193 break;
194 case 2:
195 text[1] = TXT2BYTE_ScooterD2Tech;
196 break;
197 case 3:
198 text[1] = TXT2BYTE_ScooterD3Heavy;
199 break;
200 default:
201 snprintf(&text[4],3,"%02u",settingsGetPointer()->scooterDrag);
202 break;
203 }
204 write_label_var( 200, 700, ME_Y_LINE1, &FontT48, text);
205
206 // load
207 text[0] = TXT_2BYTE;
208 text[1] = 0;
209 text[2] = 0;
210 switch(settingsGetPointer()->scooterLoad)
211 {
212 case 0:
213 text[1] = TXT2BYTE_ScooterL0None;
214 break;
215 case 1:
216 text[1] = TXT2BYTE_ScooterL1Small;
217 break;
218 case 2:
219 text[1] = TXT2BYTE_ScooterL2Stages;
220 break;
221 case 3:
222 text[1] = TXT2BYTE_ScooterL3Full;
223 break;
224 case 4:
225 text[1] = TXT2BYTE_ScooterL4Towing;
226 break;
227 default:
228 snprintf(&text[4],3,"%02u",settingsGetPointer()->scooterLoad);
229 break;
230 }
231 write_label_var( 200, 700, ME_Y_LINE2, &FontT48, text);
232
233 //batt type
234
235 // txtptr = 0;
236 // txtptr += bo4GetBatteryName(text,settingsGetPointer()->scooterBattType);
237 // txtptr += snprintf(&text[txtptr],10," (%0.1f V)",bo4GetBatteryVoltage(settingsGetPointer()->scooterBattType));
238 // write_label_var( 200, 700, ME_Y_LINE3, &FontT48, text);
239 }
240 */
241
242 void getButtonText_ScooterControl(char *text, uint8_t * pointer)
243 {
244
245 if((pointer != &settingsGetPointer()->scooterLoad) && (pointer != &settingsGetPointer()->scooterDrag))
246 return;
247
248 text[0] = TXT_2BYTE;
249 text[1] = 0;
250 text[2] = 0;
251
252 // drag
253 if(pointer == &settingsGetPointer()->scooterDrag)
254 {
255 switch(settingsGetPointer()->scooterDrag)
256 {
257 case 0:
258 text[1] = TXT2BYTE_ScooterD0Apnoe;
259 break;
260 case 1:
261 text[1] = TXT2BYTE_ScooterD1Scuba;
262 break;
263 case 2:
264 text[1] = TXT2BYTE_ScooterD2Tech;
265 break;
266 case 3:
267 text[1] = TXT2BYTE_ScooterD3Heavy;
268 break;
269 default:
270 snprintf(&text[4],3,"%02u",settingsGetPointer()->scooterDrag);
271 break;
272 }
273 }
274 else // load
275 if(pointer == &settingsGetPointer()->scooterLoad)
276 {
277
278 switch(settingsGetPointer()->scooterLoad)
279 {
280 case 0:
281 text[1] = TXT2BYTE_ScooterL0None;
282 break;
283 case 1:
284 text[1] = TXT2BYTE_ScooterL1Small;
285 break;
286 case 2:
287 text[1] = TXT2BYTE_ScooterL2Stages;
288 break;
289 case 3:
290 text[1] = TXT2BYTE_ScooterL3Full;
291 break;
292 case 4:
293 text[1] = TXT2BYTE_ScooterL4Towing;
294 break;
295 default:
296 snprintf(&text[4],3,"%02u",settingsGetPointer()->scooterLoad);
297 break;
298 }
299 }
300 }
301
302
303 void openEdit_ScooterControl(void)
304 {
305 char text[256];
306 uint16_t battWh;
307
308 text[0] = '\001';
309 text[1] = TXT_2BYTE;
310 text[2] = TXT2BYTE_ScooterSetup;
311 text[3] = 0;
312 write_topline(text);
313
314 // drag
315 text[0] = TXT_2BYTE;
316 text[1] = TXT2BYTE_ScooterDrag;
317 text[2] = 0;
318 write_label_var( 30, 180, ME_Y_LINE1, &FontT48, text);
319 // load
320 text[0] = TXT_2BYTE;
321 text[1] = TXT2BYTE_ScooterLoad;
322 text[2] = 0;
323 write_label_var( 30, 180, ME_Y_LINE2, &FontT48, text);
324 // batt type
325 text[0] = TXT_2BYTE;
326 text[1] = TXT2BYTE_ScooterBattTyp;
327 text[2] = 0;
328 write_label_var( 30, 180, ME_Y_LINE3, &FontT48, text);
329
330 getButtonText_ScooterControl(text,&settingsGetPointer()->scooterDrag);
331 write_field_button(StMHARD6_ScooterDrag, 200, 770, ME_Y_LINE1, &FontT48, text);
332
333 getButtonText_ScooterControl(text,&settingsGetPointer()->scooterLoad);
334 write_field_button(StMHARD6_ScooterLoad, 200, 770, ME_Y_LINE2, &FontT48, text);
335
336 battWh = settingsGetPointer()->scooterBattSize;
337 write_field_udigit(StMHARD6_ScooterBatt, 200, 770, ME_Y_LINE3, &FontT48, "####\016\016 Wh\017", battWh, 0, 0, 0);
338
339 setEvent(StMHARD6_ScooterDrag, (uint32_t)OnAction_ScooterDrag);
340 setEvent(StMHARD6_ScooterLoad, (uint32_t)OnAction_ScooterLoad);
341 setEvent(StMHARD6_ScooterBatt, (uint32_t)OnAction_ScooterBatt);
342
343 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
344 }
345
346
347 uint8_t OnAction_ScooterDrag(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
348 {
349 char text[256];
350
351 settingsGetPointer()->scooterDrag = settingsGetPointer()->scooterDrag + 1;
352 if(settingsGetPointer()->scooterDrag > 3)
353 settingsGetPointer()->scooterDrag = 0;
354
355 getButtonText_ScooterControl(text,&settingsGetPointer()->scooterDrag);
356 tMenuEdit_newButtonText(editId, text);
357
358 return UPDATE_DIVESETTINGS;
359 }
360
361
362 uint8_t OnAction_ScooterLoad(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
363 {
364 char text[256];
365
366 settingsGetPointer()->scooterLoad = settingsGetPointer()->scooterLoad + 1;
367 if(settingsGetPointer()->scooterLoad > 4)
368 settingsGetPointer()->scooterLoad = 0;
369
370 getButtonText_ScooterControl(text,&settingsGetPointer()->scooterLoad);
371 tMenuEdit_newButtonText(editId, text);
372
373 return UPDATE_DIVESETTINGS;
374 }
375
376
377 uint8_t OnAction_ScooterBatt(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
378 {
379 uint8_t digitContentNew;
380 uint32_t newWh;
381
382 if(action == ACTION_BUTTON_ENTER)
383 {
384 return digitContent;
385 }
386 if(action == ACTION_BUTTON_ENTER_FINAL)
387 {
388 evaluateNewString(editId, &newWh, 0, 0, 0);
389
390 if(newWh < 300)
391 newWh = 300;
392 if(newWh > 5000)
393 newWh = 5000;
394
395 tMenuEdit_newInput(editId, newWh, 0, 0, 0);
396 settingsGetPointer()->scooterBattSize = newWh;
397 return UPDATE_DIVESETTINGS;
398 }
399 if(action == ACTION_BUTTON_NEXT)
400 {
401 digitContentNew = digitContent + 1;
402 if(digitNumber == 0)
403 {
404 if(digitContentNew > '5')
405 digitContentNew = '0';
406 }
407 else if(digitContentNew > '9')
408 digitContentNew = '0';
409 return digitContentNew;
410 }
411 if(action == ACTION_BUTTON_BACK)
412 {
413 digitContentNew = digitContent - 1;
414 if(digitNumber == 0)
415 {
416 if(digitContentNew < '0')
417 digitContentNew = '5';
418 }
419 else if(digitContentNew < '0')
420 digitContentNew = '9';
421 return digitContentNew;
422 }
423 return UNSPECIFIC_RETURN;
424 }
425
426 142
427 void refresh_CompassEdit(void) 143 void refresh_CompassEdit(void)
428 { 144 {
429 uint16_t heading; 145 uint16_t heading;
430 char text[32]; 146 char text[32];