Mercurial > public > ostc4
diff 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 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditGasOC.c Tue Aug 13 13:24:54 2024 +0200 +++ b/Discovery/Src/tMenuEditGasOC.c Tue Feb 11 18:12:00 2025 +0100 @@ -66,6 +66,9 @@ uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); +#ifdef ENABLE_DECOCALC_OPTION +uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); +#endif uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); @@ -204,11 +207,8 @@ return; } #endif - for(int i=0;i<(1+ (2*NUM_GASES));i++) - editGasPage.pGasLine[i].note.ub.first = 0; editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; - editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1; setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint); } @@ -385,7 +385,11 @@ /* surface mode */ void openEdit_Gas(uint8_t line, uint8_t ccr) { - uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off;//, bottleSizeLiter; + uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off ;//, bottleSizeLiter; + +#ifdef ENABLE_DECOCALC_OPTION + uint8_t decocalc; +#endif char text[32]; char textMOD[32]; @@ -424,6 +428,9 @@ deco = editGasPage.pGasLine[gasID].note.ub.deco; travel = editGasPage.pGasLine[gasID].note.ub.travel; off = editGasPage.pGasLine[gasID].note.ub.off; +#ifdef ENABLE_DECOCALC_OPTION + decocalc = editGasPage.pGasLine[gasID].note.ub.decocalc; +#endif //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; if(active) @@ -480,11 +487,19 @@ write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text); - if(deco) + if((deco) || (travel && ccr)) { text[0] = TXT_ChangeDepth; text[1] = ' '; - text[2] = TXT_Deco; + + if(deco) + { + text[2] = TXT_Deco; + } + else + { + text[2] = TXT_Travel; + } text[3] = 0; write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); @@ -501,6 +516,17 @@ text[txtptr++] = TXT2BYTE_SetToMOD; text[txtptr++] = 0; write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text); +#ifdef ENABLE_DECOCALC_OPTION + if(deco) + { + txtptr = 0; + text[txtptr++] = TXT_2BYTE; + text[txtptr++] = TXT2BYTE_CalculateDeco; + text[txtptr++] = 0; + + write_field_on_off(StMOG_CalcDeco, 20, 710, ME_Y_LINE5, &FontT48, text, decocalc); + } +#endif } else { @@ -547,11 +573,17 @@ setEvent(StMOG_Mix, (uint32_t)OnAction_Mix); setEvent(StMOG_GasType, (uint32_t)OnAction_GasType); - if(deco) + if((deco) || (travel && ccr)) { setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); } +#ifdef ENABLE_DECOCALC_OPTION + if(deco) + { + setEvent(StMOG_CalcDeco, (uint32_t)OnAction_CalcDeco); + } +#endif /* setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); */ @@ -1091,13 +1123,34 @@ { uint8_t newChangeDepth = editGasPage.mod; - editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; + if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel) + { + editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel= newChangeDepth; + } + else + { + editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; + } tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0); return UPDATE_DIVESETTINGS; } +#ifdef ENABLE_DECOCALC_OPTION +uint8_t OnAction_CalcDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + if(editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc) + { + editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 0; + } + else + { + editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc = 1; + } + tMenuEdit_set_on_off(editId, editGasPage.pGasLine[editGasPage.gasID].note.ub.decocalc); - + return UPDATE_DIVESETTINGS; +} +#endif uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) { uint8_t digitContentNew; @@ -1117,7 +1170,15 @@ } if(newDepth > 255) newDepth = 255; - editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; + + if(editGasPage.pGasLine[editGasPage.gasID].note.ub.travel) + { + editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth; + } + else + { + editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; + } tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0); return UPDATE_DIVESETTINGS; }
