comparison Discovery/Src/tMenuEdit.c @ 854:48b6a3b1f3f8 Evo_2_23

Development bugfix menu id handling: Fixed some issues which showed up after cleanup of the menu id handling
author Ideenmodellierer
date Sat, 09 Mar 2024 20:05:33 +0100
parents de6023cc0580
children
comparison
equal deleted inserted replaced
853:de6023cc0580 854:48b6a3b1f3f8
116 static _Bool EnterPressed = 0; 116 static _Bool EnterPressed = 0;
117 117
118 static _Bool WriteSettings = 0; 118 static _Bool WriteSettings = 0;
119 119
120 /* Private function prototypes -----------------------------------------------*/ 120 /* Private function prototypes -----------------------------------------------*/
121 static void create_newText_for_Id(int8_t localId);
122 void clean_content_of_Id(int8_t localId);
123 static void write_content_of_Id(int8_t localId);
124
121 void draw_tMEdesign(void); 125 void draw_tMEdesign(void);
122 void set_cursorNew(uint8_t forThisIdentID); 126 void set_cursorNew(uint8_t forThisIdentID);
123 void startMenuEditFieldSelect(void); 127 void startMenuEditFieldSelect(void);
124 void create_newText_for_actual_Id(void); 128 void create_newText_for_actual_Id(void);
125 void write_content_of_actual_Id(void); 129 void write_content_of_actual_Id(void);
223 case (StMHARD3_O2_Sensor1 & MaskFieldDigit): 227 case (StMHARD3_O2_Sensor1 & MaskFieldDigit):
224 case (StMHARD3_O2_Calibrate): 228 case (StMHARD3_O2_Calibrate):
225 case (StMHARD3_Sensor_Detect): 229 case (StMHARD3_Sensor_Detect):
226 case (StMHARD3_Sensor_Info): refreshFct = refresh_O2Sensors; 230 case (StMHARD3_Sensor_Info): refreshFct = refresh_O2Sensors;
227 break; 231 break;
228 case (StMHARD2_Compass_SetCourse & MaskFieldDigit): 232 case (StMHARD2_Compass & MaskFieldDigit):
229 refreshFct = refresh_CompassEdit; 233 refreshFct = refresh_CompassEdit;
230 break; 234 break;
231 case (StMXTRA_CompassHeading & MaskFieldDigit): 235 case (StMXTRA_CompassHeading & MaskFieldDigit):
232 refreshFct = refresh_CompassHeading; 236 refreshFct = refresh_CompassHeading;
233 break; 237 break;
455 459
456 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[actualevid].pEventFunction); 460 onActionFunc = (uint8_t (*)(uint32_t, uint8_t, uint8_t, uint8_t, uint8_t))(event[actualevid].pEventFunction);
457 461
458 if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_3DIGIT)) 462 if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_3DIGIT))
459 { 463 {
460 content = 100 * ( ident[id].newText[ident[actualId].begin[block] + 0] - '0'); 464 content = 100 * ( ident[actualId].newText[ident[actualId].begin[block] + 0] - '0');
461 content += 10 * ( ident[id].newText[ident[actualId].begin[block] + 1] - '0'); 465 content += 10 * ( ident[actualId].newText[ident[actualId].begin[block] + 1] - '0');
462 content += ident[id].newText[ident[actualId].begin[block] + 2]; 466 content += ident[actualId].newText[ident[actualId].begin[block] + 2];
463 } 467 }
464 else 468 else
465 if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_2DIGIT)) 469 if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_2DIGIT))
466 { 470 {
467 content = 10 * (ident[actualId].newText[ident[actualId].begin[block] + 0] - '0'); 471 content = 10 * (ident[actualId].newText[ident[actualId].begin[block] + 0] - '0');
503 uint16_t positionOffset; 507 uint16_t positionOffset;
504 508
505 if(event[actualevid].callerID != ident[actualId].callerID) 509 if(event[actualevid].callerID != ident[actualId].callerID)
506 return; 510 return;
507 511
508 if(ident[id].maintype == FIELD_NUMBERS) 512 if(ident[actualId].maintype == FIELD_NUMBERS)
509 { 513 {
510 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + 0]; 514 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + 0];
511 oneCharText[1] = ident[actualId].newText[ident[actualId].begin[block] + 1]; 515 oneCharText[1] = ident[actualId].newText[ident[actualId].begin[block] + 1];
512 oneCharText[2] = 0; 516 oneCharText[2] = 0;
513 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + 0); 517 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + 0);
547 if(ident[actualId].maintype == FIELD_NUMBERS) 551 if(ident[actualId].maintype == FIELD_NUMBERS)
548 { 552 {
549 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + subBlockPosition]; 553 oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + subBlockPosition];
550 oneCharText[1] = 0; 554 oneCharText[1] = 0;
551 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition); 555 positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition);
552 write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[id].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit); 556 write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit);
553 } 557 }
554 } 558 }
555 559
556 560
557 void enterMenuEditField(void) 561 void enterMenuEditField(void)
1015 uint8_t get_id_of(uint32_t editID) 1019 uint8_t get_id_of(uint32_t editID)
1016 { 1020 {
1017 uint8_t temp_id; 1021 uint8_t temp_id;
1018 1022
1019 if(editID == ident[actualId].callerID) 1023 if(editID == ident[actualId].callerID)
1020 return id; 1024 return actualId;
1021 else 1025 else
1022 { 1026 {
1023 temp_id = 0; 1027 temp_id = 0;
1024 while((temp_id < 9) && (editID != ident[temp_id].callerID)) 1028 while((temp_id < 9) && (editID != ident[temp_id].callerID))
1025 temp_id++; 1029 temp_id++;
1042 id = temp_id; 1046 id = temp_id;
1043 1047
1044 strncpy(ident[id].newText, text, 32); 1048 strncpy(ident[id].newText, text, 32);
1045 ident[id].newText[31] = 0; 1049 ident[id].newText[31] = 0;
1046 1050
1047 clean_content_of_actual_Id(); 1051 clean_content_of_Id(id);
1048 write_content_of_actual_Id(); 1052 write_content_of_Id(id);
1049 1053
1050 id = backup_id; 1054 id = backup_id;
1051 } 1055 }
1052 1056
1053 1057
1067 if(int1) 1071 if(int1)
1068 ident[id].newText[0] = '\005'; 1072 ident[id].newText[0] = '\005';
1069 else 1073 else
1070 ident[id].newText[0] = '\006'; 1074 ident[id].newText[0] = '\006';
1071 1075
1072 clean_content_of_actual_Id(); 1076 clean_content_of_Id(id);
1073 write_content_of_actual_Id(); 1077 write_content_of_Id(id);
1074 1078
1075 id = backup_id; 1079 id = backup_id;
1076 } 1080 }
1077 1081
1078 void tMenuEdit_select(uint32_t editID) 1082 void tMenuEdit_select(uint32_t editID)
1139 ident[id].input[0] = int1; 1143 ident[id].input[0] = int1;
1140 ident[id].input[1] = int2; 1144 ident[id].input[1] = int2;
1141 ident[id].input[2] = int3; 1145 ident[id].input[2] = int3;
1142 ident[id].input[3] = int4; 1146 ident[id].input[3] = int4;
1143 1147
1144 create_newText_for_actual_Id(); 1148 create_newText_for_Id(id);
1145 if(id <= idLast) 1149 if(id <= idLast)
1146 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); 1150 change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular);
1147 write_content_of_actual_Id(); 1151 write_content_of_Id(id);
1148 1152
1149 id = backup_id; 1153 id = backup_id;
1150 } 1154 }
1151 1155
1152 1156