comparison Discovery/Src/tMenuEditCustom.c @ 541:6fbf7cd391cb

Added default view selection and auto return to view to t3 visualization: In previous version the ostc tried to applied the t7 default view selection to t3 view. As t3 has different views than t3, a new selection menu has been added to the custom view menu enabling the selection of the big font default view. In parallel the auto return function has been adapted to use the new parameter.
author Ideenmodellierer
date Sat, 10 Oct 2020 18:34:10 +0200
parents 1721b26335f1
children 6960df7ddb09
comparison
equal deleted inserted replaced
540:ffd01ead2c80 541:6fbf7cd391cb
51 /* Private function prototypes -----------------------------------------------*/ 51 /* Private function prototypes -----------------------------------------------*/
52 void openEdit_Customview(void); 52 void openEdit_Customview(void);
53 void openEdit_BigScreen(void); 53 void openEdit_BigScreen(void);
54 void openEdit_MotionCtrl(void); 54 void openEdit_MotionCtrl(void);
55 void refresh_Customviews(void); 55 void refresh_Customviews(void);
56 char customview_TXT2BYTE_helper(uint8_t customViewId);
56 /* Announced function prototypes -----------------------------------------------*/ 57 /* Announced function prototypes -----------------------------------------------*/
57 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 58 uint8_t OnAction_CViewTimeout (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); 59 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
60 uint8_t OnAction_CViewStandardBF(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); 61 uint8_t OnAction_CornerTimeout (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); 62 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
61 /* Exported functions --------------------------------------------------------*/ 63 /* Exported functions --------------------------------------------------------*/
62 64
63 65
80 text[textpointer++] = TXT_2BYTE; 82 text[textpointer++] = TXT_2BYTE;
81 text[textpointer++] = TXT2BYTE_CViewTimeout; 83 text[textpointer++] = TXT2BYTE_CViewTimeout;
82 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds); 84 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds);
83 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text); 85 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
84 86
85 // custom view center primary 87 // custom view center primary
86 text[0] = TXT_2BYTE; 88 text[0] = TXT_2BYTE;
87 text[1] = TXT2BYTE_CViewStandard; 89 text[1] = TXT2BYTE_CViewStandard;
88 text[2] = ' '; 90 text[2] = ' ';
89 text[3] = ' '; 91 text[3] = ' ';
92
93 #if 0
90 switch(settingsGetPointer()->tX_customViewPrimary) 94 switch(settingsGetPointer()->tX_customViewPrimary)
91 { 95 {
92 case CVIEW_sensors: 96 case CVIEW_sensors:
93 text[4] = TXT_2BYTE; 97 text[4] = TXT_2BYTE;
94 text[5] = TXT2BYTE_O2monitor; 98 text[5] = TXT2BYTE_O2monitor;
131 break; 135 break;
132 default: 136 default:
133 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary); 137 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary);
134 break; 138 break;
135 } 139 }
140 #endif
141 text[4] = TXT_2BYTE;
142 text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimary);
136 text[6] = 0; 143 text[6] = 0;
137 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); 144 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text);
138 145
146 // custom view big font
147 text[0] = TXT_2BYTE;
148 text[1] = TXT2BYTE_ExtraDisplay;
149 text[2] = ' ';
150 text[3] = ' ';
151 text[4] = TXT_2BYTE;
152 text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimaryBF);
153 text[6] = 0;
154 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
139 155
140 // field corner return 156 // field corner return
141 textpointer = 0; 157 textpointer = 0;
142 text[textpointer++] = TXT_2BYTE; 158 text[textpointer++] = TXT_2BYTE;
143 text[textpointer++] = TXT2BYTE_CornerTimeout; 159 text[textpointer++] = TXT2BYTE_CornerTimeout;
144 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds); 160 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds);
145 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); 161 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text);
146 162
147 // field corner primary 163 // field corner primary
148 text[0] = TXT_2BYTE; 164 text[0] = TXT_2BYTE;
149 text[1] = TXT2BYTE_CornerStandard; 165 text[1] = TXT2BYTE_CornerStandard;
150 text[2] = ' '; 166 text[2] = ' ';
194 default: 210 default:
195 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary); 211 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary);
196 break; 212 break;
197 } 213 }
198 text[5] = 0; 214 text[5] = 0;
199 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); 215 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text);
200 216
201 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 217 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
202 } 218 }
203 219
204 void openEdit_Custom(uint8_t line) 220 void openEdit_Custom(uint8_t line)
227 { 243 {
228 refresh_Customviews(); 244 refresh_Customviews();
229 245
230 write_field_button(StMCustom1_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, ""); 246 write_field_button(StMCustom1_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, "");
231 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); 247 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, "");
232 248 write_field_button(StMCustom1_CViewStandardBF, 400, 700, ME_Y_LINE3, &FontT48, "");
233 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); 249
234 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); 250 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE5, &FontT48, "");
251 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE6, &FontT48, "");
235 252
236 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout); 253 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout);
237 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard); 254 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard);
255 setEvent(StMCustom1_CViewStandardBF, (uint32_t)OnAction_CViewStandardBF);
238 256
239 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout); 257 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout);
240 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard); 258 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard);
241 } 259 }
242 260
243 void openEdit_BigScreen(void) 261 void openEdit_BigScreen(void)
244 { 262 {
245 uint8_t newValue = 0; 263 uint8_t newValue = 0;
414 default: 432 default:
415 newValue = CVIEW_sensors; 433 newValue = CVIEW_sensors;
416 break; 434 break;
417 } 435 }
418 settingsGetPointer()->tX_customViewPrimary = newValue; 436 settingsGetPointer()->tX_customViewPrimary = newValue;
437 return UPDATE_DIVESETTINGS;
438 }
439
440 uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
441 {
442 uint8_t index = 0;
443 uint8_t newValue;
444
445 /* list contains all views which may be selected => get index of current setting */
446 while((settingsGetPointer()->tX_customViewPrimaryBF != cv_changelist_BS[index]) || (cv_changelist_BS[index] == CVIEW_T3_END))
447 {
448 index++;
449 }
450 if((cv_changelist_BS[index] == CVIEW_T3_END) || (cv_changelist_BS[index+1] == CVIEW_T3_END)) /* invalid or last setting */
451 {
452 newValue = cv_changelist_BS[0];
453 }
454 else
455 {
456 newValue = cv_changelist_BS[index + 1];
457 }
458
459 settingsGetPointer()->tX_customViewPrimaryBF = newValue;
419 return UPDATE_DIVESETTINGS; 460 return UPDATE_DIVESETTINGS;
420 } 461 }
421 462
422 463
423 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 464 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)