comparison Discovery/Src/tMenuEditGasOC.c @ 830:b7d93ff6b3b2 Evo_2_23

Added selection if an active gas shall be used for deco calculation or not: In previous version selecting a gas as deco gas automatically activated the gas for deco calculation. Some divers prever to have the deco time displayed which matches to the gas currently in use. These divers kept the gas deactivated unless they switch to it. Features like gas usability visualization or easy gas change using quick selection were not usable for these divers. With introduction of the new option the gas switching / visualization features may be used without having the gas been considered for calculation in the background. The option may be operated in the gas selection menu.
author Ideenmodellierer
date Thu, 16 Nov 2023 20:32:09 +0100
parents 2c243233c999
children
comparison
equal deleted inserted replaced
829:d5e68cc08f9a 830:b7d93ff6b3b2
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 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
69 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 70 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 71
71 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 72 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); 73 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); 74 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 */ 203 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.off) /* disable selection of switched off gases */
203 { 204 {
204 return; 205 return;
205 } 206 }
206 #endif 207 #endif
207 for(int i=0;i<(1+ (2*NUM_GASES));i++)
208 editGasPage.pGasLine[i].note.ub.first = 0;
209 208
210 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; 209 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); 210 setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint);
213 } 211 }
214 212
215 /* extra gas and gas on/off option */ 213 /* extra gas and gas on/off option */
216 void openEdit_SpecialDiveGasMenu(uint8_t ccr) 214 void openEdit_SpecialDiveGasMenu(uint8_t ccr)
383 381
384 382
385 /* surface mode */ 383 /* surface mode */
386 void openEdit_Gas(uint8_t line, uint8_t ccr) 384 void openEdit_Gas(uint8_t line, uint8_t ccr)
387 { 385 {
388 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off;//, bottleSizeLiter; 386 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off, decocalc;//, bottleSizeLiter;
389 387
390 char text[32]; 388 char text[32];
391 char textMOD[32]; 389 char textMOD[32];
392 uint8_t txtptr; 390 uint8_t txtptr;
393 391
422 active = editGasPage.pGasLine[gasID].note.ub.active; 420 active = editGasPage.pGasLine[gasID].note.ub.active;
423 first = editGasPage.pGasLine[gasID].note.ub.first; 421 first = editGasPage.pGasLine[gasID].note.ub.first;
424 deco = editGasPage.pGasLine[gasID].note.ub.deco; 422 deco = editGasPage.pGasLine[gasID].note.ub.deco;
425 travel = editGasPage.pGasLine[gasID].note.ub.travel; 423 travel = editGasPage.pGasLine[gasID].note.ub.travel;
426 off = editGasPage.pGasLine[gasID].note.ub.off; 424 off = editGasPage.pGasLine[gasID].note.ub.off;
425 decocalc = editGasPage.pGasLine[gasID].note.ub.decocalc;
427 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; 426 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter;
428 427
429 if(active) 428 if(active)
430 inactive = 0; 429 inactive = 0;
431 else 430 else
478 text[0] = TXT_Inactive; 477 text[0] = TXT_Inactive;
479 478
480 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text); 479 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text);
481 480
482 481
483 if(deco) 482 if((deco) || (travel && ccr))
484 { 483 {
485 text[0] = TXT_ChangeDepth; 484 text[0] = TXT_ChangeDepth;
486 text[1] = ' '; 485 text[1] = ' ';
487 text[2] = TXT_Deco; 486
487 if(deco)
488 {
489 text[2] = TXT_Deco;
490 }
491 else
492 {
493 text[2] = TXT_Travel;
494 }
488 text[3] = 0; 495 text[3] = 0;
489 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); 496 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text);
490 497
491 textMOD[0] = '#'; 498 textMOD[0] = '#';
492 textMOD[1] = '#'; 499 textMOD[1] = '#';
499 txtptr = 0; 506 txtptr = 0;
500 text[txtptr++] = TXT_2BYTE; 507 text[txtptr++] = TXT_2BYTE;
501 text[txtptr++] = TXT2BYTE_SetToMOD; 508 text[txtptr++] = TXT2BYTE_SetToMOD;
502 text[txtptr++] = 0; 509 text[txtptr++] = 0;
503 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text); 510 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text);
511
512 if(deco)
513 {
514 txtptr = 0;
515 text[txtptr++] = TXT_2BYTE;
516 text[txtptr++] = TXT2BYTE_CalculateDeco;
517 text[txtptr++] = 0;
518
519 write_field_on_off(StMOG_CalcDeco, 20, 710, ME_Y_LINE5, &FontT48, text, decocalc);
520 }
504 } 521 }
505 else 522 else
506 { 523 {
507 txtptr = 0; 524 txtptr = 0;
508 text[txtptr++] = '\031'; 525 text[txtptr++] = '\031';
545 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0); 562 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0);
546 563
547 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix); 564 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix);
548 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType); 565 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType);
549 566
550 if(deco) 567 if((deco) || (travel && ccr))
551 { 568 {
552 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); 569 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth);
553 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); 570 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD);
571 }
572 if(deco)
573 {
574 setEvent(StMOG_CalcDeco, (uint32_t)OnAction_CalcDeco);
554 } 575 }
555 /* 576 /*
556 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); 577 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize);
557 */ 578 */
558 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 579 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
1089 1110
1090 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 1111 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1091 { 1112 {
1092 uint8_t newChangeDepth = editGasPage.mod; 1113 uint8_t newChangeDepth = editGasPage.mod;
1093 1114
1094 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; 1115 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel)
1116 {
1117 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel= newChangeDepth;
1118 }
1119 else
1120 {
1121 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth;
1122 }
1095 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0); 1123 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0);
1096 1124
1097 return UPDATE_DIVESETTINGS; 1125 return UPDATE_DIVESETTINGS;
1098 } 1126 }
1099 1127
1128 uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1129 {
1130 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc)
1131 {
1132 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 0;
1133 }
1134 else
1135 {
1136 editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 1;
1137 }
1138 tMenuEdit_set_on_off(editId, editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc);
1139
1140 return UPDATE_DIVESETTINGS;
1141 }
1100 1142
1101 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 1143 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1102 { 1144 {
1103 uint8_t digitContentNew; 1145 uint8_t digitContentNew;
1104 uint32_t newDepth; 1146 uint32_t newDepth;
1115 newDepth += 2; // f�r rundung 1157 newDepth += 2; // f�r rundung
1116 newDepth = (newDepth * 3) / 10; 1158 newDepth = (newDepth * 3) / 10;
1117 } 1159 }
1118 if(newDepth > 255) 1160 if(newDepth > 255)
1119 newDepth = 255; 1161 newDepth = 255;
1120 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; 1162
1163 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel)
1164 {
1165 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth;
1166 }
1167 else
1168 {
1169 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth;
1170 }
1121 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0); 1171 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0);
1122 return UPDATE_DIVESETTINGS; 1172 return UPDATE_DIVESETTINGS;
1123 } 1173 }
1124 if(action == ACTION_BUTTON_NEXT) 1174 if(action == ACTION_BUTTON_NEXT)
1125 { 1175 {