Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditGasOC.c @ 981:c6c781a2e85b default
Merge into default
| author | heinrichsweikamp |
|---|---|
| date | Tue, 11 Feb 2025 18:12:00 +0100 |
| parents | 79b522fbabe6 |
| children | 22d5b477c903 |
comparison
equal
deleted
inserted
replaced
| 871:f7318457df4d | 981:c6c781a2e85b |
|---|---|
| 64 /* Announced function prototypes -----------------------------------------------*/ | 64 /* Announced function prototypes -----------------------------------------------*/ |
| 65 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 65 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 66 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 66 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 67 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 67 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 68 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 68 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 69 #ifdef ENABLE_DECOCALC_OPTION | |
| 70 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 71 #endif | |
| 69 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 72 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 70 | 73 |
| 71 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 74 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 72 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 75 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 73 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 76 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 202 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.off) /* disable selection of switched off gases */ | 205 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.off) /* disable selection of switched off gases */ |
| 203 { | 206 { |
| 204 return; | 207 return; |
| 205 } | 208 } |
| 206 #endif | 209 #endif |
| 207 for(int i=0;i<(1+ (2*NUM_GASES));i++) | |
| 208 editGasPage.pGasLine[i].note.ub.first = 0; | |
| 209 | 210 |
| 210 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | 211 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; |
| 211 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1; | |
| 212 setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint); | 212 setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint); |
| 213 } | 213 } |
| 214 | 214 |
| 215 /* extra gas and gas on/off option */ | 215 /* extra gas and gas on/off option */ |
| 216 void openEdit_SpecialDiveGasMenu(uint8_t ccr) | 216 void openEdit_SpecialDiveGasMenu(uint8_t ccr) |
| 383 | 383 |
| 384 | 384 |
| 385 /* surface mode */ | 385 /* surface mode */ |
| 386 void openEdit_Gas(uint8_t line, uint8_t ccr) | 386 void openEdit_Gas(uint8_t line, uint8_t ccr) |
| 387 { | 387 { |
| 388 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off;//, bottleSizeLiter; | 388 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off ;//, bottleSizeLiter; |
| 389 | |
| 390 #ifdef ENABLE_DECOCALC_OPTION | |
| 391 uint8_t decocalc; | |
| 392 #endif | |
| 389 | 393 |
| 390 char text[32]; | 394 char text[32]; |
| 391 char textMOD[32]; | 395 char textMOD[32]; |
| 392 uint8_t txtptr; | 396 uint8_t txtptr; |
| 393 | 397 |
| 422 active = editGasPage.pGasLine[gasID].note.ub.active; | 426 active = editGasPage.pGasLine[gasID].note.ub.active; |
| 423 first = editGasPage.pGasLine[gasID].note.ub.first; | 427 first = editGasPage.pGasLine[gasID].note.ub.first; |
| 424 deco = editGasPage.pGasLine[gasID].note.ub.deco; | 428 deco = editGasPage.pGasLine[gasID].note.ub.deco; |
| 425 travel = editGasPage.pGasLine[gasID].note.ub.travel; | 429 travel = editGasPage.pGasLine[gasID].note.ub.travel; |
| 426 off = editGasPage.pGasLine[gasID].note.ub.off; | 430 off = editGasPage.pGasLine[gasID].note.ub.off; |
| 431 #ifdef ENABLE_DECOCALC_OPTION | |
| 432 decocalc = editGasPage.pGasLine[gasID].note.ub.decocalc; | |
| 433 #endif | |
| 427 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; | 434 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; |
| 428 | 435 |
| 429 if(active) | 436 if(active) |
| 430 inactive = 0; | 437 inactive = 0; |
| 431 else | 438 else |
| 478 text[0] = TXT_Inactive; | 485 text[0] = TXT_Inactive; |
| 479 | 486 |
| 480 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text); | 487 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text); |
| 481 | 488 |
| 482 | 489 |
| 483 if(deco) | 490 if((deco) || (travel && ccr)) |
| 484 { | 491 { |
| 485 text[0] = TXT_ChangeDepth; | 492 text[0] = TXT_ChangeDepth; |
| 486 text[1] = ' '; | 493 text[1] = ' '; |
| 487 text[2] = TXT_Deco; | 494 |
| 495 if(deco) | |
| 496 { | |
| 497 text[2] = TXT_Deco; | |
| 498 } | |
| 499 else | |
| 500 { | |
| 501 text[2] = TXT_Travel; | |
| 502 } | |
| 488 text[3] = 0; | 503 text[3] = 0; |
| 489 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); | 504 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); |
| 490 | 505 |
| 491 textMOD[0] = '#'; | 506 textMOD[0] = '#'; |
| 492 textMOD[1] = '#'; | 507 textMOD[1] = '#'; |
| 499 txtptr = 0; | 514 txtptr = 0; |
| 500 text[txtptr++] = TXT_2BYTE; | 515 text[txtptr++] = TXT_2BYTE; |
| 501 text[txtptr++] = TXT2BYTE_SetToMOD; | 516 text[txtptr++] = TXT2BYTE_SetToMOD; |
| 502 text[txtptr++] = 0; | 517 text[txtptr++] = 0; |
| 503 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text); | 518 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text); |
| 519 #ifdef ENABLE_DECOCALC_OPTION | |
| 520 if(deco) | |
| 521 { | |
| 522 txtptr = 0; | |
| 523 text[txtptr++] = TXT_2BYTE; | |
| 524 text[txtptr++] = TXT2BYTE_CalculateDeco; | |
| 525 text[txtptr++] = 0; | |
| 526 | |
| 527 write_field_on_off(StMOG_CalcDeco, 20, 710, ME_Y_LINE5, &FontT48, text, decocalc); | |
| 528 } | |
| 529 #endif | |
| 504 } | 530 } |
| 505 else | 531 else |
| 506 { | 532 { |
| 507 txtptr = 0; | 533 txtptr = 0; |
| 508 text[txtptr++] = '\031'; | 534 text[txtptr++] = '\031'; |
| 545 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0); | 571 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0); |
| 546 | 572 |
| 547 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix); | 573 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix); |
| 548 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType); | 574 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType); |
| 549 | 575 |
| 550 if(deco) | 576 if((deco) || (travel && ccr)) |
| 551 { | 577 { |
| 552 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); | 578 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); |
| 553 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); | 579 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); |
| 554 } | 580 } |
| 581 #ifdef ENABLE_DECOCALC_OPTION | |
| 582 if(deco) | |
| 583 { | |
| 584 setEvent(StMOG_CalcDeco, (uint32_t)OnAction_CalcDeco); | |
| 585 } | |
| 586 #endif | |
| 555 /* | 587 /* |
| 556 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); | 588 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); |
| 557 */ | 589 */ |
| 558 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 590 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 559 } | 591 } |
| 1089 | 1121 |
| 1090 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 1122 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
| 1091 { | 1123 { |
| 1092 uint8_t newChangeDepth = editGasPage.mod; | 1124 uint8_t newChangeDepth = editGasPage.mod; |
| 1093 | 1125 |
| 1094 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; | 1126 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel) |
| 1127 { | |
| 1128 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel= newChangeDepth; | |
| 1129 } | |
| 1130 else | |
| 1131 { | |
| 1132 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; | |
| 1133 } | |
| 1095 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0); | 1134 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0); |
| 1096 | 1135 |
| 1097 return UPDATE_DIVESETTINGS; | 1136 return UPDATE_DIVESETTINGS; |
| 1098 } | 1137 } |
| 1099 | 1138 #ifdef ENABLE_DECOCALC_OPTION |
| 1100 | 1139 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
| 1140 { | |
| 1141 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc) | |
| 1142 { | |
| 1143 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 0; | |
| 1144 } | |
| 1145 else | |
| 1146 { | |
| 1147 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 1; | |
| 1148 } | |
| 1149 tMenuEdit_set_on_off(editId, editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc); | |
| 1150 | |
| 1151 return UPDATE_DIVESETTINGS; | |
| 1152 } | |
| 1153 #endif | |
| 1101 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 1154 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
| 1102 { | 1155 { |
| 1103 uint8_t digitContentNew; | 1156 uint8_t digitContentNew; |
| 1104 uint32_t newDepth; | 1157 uint32_t newDepth; |
| 1105 | 1158 |
| 1115 newDepth += 2; // f�r rundung | 1168 newDepth += 2; // f�r rundung |
| 1116 newDepth = (newDepth * 3) / 10; | 1169 newDepth = (newDepth * 3) / 10; |
| 1117 } | 1170 } |
| 1118 if(newDepth > 255) | 1171 if(newDepth > 255) |
| 1119 newDepth = 255; | 1172 newDepth = 255; |
| 1120 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; | 1173 |
| 1174 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel) | |
| 1175 { | |
| 1176 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth; | |
| 1177 } | |
| 1178 else | |
| 1179 { | |
| 1180 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; | |
| 1181 } | |
| 1121 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0); | 1182 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0); |
| 1122 return UPDATE_DIVESETTINGS; | 1183 return UPDATE_DIVESETTINGS; |
| 1123 } | 1184 } |
| 1124 if(action == ACTION_BUTTON_NEXT) | 1185 if(action == ACTION_BUTTON_NEXT) |
| 1125 { | 1186 { |
