annotate Discovery/Src/tMenuEditSetpoint.c @ 666:12d029f38430 Betatest

increase version numbers for upcomming release
author heinrichsweikamp
date Sat, 12 Mar 2022 14:57:54 +0100
parents 1b995079c045
children 2c243233c999
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tMenuEditSetpoint.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 19-Dec-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tMenuEditSetpoint.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "check_warning.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "tMenuEdit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "unit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 uint8_t spID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 SSetpointLine * pSetpointLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 } SEditSetpointPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /* Private variables ---------------------------------------------------------*/
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
46 static SEditSetpointPage editSetpointPage;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 /* Announced function prototypes -----------------------------------------------*/
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
51 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
52 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
53 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
54 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void openEdit_Setpoint(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 uint8_t useSensorSubMenu = 0;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
61 char text[20];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
62 uint8_t sensorActive[3];
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 /* dive mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 if(actual_menu_content != MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint8_t setpointCbar, actualGasID;
130
b7689d9e888a Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents: 38
diff changeset
68 setpointCbar = 100;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 // actualGasID
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
71 if(!isLoopMode(stateUsedWrite->diveSettings.diveMode))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
73 actualGasID = stateUsedWrite->lifeData.lastDiluent_GasIdInSettings;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 if((actualGasID <= NUM_OFFSET_DILUENT) || (actualGasID > NUM_GASES + NUM_OFFSET_DILUENT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 actualGasID = NUM_OFFSET_DILUENT + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 else
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
78 actualGasID = stateUsedWrite->lifeData.actualGas.GasIdInSettings;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 // setpointCbar, CCR_Mode and sensor menu
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
81 if((line < 6) && (stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR)) /* setpoints inactive in PSCR mode */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
83 setpointCbar = stateUsedWrite->diveSettings.setpoint[line].setpoint_cbar;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
84 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 // BetterSetpoint warning only once
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 if(actualBetterSetpointId() == line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 uint8_t depth;
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
90 depth = stateUsedWrite->diveSettings.setpoint[line].depth_meter;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 // BetterSetpoint warning only once -> clear active
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 for(int i=0; i<=NUM_GASES; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
94 stateUsedWrite->diveSettings.setpoint[i].note.ub.first = 0;
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
95 if(stateUsedWrite->diveSettings.setpoint[i].depth_meter <= depth)
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
96 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 }
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
98 stateUsedWrite->diveSettings.setpoint[line].note.ub.first = 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 }
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
101 else /* menu item not pointing to setpoint selection => use sensor or ppo2 simulation */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
103 if((stateUsedWrite->diveSettings.diveMode == DIVEMODE_PSCR) && (line == 2))
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
104 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
105 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Simulation;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
106 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
107 else /* => use sensor */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
108 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
109 if(stateUsedWrite->diveSettings.CCR_Mode != CCRMODE_Sensors)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
110 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
111 /* setpoint_cbar will be written by updateSetpointStateUsed() in main.c loop */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
112 setpointCbar = 255;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
113 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Sensors;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
114 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
115 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
116 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
117 useSensorSubMenu = 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
118 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
119 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
122 setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
124 if(!isLoopMode(stateUsedWrite->diveSettings.diveMode))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
126 stateUsedWrite->diveSettings.diveMode = settingsGetPointer()->dive_mode;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 unblock_diluent_page();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 clear_warning_fallback();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 if(!useSensorSubMenu)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 exitMenuEdit_to_Home();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 else // entire sub menu during dive to select sensors active
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 resetMenuEdit(CLUT_MenuPageGasSP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 text[1] = TXT_o2Sensors;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
638
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
146 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1)
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
147 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
148 snprintf (text,20,"Sensor 1");
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
149 sensorActive[0] = 0;
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
150 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
151 else
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
152 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
153 snprintf (text,20,"Sensor 1 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[0] );
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
154 sensorActive[0] = 1;
638
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
155 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
156 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
157 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2)
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
158 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
159 snprintf (text,20,"Sensor 2");
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
160 sensorActive[1] = 0;
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
161 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
162 else
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
163 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
164 snprintf (text,20,"Sensor 2 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[1] );
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
165 sensorActive[1] = 1;
638
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
166 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
167 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
168 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4)
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
169 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
170 snprintf (text,20,"Sensor 3");
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
171 sensorActive[2] = 0;
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
172 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
173 else
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
174 {
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
175 snprintf (text,20,"Sensor 3 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[2] );
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
176 sensorActive[2] = 1;
638
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
177 }
4532953ac1a0 Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents: 288
diff changeset
178 write_label_var( 96, 600, ME_Y_LINE3, &FontT48, text);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 write_field_on_off(StMSP_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 write_field_on_off(StMSP_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 write_field_on_off(StMSP_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 setEvent(StMSP_Sensor1, (uint32_t)OnAction_SP_DM_Sensor1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 setEvent(StMSP_Sensor2, (uint32_t)OnAction_SP_DM_Sensor2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 setEvent(StMSP_Sensor3, (uint32_t)OnAction_SP_DM_Sensor3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 /* surface mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 uint8_t spId, setpoint_cbar, sp_high, depthDeco, first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 // uint8_t active,
166
255eedad4155 cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents: 130
diff changeset
195 char text[70];
255eedad4155 cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents: 130
diff changeset
196 uint8_t textPointer;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
199 if(line < 6)
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
200 {
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
201 set_globalState_Menu_Line(line);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
203 resetMenuEdit(CLUT_MenuPageGasSP);
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
204
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
205 spId = line;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
206 editSetpointPage.spID = spId;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
207 SSettings *data = settingsGetPointer();
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
208 editSetpointPage.pSetpointLine = data->setpoint;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
210 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
211 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
212 //active = editSetpointPage.pSetpointLine[spId].note.ub.active;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
213 first = editSetpointPage.pSetpointLine[spId].note.ub.first;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
215 sp_high = setpoint_cbar / 100;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
217 strcpy(text, "\001" "Setpoint #0 X");
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
218 text[11] += spId;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
219 text[13] = TXT_Setpoint_Edit;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
220 write_topline(text);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
223 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
225 textPointer = 0;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
226 text[textPointer++] = 'S';
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
227 text[textPointer++] = 'P';
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
228 text[textPointer++] = '0' + spId;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
229 text[textPointer++] = ' ';
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
230 text[textPointer++] = ' ';
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
232 if(first == 0)
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
233 strcpy(&text[textPointer++],"\177");
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
235 textPointer += snprintf(&text[textPointer], 60,\
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
236 "* "
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
237 " "
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
238 "\016\016"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
239 " bar"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
240 "\017"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
241 "\034"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
242 " "
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
243 "\016\016"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
244 " "
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
245 "\017"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
246 " "
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
247 "\016\016"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
248 "meter"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
249 "\017"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
250 "\035"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
251 "\n\r"
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
252 );
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
253 write_label_var( 20, 800, y_line, &FontT48, text);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254
650
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
255 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0);
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
256 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint);
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
257 startEdit();
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
258 }
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
259 else
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
260 {
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
261 SSettings *pSettings = settingsGetPointer();
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
262
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
263 if(pSettings->autoSetpoint == 0)
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
264 {
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
265 pSettings->autoSetpoint = 1;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
266 }
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
267 else
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
268 {
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
269 pSettings->autoSetpoint = 0;
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
270 }
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
271 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
5f0d3dce5ef4 Automatik setpoint change:
Ideenmodellierer
parents: 638
diff changeset
272 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
276 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 int8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 uint32_t new_integer_part, new_fractional_part, new_cbar, newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 evaluateNewString(editId, &new_integer_part, &new_fractional_part, &newDepth, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 new_cbar = (new_integer_part * 100) + new_fractional_part;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289
652
f6212495f34f Allow setpoint starting at 0.4 ppO2:
Ideenmodellierer
parents: 650
diff changeset
290 if(new_cbar < MIN_PPO2_SP_CBAR)
f6212495f34f Allow setpoint starting at 0.4 ppO2:
Ideenmodellierer
parents: 650
diff changeset
291 new_cbar = MIN_PPO2_SP_CBAR;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 if(new_cbar > 160)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 new_cbar = 160;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 new_integer_part = new_cbar / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 new_fractional_part = new_cbar - (new_integer_part * 100);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 editSetpointPage.pSetpointLine[editSetpointPage.spID].setpoint_cbar = new_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 if(newDepth > 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 newDepth = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 editSetpointPage.pSetpointLine[editSetpointPage.spID].depth_meter = newDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 if((blockNumber == 0) && (digitContentNew > '1'))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 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
322 if((blockNumber == 0) && (digitContentNew < '0'))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 digitContentNew = '1';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 void openEdit_DiveSelectBetterSetpoint(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 uint8_t spId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 uint8_t depth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
337 if(stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR) /* no setpoints in PSCR mode */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
339 spId = actualBetterSetpointId();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
340
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
341 depth = stateUsedWrite->diveSettings.setpoint[spId].depth_meter;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
343 // BetterSetpoint warning only once -> clear active
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
344 for(int i=0; i<=NUM_GASES; i++)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
345 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
346 stateUsedWrite->diveSettings.setpoint[i].note.ub.first = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
347 if(stateUsedWrite->diveSettings.setpoint[i].depth_meter <= depth)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
348 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
349 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
351 // new setpoint
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
352 stateUsedWrite->diveSettings.setpoint[spId].note.ub.first = 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
353
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
354 // change in lifeData
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
355 setActualGas_DM(&stateUsedWrite->lifeData, stateUsedWrite->lifeData.actualGas.GasIdInSettings, stateUsedWrite->diveSettings.setpoint[spId].setpoint_cbar);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 652
diff changeset
356 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
359 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
361 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
363 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+2;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
368 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 tMenuEdit_set_on_off(editId, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
375 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
377 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
379 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
384 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 2;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 tMenuEdit_set_on_off(editId, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
391 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
393 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
395 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 2+1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 tMenuEdit_set_on_off(editId, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 213
diff changeset
400 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 4;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 tMenuEdit_set_on_off(editId, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 return UNSPECIFIC_RETURN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 }