Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSetpoint.c @ 848:92a5dc16d52b Evo_2_23
Bugfix tInfo_write_content_simple flip:
tInfo_write_content_simple did not consider the switched left <=> right positions in case the display is flipped causing text to be displayed at not intended positions. The fix does take care for exchange of left / right side information.
author | Ideenmodellierer |
---|---|
date | Thu, 15 Feb 2024 21:26:28 +0100 |
parents | b7cd0c5c8e43 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditSetpoint.c | |
5 /// \brief | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 19-Dec-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenuEditSetpoint.h" | |
31 | |
32 #include "check_warning.h" | |
33 #include "gfx_fonts.h" | |
34 #include "tMenuEdit.h" | |
35 #include "unit.h" | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
36 #include "tHome.h" |
38 | 37 |
38 /* Private types -------------------------------------------------------------*/ | |
39 typedef struct | |
40 { | |
41 uint8_t spID; | |
42 SSetpointLine * pSetpointLine; | |
43 } SEditSetpointPage; | |
44 | |
45 | |
46 /* Private variables ---------------------------------------------------------*/ | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
47 static SEditSetpointPage editSetpointPage; |
38 | 48 |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
49 static uint8_t switchToSetpointCbar; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
50 |
38 | 51 /* Private function prototypes -----------------------------------------------*/ |
52 | |
53 /* Announced function prototypes -----------------------------------------------*/ | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
54 static uint8_t OnAction_SP_Setpoint (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
55 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
56 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
57 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 58 |
59 /* Exported functions --------------------------------------------------------*/ | |
60 | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
61 void checkSwitchToLoop(void) |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
62 { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
63 if(!isLoopMode(stateUsedWrite->diveSettings.diveMode)) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
64 stateUsedWrite->diveSettings.diveMode = settingsGetPointer()->dive_mode; |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
65 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
66 unblock_diluent_page(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
67 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
68 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
69 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
70 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
71 static uint8_t OnAction_SP_SetpointActive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
72 { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
73 switch (action) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
74 case ACTION_BUTTON_ENTER: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
75 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
76 return digitContent; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
77 case ACTION_BUTTON_ENTER_FINAL: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
78 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
79 checkAndFixSetpointSettings(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
80 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
81 return UPDATE_AND_EXIT_TO_MENU; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
82 case ACTION_BUTTON_NEXT: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
83 case ACTION_BUTTON_BACK: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
84 editSetpointPage.pSetpointLine[editSetpointPage.spID].note.ub.active = (editSetpointPage.pSetpointLine[editSetpointPage.spID].note.ub.active + 1) % 2; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
85 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
86 tMenuEdit_newInput(editId, editSetpointPage.pSetpointLine[editSetpointPage.spID].note.ub.active, 0, 0, 0); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
87 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
88 return UNSPECIFIC_RETURN; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
89 default: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
90 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
91 break; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
92 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
93 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
94 return EXIT_TO_MENU; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
95 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
96 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
97 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
98 int printSetpointName(char *text, uint8_t setpointId, SSettings *settings, bool useSmallFont) |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
99 { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
100 int charsPrinted = 0; |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
101 if (setpointId == 0) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
102 charsPrinted = snprintf(text, 10, "%s%c%c%s", useSmallFont ? "\016\016" : "", TXT_2BYTE, TXT2BYTE_Custom, useSmallFont ? "\017" : ""); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
103 } else if (settings->autoSetpoint) { |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
104 switch (setpointId) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
105 case SETPOINT_INDEX_AUTO_LOW: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
106 charsPrinted = snprintf(text, 10, "%s%c%c%s", useSmallFont ? "\016\016" : "", TXT_2BYTE, TXT2BYTE_SetpointLow, useSmallFont ? "\017" : ""); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
107 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
108 break; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
109 case SETPOINT_INDEX_AUTO_HIGH: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
110 charsPrinted = snprintf(text, 10, "%s%c%c%s", useSmallFont ? "\016\016" : "", TXT_2BYTE, TXT2BYTE_SetpointHigh, useSmallFont ? "\017" : ""); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
111 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
112 break; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
113 case SETPOINT_INDEX_AUTO_DECO: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
114 charsPrinted = snprintf(text, 10, "%s%c%c%s", useSmallFont ? "\016\016" : "", TXT_2BYTE, TXT2BYTE_SetpointDeco, useSmallFont ? "\017" : ""); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
115 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
116 break; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
117 default: |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
118 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
119 break; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
120 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
121 } else { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
122 charsPrinted = snprintf(text, 10, "%d", setpointId); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
123 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
124 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
125 return charsPrinted; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
126 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
127 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
128 |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
129 static void changeSetpoint(uint8_t setpointCbar) |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
130 { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
131 uint8_t actualGasID; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
132 if (!isLoopMode(stateUsedWrite->diveSettings.diveMode)) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
133 actualGasID = stateUsedWrite->lifeData.lastDiluent_GasIdInSettings; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
134 if (actualGasID <= NUM_OFFSET_DILUENT || actualGasID > NUM_GASES + NUM_OFFSET_DILUENT) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
135 actualGasID = NUM_OFFSET_DILUENT + 1; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
136 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
137 } else { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
138 actualGasID = stateUsedWrite->lifeData.actualGas.GasIdInSettings; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
139 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
140 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
141 setActualGas_DM(&stateUsedWrite->lifeData, actualGasID, setpointCbar); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
142 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
143 checkSwitchToLoop(); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
144 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
145 clear_warning_fallback(); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
146 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
147 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
148 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
149 static void startSetpointEdit(uint8_t line, uint8_t setpointId) |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
150 { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
151 SSettings *settings = settingsGetPointer(); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
152 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
153 set_globalState_Menu_Line(line); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
154 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
155 resetMenuEdit(CLUT_MenuPageGasSP); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
156 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
157 editSetpointPage.spID = setpointId; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
158 editSetpointPage.pSetpointLine = settings->setpoint; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
159 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
160 uint8_t setpoint_cbar = editSetpointPage.pSetpointLine[setpointId].setpoint_cbar; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
161 uint8_t depthDeco = editSetpointPage.pSetpointLine[setpointId].depth_meter; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
162 uint8_t first = editSetpointPage.pSetpointLine[setpointId].note.ub.first; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
163 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
164 uint8_t setpointBar = setpoint_cbar / 100; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
165 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
166 char text[70]; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
167 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
168 uint8_t textPointer = snprintf(text, 20, "\001%c%c ", TXT_2BYTE, TXT2BYTE_Setpoint); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
169 textPointer += printSetpointName(&text[textPointer], setpointId, settings, false); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
170 snprintf(&text[textPointer], 20, " %c", TXT_Setpoint_Edit); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
171 write_topline(text); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
172 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
173 uint16_t y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
174 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
175 textPointer = snprintf(text, 4, "%c%c", TXT_2BYTE, TXT2BYTE_SetpointShort); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
176 textPointer += printSetpointName(&text[textPointer], setpointId, settings, true); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
177 textPointer += snprintf(&text[textPointer], 60, " %s* \016\016 bar\017", first ? "" : "\177"); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
178 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
179 if ((settings->autoSetpoint && setpointId == SETPOINT_INDEX_AUTO_DECO) || setpointId == 0) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
180 textPointer += snprintf(&text[textPointer], 4, "\n\r"); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
181 write_label_var(20, 800, y_line, &FontT48, text); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
182 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
183 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.##", (uint32_t)setpointBar, (uint32_t)(setpoint_cbar - (100 * setpointBar)), 0, 0); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
184 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
185 if (settings->autoSetpoint && setpointId == SETPOINT_INDEX_AUTO_DECO) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
186 snprintf(text, 60, "\034 \035%c%c\n\r", TXT_2BYTE, TXT2BYTE_Enabled); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
187 write_label_var(20, 800, y_line + ME_Y_LINE_STEP, &FontT48, text); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
188 write_field_select(StMSP_Active, 160, 800, y_line + ME_Y_LINE_STEP, &FontT48, "#", settings->setpoint[setpointId].note.ub.active, 0, 0, 0); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
189 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
190 } else { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
191 textPointer += snprintf(&text[textPointer], 40, "\034 \016\016 \017 \016\016meter\017\035\n\r"); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
192 write_label_var(20, 800, y_line, &FontT48, text); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
193 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)setpointBar, (uint32_t)(setpoint_cbar - (100 * setpointBar)), depthDeco, 0); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
194 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
195 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
196 setEvent(StMSP_Active, (uint32_t)OnAction_SP_SetpointActive); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
197 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
198 startEdit(); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
199 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
200 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
201 |
38 | 202 void openEdit_Setpoint(uint8_t line) |
203 { | |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
204 SSettings *settings = settingsGetPointer(); |
38 | 205 |
206 /* dive mode */ | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
207 if (actual_menu_content != MENU_SURFACE) { |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
208 SSettings *settings = settingsGetPointer(); |
38 | 209 |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
210 uint8_t setpointCbar = 100; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
211 uint8_t useSensorSubMenu = 0; |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
212 if (line < 6 && stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
213 /* setpoints inactive in PSCR mode */ |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
214 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
215 if (settings->autoSetpoint && line > SETPOINT_INDEX_AUTO_DECO) { |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
216 if (line == 5) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
217 startSetpointEdit(line, 0); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
218 } |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
219 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
220 return; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
221 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
222 |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
223 setpointCbar = stateUsedWrite->diveSettings.setpoint[line].setpoint_cbar; |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
224 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint; |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
225 } else if (stateUsedWrite->diveSettings.diveMode == DIVEMODE_PSCR && line == 2) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
226 /* menu item not pointing to setpoint selection => use sensor or ppo2 simulation */ |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
227 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Simulation; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
228 } else if (line == 6) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
229 /* => use sensor */ |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
230 if(stateUsedWrite->diveSettings.CCR_Mode != CCRMODE_Sensors) |
662 | 231 { |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
232 /* setpoint_cbar will be written by updateSetpointStateUsed() in main.c loop */ |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
233 setpointCbar = 255; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
234 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Sensors; |
662 | 235 } |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
236 else |
662 | 237 { |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
238 useSensorSubMenu = 1; |
662 | 239 } |
38 | 240 } |
241 | |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
242 changeSetpoint(setpointCbar); |
38 | 243 |
244 if(!useSensorSubMenu) | |
245 { | |
246 exitMenuEdit_to_Home(); | |
247 } | |
248 else // entire sub menu during dive to select sensors active | |
249 { | |
250 set_globalState_Menu_Line(line); | |
251 resetMenuEdit(CLUT_MenuPageGasSP); | |
252 | |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
253 char text[20]; |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
254 |
38 | 255 text[0] = '\001'; |
256 text[1] = TXT_o2Sensors; | |
257 text[2] = 0; | |
258 write_topline(text); | |
259 | |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
260 uint8_t sensorActive[3]; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
261 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
262 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
263 snprintf (text,20,"Sensor 1"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
264 sensorActive[0] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
265 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
266 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
267 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
268 snprintf (text,20,"Sensor 1 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[0] ); |
662 | 269 sensorActive[0] = 1; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
270 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
271 write_label_var( 96, 600, ME_Y_LINE1, &FontT48, text); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
272 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
273 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
274 snprintf (text,20,"Sensor 2"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
275 sensorActive[1] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
276 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
277 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
278 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
279 snprintf (text,20,"Sensor 2 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[1] ); |
662 | 280 sensorActive[1] = 1; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
281 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
282 write_label_var( 96, 600, ME_Y_LINE2, &FontT48, text); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
283 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
284 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
285 snprintf (text,20,"Sensor 3"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
286 sensorActive[2] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
287 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
288 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
289 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
290 snprintf (text,20,"Sensor 3 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[2] ); |
662 | 291 sensorActive[2] = 1; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
292 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
293 write_label_var( 96, 600, ME_Y_LINE3, &FontT48, text); |
38 | 294 |
295 write_field_on_off(StMSP_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); | |
296 write_field_on_off(StMSP_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); | |
297 write_field_on_off(StMSP_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); | |
298 | |
299 setEvent(StMSP_Sensor1, (uint32_t)OnAction_SP_DM_Sensor1); | |
300 setEvent(StMSP_Sensor2, (uint32_t)OnAction_SP_DM_Sensor2); | |
301 setEvent(StMSP_Sensor3, (uint32_t)OnAction_SP_DM_Sensor3); | |
302 } | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
303 } else { |
38 | 304 /* surface mode */ |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
305 if ((!settings->autoSetpoint && line <= 5) || line <= SETPOINT_INDEX_AUTO_DECO) { |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
306 startSetpointEdit(line, line); |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
307 } else if (line == 5) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
308 settings->delaySetpointLow = !settings->delaySetpointLow; |
38 | 309 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
310 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
311 } else if (line == 6) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
312 settings->autoSetpoint = (settings->autoSetpoint + 1) % 2; |
650 | 313 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
314 checkAndFixSetpointSettings(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
315 |
650 | 316 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); |
317 } | |
38 | 318 } |
319 } | |
320 | |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
321 |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
322 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 323 { |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
324 SSettings *settings = settingsGetPointer(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
325 |
38 | 326 int8_t digitContentNew; |
327 uint32_t new_integer_part, new_fractional_part, new_cbar, newDepth; | |
328 | |
329 if(action == ACTION_BUTTON_ENTER) | |
330 return digitContent; | |
331 | |
332 if(action == ACTION_BUTTON_ENTER_FINAL) | |
333 { | |
334 evaluateNewString(editId, &new_integer_part, &new_fractional_part, &newDepth, 0); | |
335 | |
336 new_cbar = (new_integer_part * 100) + new_fractional_part; | |
337 | |
652 | 338 if(new_cbar < MIN_PPO2_SP_CBAR) |
339 new_cbar = MIN_PPO2_SP_CBAR; | |
38 | 340 |
341 if(new_cbar > 160) | |
342 new_cbar = 160; | |
343 | |
344 new_integer_part = new_cbar / 100; | |
345 new_fractional_part = new_cbar - (new_integer_part * 100); | |
346 | |
347 editSetpointPage.pSetpointLine[editSetpointPage.spID].setpoint_cbar = new_cbar; | |
348 | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
349 if (settings->autoSetpoint && editSetpointPage.spID == SETPOINT_INDEX_AUTO_DECO) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
350 tMenuEdit_newInput(editId, new_integer_part, new_fractional_part, newDepth, 0); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
351 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
352 checkAndFixSetpointSettings(); |
38 | 353 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
354 return EXIT_TO_NEXT_MENU; |
789
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
355 } else if (editSetpointPage.spID == 0) { |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
356 changeSetpoint(new_cbar); |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
357 |
b7cd0c5c8e43
When using automatic setpoint switching, allow the user to set an arbitrary ppO2 as a custom setpoint during the dive.
heinrichsweikamp
parents:
788
diff
changeset
|
358 return UPDATE_AND_EXIT_TO_HOME; |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
359 } else { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
360 if (newDepth > 255) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
361 newDepth = 255; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
362 } |
38 | 363 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
364 editSetpointPage.pSetpointLine[editSetpointPage.spID].depth_meter = newDepth; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
365 checkAndFixSetpointSettings(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
366 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
367 return UPDATE_AND_EXIT_TO_MENU; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
368 } |
38 | 369 } |
370 | |
371 if(action == ACTION_BUTTON_NEXT) | |
372 { | |
373 digitContentNew = digitContent + 1; | |
374 if((blockNumber == 0) && (digitContentNew > '1')) | |
375 digitContentNew = '0'; | |
376 if(digitContentNew > '9') | |
377 digitContentNew = '0'; | |
378 return digitContentNew; | |
379 } | |
380 | |
381 if(action == ACTION_BUTTON_BACK) | |
382 { | |
383 digitContentNew = digitContent - 1; | |
213
d539ed9aa5b8
Bugfix, trivial: do not visit 9 on first digit for setpoint
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
384 if((blockNumber == 0) && (digitContentNew < '0')) |
38 | 385 digitContentNew = '1'; |
386 if(digitContentNew < '0') | |
387 digitContentNew = '9'; | |
388 return digitContentNew; | |
389 } | |
390 | |
391 return EXIT_TO_MENU; | |
392 } | |
393 | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
394 void openEdit_DiveSelectBetterSetpoint(bool useLastDiluent) |
38 | 395 { |
396 uint8_t spId; | |
397 | |
662 | 398 if(stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR) /* no setpoints in PSCR mode */ |
38 | 399 { |
662 | 400 spId = actualBetterSetpointId(); |
401 | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
402 uint8_t gasId; |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
403 if (useLastDiluent) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
404 gasId = stateUsed->lifeData.lastDiluent_GasIdInSettings; |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
405 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
406 gasId = stateUsed->lifeData.actualGas.GasIdInSettings; |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
407 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
408 |
662 | 409 // change in lifeData |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
410 setActualGas_DM(&stateUsedWrite->lifeData, gasId, stateUsedWrite->diveSettings.setpoint[spId].setpoint_cbar); |
662 | 411 } |
38 | 412 } |
413 | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
414 |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
415 bool findSwitchToSetpoint(void) |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
416 { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
417 uint8_t setpointLowId = getSetpointLowId(); |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
418 uint8_t setpointLowCBar = 0; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
419 if (setpointLowId) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
420 setpointLowCBar = stateUsed->diveSettings.setpoint[setpointLowId].setpoint_cbar; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
421 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
422 |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
423 uint8_t setpointHighId = getSetpointHighId(); |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
424 uint8_t setpointHighCBar = 0; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
425 if (setpointHighId) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
426 setpointHighCBar = stateUsed->diveSettings.setpoint[setpointHighId].setpoint_cbar; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
427 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
428 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
429 uint8_t setpointDecoId = getSetpointDecoId(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
430 uint8_t setpointDecoCBar = 0; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
431 if (setpointDecoId) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
432 setpointDecoCBar = stateUsed->diveSettings.setpoint[setpointDecoId].setpoint_cbar; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
433 } |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
434 uint8_t nextDecoStopDepthM; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
435 uint16_t nextDecoStopTimeRemainingS; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
436 const SDecoinfo *decoInfo = getDecoInfo(); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
437 tHome_findNextStop(decoInfo->output_stop_length_seconds, &nextDecoStopDepthM, &nextDecoStopTimeRemainingS); |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
438 |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
439 uint8_t setpointCurrentCbar = stateUsed->lifeData.actualGas.setPoint_cbar; |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
440 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
441 // We cycle SPdeco => SPhigh => SPlow => SPdeco when we have a decompression obligation |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
442 if (setpointDecoCBar && setpointCurrentCbar != setpointDecoCBar && nextDecoStopDepthM && setpointCurrentCbar != setpointHighCBar) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
443 switchToSetpointCbar = setpointDecoCBar; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
444 } else if (setpointLowCBar && setpointCurrentCbar != setpointLowCBar && (!setpointHighCBar || setpointCurrentCbar == setpointHighCBar || stateUsed->lifeData.depth_meter < stateUsed->diveSettings.setpoint[setpointLowId].depth_meter)) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
445 switchToSetpointCbar = setpointLowCBar; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
446 } else if (setpointHighCBar && setpointCurrentCbar != setpointHighCBar) { |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
447 switchToSetpointCbar = setpointHighCBar; |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
448 } else { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
449 // We don't have a setpoint to switch to |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
450 switchToSetpointCbar = 0; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
451 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
452 return false; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
453 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
454 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
455 return true; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
456 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
457 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
458 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
459 uint8_t getSwitchToSetpointCbar(void) |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
460 { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
461 return switchToSetpointCbar; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
462 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
463 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
464 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
465 void checkSwitchSetpoint(void) |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
466 { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
467 if (switchToSetpointCbar) { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
468 setActualGas_DM(&stateUsedWrite->lifeData, stateUsed->lifeData.lastDiluent_GasIdInSettings, switchToSetpointCbar); |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
469 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
470 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
471 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
773
diff
changeset
|
472 |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
473 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 474 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
475 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
38 | 476 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
477 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+2; |
38 | 478 tMenuEdit_set_on_off(editId, 1); |
479 } | |
480 else | |
481 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
482 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 1; |
38 | 483 tMenuEdit_set_on_off(editId, 0); |
484 } | |
485 | |
486 return UNSPECIFIC_RETURN; | |
487 } | |
488 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
489 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 490 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
491 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
38 | 492 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
493 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+1; |
38 | 494 tMenuEdit_set_on_off(editId, 1); |
495 } | |
496 else | |
497 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
498 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 2; |
38 | 499 tMenuEdit_set_on_off(editId, 0); |
500 } | |
501 | |
502 return UNSPECIFIC_RETURN; | |
503 } | |
504 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
505 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 506 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
507 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
38 | 508 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
509 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 2+1; |
38 | 510 tMenuEdit_set_on_off(editId, 1); |
511 } | |
512 else | |
513 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
514 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 4; |
38 | 515 tMenuEdit_set_on_off(editId, 0); |
516 } | |
517 return UNSPECIFIC_RETURN; | |
518 } |