comparison Discovery/Src/tMenuEditCustom.c @ 521:e221cf762f45

Move Bigfont and motion Ctrl selection menu out of custom view submenu: Due to lag of space the two options were placed within the custom view sub menu. After introduction of new visualization tab the option may be accessed directly
author Ideenmodellierer
date Thu, 10 Sep 2020 20:47:48 +0200
parents 970d8040c0e3
children 1721b26335f1
comparison
equal deleted inserted replaced
520:970d8040c0e3 521:e221cf762f45
36 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() 36 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
37 #include "t3.h" 37 #include "t3.h"
38 #include "t7.h" 38 #include "t7.h"
39 #include "data_exchange_main.h" 39 #include "data_exchange_main.h"
40 #include "motion.h" 40 #include "motion.h"
41 #include "tMenu.h"
42 #include "tMenuSystem.h"
43
41 44
42 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ 45 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */
43 #define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */ 46 #define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */
44 47
45 static uint8_t customviewsSubpage = 0; 48 static uint8_t customviewsSubpage = 0;
46 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ 49 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */
47 static const uint8_t* pcv_curchangelist; 50 static const uint8_t* pcv_curchangelist;
48 /* Private function prototypes -----------------------------------------------*/ 51 /* Private function prototypes -----------------------------------------------*/
49 void openEdit_Customview(void); 52 void openEdit_Customview(void);
53 void openEdit_BigScreen(void);
54 void openEdit_MotionCtrl(void);
50 void refresh_Customviews(void); 55 void refresh_Customviews(void);
51 /* Announced function prototypes -----------------------------------------------*/ 56 /* Announced function prototypes -----------------------------------------------*/
52 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 57 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
53 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 58 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
54 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 59 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
55 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 60 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
56 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
57 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
58 /* Exported functions --------------------------------------------------------*/ 61 /* Exported functions --------------------------------------------------------*/
59 62
60 63
61 64
62 65
193 break; 196 break;
194 } 197 }
195 text[5] = 0; 198 text[5] = 0;
196 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); 199 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text);
197 200
198
199 // extra display
200 text[0] = TXT_2BYTE;
201 text[1] = TXT2BYTE_ExtraDisplay;
202 text[2] = ' ';
203 text[3] = ' ';
204 text[4] = TXT_2BYTE;
205 switch(settingsGetPointer()->extraDisplay)
206 {
207 /* BigFont */
208 case EXTRADISPLAY_BIGFONT:
209 text[5] = TXT2BYTE_ExtraBigFont;
210 break;
211 /* DecoGame */
212 case EXTRADISPLAY_DECOGAME:
213 text[5] = TXT2BYTE_ExtraDecoGame;
214 break;
215 /* none */
216 case EXTRADISPLAY_none:
217 text[5] = TXT2BYTE_ExtraNone;
218 break;
219
220 default:
221 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay);
222 break;
223 }
224 text[6] = 0;
225 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text);
226
227 /* MotionCtrl */
228 text[0] = TXT_2BYTE;
229 text[1] = TXT2BYTE_MotionCtrl;
230 text[2] = ' ';
231 text[3] = ' ';
232 text[4] = TXT_2BYTE;
233 switch(settingsGetPointer()->MotionDetection)
234 {
235 case MOTION_DETECT_OFF:
236 text[5] = TXT2BYTE_MoCtrlNone;
237 break;
238 case MOTION_DETECT_MOVE:
239 text[5] = TXT2BYTE_MoCtrlPitch;
240 break;
241 case MOTION_DETECT_SECTOR:
242 text[5] = TXT2BYTE_MoCtrlSector;
243 break;
244 case MOTION_DETECT_SCROLL:
245 text[5] = TXT2BYTE_MoCtrlScroll;
246 break;
247 default:
248 snprintf(&text[4],2,"%u",settingsGetPointer()->MotionDetection);
249 break;
250 }
251 text[6] = 0;
252 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text);
253
254 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 201 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
255 } 202 }
256 203
257 void openEdit_Custom(uint8_t line) 204 void openEdit_Custom(uint8_t line)
258 { 205 {
260 resetMenuEdit(CLUT_MenuPageCustomView); 207 resetMenuEdit(CLUT_MenuPageCustomView);
261 208
262 switch(line) 209 switch(line)
263 { 210 {
264 case 1: 211 case 1:
265 default: 212 default: openEdit_Customview();
266 openEdit_Customview();
267 break; 213 break;
268 case 2: 214 case 2: openEdit_BigScreen();
269 openEdit_CustomviewDivemode(cv_changelist);
270 break; 215 break;
271 case 3: 216 case 3: openEdit_CustomviewDivemode(cv_changelist);
272 openEdit_CustomviewDivemode(cv_changelist_BS); 217 break;
218 case 4: openEdit_CustomviewDivemode(cv_changelist_BS);
219 break;
220 case 5: openEdit_MotionCtrl();
273 break; 221 break;
274 } 222 }
275 } 223 }
276 224
277 /* Private functions ---------------------------------------------------------*/ 225 /* Private functions ---------------------------------------------------------*/
283 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); 231 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, "");
284 232
285 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); 233 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, "");
286 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); 234 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, "");
287 235
288 write_field_button(StMCustom1_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, "");
289 write_field_button(StMCustom1_MotionCtrl, 400, 700, ME_Y_LINE6, &FontT48, "");
290
291 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout); 236 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout);
292 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard); 237 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard);
293 238
294 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout); 239 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout);
295 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard); 240 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard);
296 241 }
297 setEvent(StMCustom1_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); 242
298 setEvent(StMCustom1_MotionCtrl, (uint32_t)OnAction_MotionCtrl); 243 void openEdit_BigScreen(void)
244 {
245 uint8_t newValue = 0;
246 SSettings *pSettings = settingsGetPointer();
247
248 newValue = pSettings->extraDisplay + 1;
249 if(newValue == EXTRADISPLAY_DECOGAME) /* Decogame not yet implemented */
250 {
251 newValue++;
252 }
253 if(newValue >= EXTRADISPLAY_END)
254 {
255 newValue = EXTRADISPLAY_none;
256 }
257 pSettings->extraDisplay = newValue;
258
259 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
260 }
261
262 void openEdit_MotionCtrl(void)
263 {
264 uint8_t newValue = 0;
265 SSettings *pSettings = settingsGetPointer();
266
267 switch(pSettings->MotionDetection)
268 {
269 case MOTION_DETECT_OFF:
270 newValue = MOTION_DETECT_MOVE;
271 break;
272 case MOTION_DETECT_MOVE:
273 newValue = MOTION_DETECT_SECTOR;
274 break;
275 case MOTION_DETECT_SECTOR:
276 newValue = MOTION_DETECT_SCROLL;
277 break;
278 case MOTION_DETECT_SCROLL:
279 newValue = MOTION_DETECT_OFF;
280 break;
281 default:
282 newValue = MOTION_DETECT_OFF;
283 break;
284 }
285 pSettings->MotionDetection = newValue;
286 InitMotionDetection();
287
288 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
299 } 289 }
300 290
301 char customview_TXT2BYTE_helper(uint8_t customViewId) 291 char customview_TXT2BYTE_helper(uint8_t customViewId)
302 { 292 {
303 char text = 0; 293 char text = 0;
477 uint8_t line = 0; 467 uint8_t line = 0;
478 SSettings *pSettings = settingsGetPointer(); 468 SSettings *pSettings = settingsGetPointer();
479 469
480 switch(editId) 470 switch(editId)
481 { 471 {
482 case StMCustom2_CViewSelection1: line = 1; 472 case StMCustom3_CViewSelection1: line = 1;
483 break; 473 break;
484 case StMCustom2_CViewSelection2: line = 2; 474 case StMCustom3_CViewSelection2: line = 2;
485 break; 475 break;
486 case StMCustom2_CViewSelection3: line = 3; 476 case StMCustom3_CViewSelection3: line = 3;
487 break; 477 break;
488 case StMCustom2_CViewSelection4: line = 4; 478 case StMCustom3_CViewSelection4: line = 4;
489 break; 479 break;
490 case StMCustom2_CViewSelection5: line = 5; 480 case StMCustom3_CViewSelection5: line = 5;
491 break; 481 break;
492 482
493 default: 483 default:
494 break; 484 break;
495 } 485 }
521 customviewsSubpage = 0; 511 customviewsSubpage = 0;
522 } 512 }
523 resetMenuEdit(CLUT_MenuPageCustomView); /* rebuild page */ 513 resetMenuEdit(CLUT_MenuPageCustomView); /* rebuild page */
524 openEdit_CustomviewDivemode(pcv_curchangelist); 514 openEdit_CustomviewDivemode(pcv_curchangelist);
525 515
526 tMenuEdit_select(StMCustom2_CViewSelection6); 516 tMenuEdit_select(StMCustom3_CViewSelection6);
527 return UPDATE_DIVESETTINGS; 517 return UPDATE_DIVESETTINGS;
528 } 518 }
529 519
530 void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist) 520 void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist)
531 { 521 {
570 text[textPointer++] = ' '; 560 text[textPointer++] = ' ';
571 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id)); 561 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id));
572 562
573 switch(i) 563 switch(i)
574 { 564 {
575 case 0: write_field_button(StMCustom2_CViewSelection1, 30, 800, ME_Y_LINE1, &FontT48, ""); 565 case 0: write_field_button(StMCustom3_CViewSelection1, 30, 800, ME_Y_LINE1, &FontT48, "");
576 break; 566 break;
577 case 1: write_field_button(StMCustom2_CViewSelection2, 30, 800, ME_Y_LINE2, &FontT48, ""); 567 case 1: write_field_button(StMCustom3_CViewSelection2, 30, 800, ME_Y_LINE2, &FontT48, "");
578 break; 568 break;
579 case 2: write_field_button(StMCustom2_CViewSelection3, 30, 800, ME_Y_LINE3, &FontT48, ""); 569 case 2: write_field_button(StMCustom3_CViewSelection3, 30, 800, ME_Y_LINE3, &FontT48, "");
580 break; 570 break;
581 case 3: write_field_button(StMCustom2_CViewSelection4, 30, 800, ME_Y_LINE4, &FontT48, ""); 571 case 3: write_field_button(StMCustom3_CViewSelection4, 30, 800, ME_Y_LINE4, &FontT48, "");
582 break; 572 break;
583 case 4: write_field_button(StMCustom2_CViewSelection5, 30, 800, ME_Y_LINE5, &FontT48, ""); 573 case 4: write_field_button(StMCustom3_CViewSelection5, 30, 800, ME_Y_LINE5, &FontT48, "");
584 break; 574 break;
585 default: 575 default:
586 break; 576 break;
587 } 577 }
588 } 578 }
589 } 579 }
590 // setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle);
591
592 580
593 if(customviewsSubpageMax != 1) 581 if(customviewsSubpageMax != 1)
594 { 582 {
595 textPointer = 0; 583 textPointer = 0;
596 text[textPointer++] = TXT_2BYTE; 584 text[textPointer++] = TXT_2BYTE;
597 text[textPointer++] = TXT2BYTE_ButtonNext; 585 text[textPointer++] = TXT2BYTE_ButtonNext;
598 text[textPointer] = 0; 586 text[textPointer] = 0;
599 write_field_button(StMCustom2_CViewSelection6, 30, 800, ME_Y_LINE6, &FontT48, text); 587 write_field_button(StMCustom3_CViewSelection6, 30, 800, ME_Y_LINE6, &FontT48, text);
600 } 588 }
601 589
602 /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */ 590 /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */
603 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ 591 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
604 { 592 {
609 } 597 }
610 else 598 else
611 { 599 {
612 switch(i) 600 switch(i)
613 { 601 {
614 case 0: setEvent(StMCustom2_CViewSelection1, (uint32_t)OnAction_Customview_Toggle); 602 case 0: setEvent(StMCustom3_CViewSelection1, (uint32_t)OnAction_Customview_Toggle);
615 break; 603 break;
616 case 1: setEvent(StMCustom2_CViewSelection2, (uint32_t)OnAction_Customview_Toggle); 604 case 1: setEvent(StMCustom3_CViewSelection2, (uint32_t)OnAction_Customview_Toggle);
617 break; 605 break;
618 case 2: setEvent(StMCustom2_CViewSelection3, (uint32_t)OnAction_Customview_Toggle); 606 case 2: setEvent(StMCustom3_CViewSelection3, (uint32_t)OnAction_Customview_Toggle);
619 break; 607 break;
620 case 3: setEvent(StMCustom2_CViewSelection4, (uint32_t)OnAction_Customview_Toggle); 608 case 3: setEvent(StMCustom3_CViewSelection4, (uint32_t)OnAction_Customview_Toggle);
621 break; 609 break;
622 case 4: setEvent(StMCustom2_CViewSelection5, (uint32_t)OnAction_Customview_Toggle); 610 case 4: setEvent(StMCustom3_CViewSelection5, (uint32_t)OnAction_Customview_Toggle);
623 break; 611 break;
624 612
625 default: 613 default:
626 break; 614 break;
627 } 615 }
628 616
629 } 617 }
630 } 618 }
631 if(customviewsSubpageMax != 1) 619 if(customviewsSubpageMax != 1)
632 { 620 {
633 setEvent(StMCustom2_CViewSelection6,(uint32_t)OnAction_Customview_NextPage); 621 setEvent(StMCustom3_CViewSelection6,(uint32_t)OnAction_Customview_NextPage);
634 } 622 }
635 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ 623 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */
636 { 624 {
637 switch(i) 625 switch(i)
638 { 626 {
655 643
656 void openEdit_CustomviewDivemodeMenu(uint8_t line) 644 void openEdit_CustomviewDivemodeMenu(uint8_t line)
657 { 645 {
658 static uint8_t customviewsSubpage = 0; 646 static uint8_t customviewsSubpage = 0;
659 SSettings *pSettings = settingsGetPointer(); 647 SSettings *pSettings = settingsGetPointer();
660 extern _Bool WriteSettings;
661 char text[MAX_PAGE_TEXTSIZE]; 648 char text[MAX_PAGE_TEXTSIZE];
662 uint16_t tabPosition; 649 uint16_t tabPosition;
663 uint32_t id; 650 uint32_t id;
664 651
665 652
703 } 690 }
704 settingsGetPointer()->extraDisplay = newValue; 691 settingsGetPointer()->extraDisplay = newValue;
705 return UNSPECIFIC_RETURN; 692 return UNSPECIFIC_RETURN;
706 } 693 }
707 694
708
709
710 uint8_t OnAction_MotionCtrl (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
711 {
712 uint8_t newValue;
713 switch(settingsGetPointer()->MotionDetection)
714 {
715 case MOTION_DETECT_OFF:
716 newValue = MOTION_DETECT_MOVE;
717 break;
718 case MOTION_DETECT_MOVE:
719 newValue = MOTION_DETECT_SECTOR;
720 break;
721 case MOTION_DETECT_SECTOR:
722 newValue = MOTION_DETECT_SCROLL;
723 break;
724 case MOTION_DETECT_SCROLL:
725 newValue = MOTION_DETECT_OFF;
726 break;
727 default:
728 newValue = MOTION_DETECT_OFF;
729 break;
730 }
731 settingsGetPointer()->MotionDetection = newValue;
732 InitMotionDetection();
733 return UNSPECIFIC_RETURN;
734 }
735
736 void CustomviewDivemode_refresh() 695 void CustomviewDivemode_refresh()
737 { 696 {
738 SSettings *pSettings = settingsGetPointer(); 697 SSettings *pSettings = settingsGetPointer();
739 char text[MAX_PAGE_TEXTSIZE]; 698 char text[MAX_PAGE_TEXTSIZE];
740 uint8_t textPointer = 0; 699 uint8_t textPointer = 0;