Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditHardware.c @ 998:5a690195b6b7 GasConsumption
Added dual operation of scrubber timers:
In the previous version only one scrubber timer could be selected for operation. In the new version the activation of both timers is possible. In that case both timers will be displayed as well. To enable this a new activation item has been added to the scrubber menu.
| author | Ideenmodellierer |
|---|---|
| date | Wed, 23 Apr 2025 14:52:03 +0200 |
| parents | df052f0347fb |
| children | ac25c35a3c97 |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tMenuEditHardware.c | |
| 5 /// \brief BUTTONS | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 15-Sept-2016 | |
| 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 "tMenuEditHardware.h" | |
| 783 | 31 #include "tMenuEdit.h" |
| 38 | 32 |
| 33 #include "externCPU2bootloader.h" | |
| 34 #include "gfx_fonts.h" | |
| 35 #include "ostc.h" | |
| 36 #include "tCCR.h" | |
|
394
717f335cc5c9
Added start of module configuration after eache modul power on
ideenmodellierer
parents:
314
diff
changeset
|
37 #include "tComm.h" |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
38 #include "data_exchange_main.h" |
| 38 | 39 |
| 748 | 40 |
| 38 | 41 /* Private function prototypes -----------------------------------------------*/ |
| 42 void openEdit_Bluetooth(void); | |
| 43 void openEdit_Compass(void); | |
| 44 void openEdit_O2Sensors(void); | |
| 45 void openEdit_Brightness(void); | |
| 46 //void openEdit_Luftintegration(void); | |
| 47 void openEdit_ButtonSens(void); | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
48 void openEdit_FlipDisplay(void); |
| 38 | 49 |
| 50 /* Announced function prototypes -----------------------------------------------*/ | |
| 51 uint8_t OnAction_Compass (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 52 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 53 uint8_t OnAction_BearingClear (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
54 uint8_t OnAction_InertiaLevel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 38 | 55 //uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 56 uint8_t OnAction_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 57 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 58 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
59 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
60 //uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
61 uint8_t OnAction_Sensor_Info (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
62 uint8_t OnAction_Sensor_Detect (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 38 | 63 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 64 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
65 uint8_t OnAction_ButtonLock (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 605 | 66 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 38 | 67 |
| 68 /* Exported functions --------------------------------------------------------*/ | |
| 69 | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
70 |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
71 #define O2_CALIB_FRACTION_AIR (0.209F) |
| 605 | 72 #define O2_CALIB_FRACTION_O2 (0.98F) |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
73 |
| 584 | 74 static uint8_t O2_calib_gas = 21; |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
75 |
| 38 | 76 void openEdit_Hardware(uint8_t line) |
| 77 { | |
| 78 set_globalState_Menu_Line(line); | |
| 79 | |
| 80 switch(line) | |
| 81 { | |
| 82 case 1: | |
| 83 default: | |
| 84 openEdit_Bluetooth(); | |
| 85 break; | |
| 86 case 2: | |
|
708
7e3bf2c0cd40
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
703
diff
changeset
|
87 resetMenuEdit(CLUT_MenuPageHardware); |
| 38 | 88 openEdit_Compass(); |
| 89 break; | |
| 90 case 3: | |
| 91 openEdit_O2Sensors(); | |
| 92 break; | |
| 93 case 4: | |
| 94 openEdit_Brightness(); | |
| 95 break; | |
| 96 case 5: | |
|
708
7e3bf2c0cd40
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
703
diff
changeset
|
97 resetMenuEdit(CLUT_MenuPageHardware); |
| 38 | 98 openEdit_ButtonSens(); |
| 99 break; | |
| 100 case 6: | |
| 138 | 101 openEdit_FlipDisplay(); |
| 38 | 102 break; |
| 103 } | |
| 104 } | |
| 105 | |
| 106 /* Private functions ---------------------------------------------------------*/ | |
| 107 void openEdit_Bluetooth(void) | |
| 108 { | |
| 109 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ | |
| 110 | |
| 111 SSettings *pSettings = settingsGetPointer(); | |
| 112 | |
| 113 if(pSettings->bluetoothActive == 0) | |
| 114 { | |
| 115 pSettings->bluetoothActive = 1; | |
| 116 MX_Bluetooth_PowerOn(); | |
|
394
717f335cc5c9
Added start of module configuration after eache modul power on
ideenmodellierer
parents:
314
diff
changeset
|
117 tComm_StartBlueModConfig(); |
| 38 | 118 } |
| 119 else | |
| 120 { | |
| 121 pSettings->bluetoothActive = 0; | |
| 122 MX_Bluetooth_PowerOff(); | |
| 123 } | |
| 124 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); | |
| 125 } | |
| 126 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
127 void openEdit_FlipDisplay(void) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
128 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
129 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
130 |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
131 bool oldValue = settingsGetPointer()->FlipDisplay; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
132 |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
133 setFlipDisplay(!oldValue); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
134 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
135 exitEditWithUpdate(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
136 exitMenuEdit_to_Home(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
137 } |
| 38 | 138 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
139 static uint8_t OnAction_CompassDeclination(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
140 { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
141 SSettings *settings = settingsGetPointer(); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
142 uint8_t digitContentNew; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
143 switch (action) { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
144 case ACTION_BUTTON_ENTER: |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
145 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
146 return digitContent; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
147 case ACTION_BUTTON_ENTER_FINAL: |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
148 { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
149 int32_t compassDeclinationDeg; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
150 evaluateNewString(editId, (uint32_t *)&compassDeclinationDeg, NULL, NULL, NULL); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
151 |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
152 if (compassDeclinationDeg > MAX_COMPASS_DECLINATION_DEG) { |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
153 compassDeclinationDeg = MAX_COMPASS_DECLINATION_DEG; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
154 } else if (compassDeclinationDeg < -MAX_COMPASS_DECLINATION_DEG) { |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
978
diff
changeset
|
155 compassDeclinationDeg = -MAX_COMPASS_DECLINATION_DEG; |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
156 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
157 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
158 settings->compassDeclinationDeg = compassDeclinationDeg; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
159 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
160 tMenuEdit_newInput(editId, ((input_u)compassDeclinationDeg).uint32, 0, 0, 0); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
161 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
162 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
163 break; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
164 case ACTION_BUTTON_NEXT: |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
165 if (digitNumber == 0) { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
166 digitContentNew = togglePlusMinus(digitContent); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
167 } else { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
168 digitContentNew = digitContent + 1; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
169 if (digitContentNew > '9') { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
170 digitContentNew = '0'; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
171 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
172 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
173 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
174 return digitContentNew; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
175 case ACTION_BUTTON_BACK: |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
176 if (digitNumber == 0) { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
177 digitContentNew = togglePlusMinus(digitContent); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
178 } else { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
179 digitContentNew = digitContent - 1; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
180 if (digitContentNew < '0') { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
181 digitContentNew = '9'; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
182 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
183 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
184 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
185 return digitContentNew; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
186 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
187 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
188 return UNSPECIFIC_RETURN; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
189 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
190 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
191 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
192 static void showCompassDeclination(SSettings *settings, bool isRefresh) |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
193 { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
194 char text[16]; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
195 snprintf(text, 16, "%c%c:", TXT_2BYTE, TXT2BYTE_CompassDeclination); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
196 write_label_var(30, 800, ME_Y_LINE6, &FontT48, text); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
197 if (isRefresh) { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
198 tMenuEdit_refresh_field(StMHARD2_Compass_Declination); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
199 } else { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
200 write_field_sdigit(StMHARD2_Compass_Declination, 500, 800, ME_Y_LINE6, &FontT48, "\034###`", settings->compassDeclinationDeg, 0, 0, 0); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
201 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
202 } |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
203 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
204 |
| 38 | 205 void refresh_CompassEdit(void) |
| 206 { | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
207 SSettings *settings = settingsGetPointer(); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
208 |
| 38 | 209 uint16_t heading; |
| 210 char text[32]; | |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
211 uint8_t textIndex = 0; |
| 38 | 212 |
| 213 text[0] = '\001'; | |
| 214 text[1] = TXT_2BYTE; | |
| 215 text[2] = TXT2BYTE_Compass; | |
| 216 text[3] = 0; | |
| 217 write_topline(text); | |
| 218 | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
219 if(settings->compassInertia) |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
220 { |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
221 heading = (uint16_t)compass_getCompensated(); |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
222 } |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
223 else |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
224 { |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
225 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
226 } |
| 38 | 227 snprintf(text,32,"\001%03i`",heading); |
| 228 write_label_var( 0, 800, ME_Y_LINE1, &FontT54, text); | |
| 229 | |
| 230 tMenuEdit_refresh_field(StMHARD2_Compass_SetCourse); | |
| 231 tMenuEdit_refresh_field(StMHARD2_Compass_Calibrate); | |
| 232 tMenuEdit_refresh_field(StMHARD2_Compass_ResetCourse); | |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
233 text[textIndex++] = TXT_2BYTE; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
234 text[textIndex++] = TXT2BYTE_CompassInertia; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
235 text[textIndex++] = ':'; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
236 text[textIndex++] = ' '; |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
237 text[textIndex++] = '0' + settings->compassInertia; |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
238 |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
239 write_label_var(30, 800, ME_Y_LINE5, &FontT48, text); |
| 38 | 240 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
241 showCompassDeclination(settings, true); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
242 |
| 38 | 243 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 244 } | |
| 245 | |
| 246 | |
| 247 void openEdit_Compass(void) | |
| 248 { | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
249 SSettings *settings = settingsGetPointer(); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
250 |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
251 char text[10]; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
252 uint8_t textIndex = 0; |
| 38 | 253 |
| 854 | 254 |
| 255 set_globalState(StMHARD2_Compass); | |
| 256 resetMenuEdit(CLUT_MenuPageHardware); | |
| 257 | |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
258 text[textIndex++] = '\001'; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
259 text[textIndex++] = TXT_2BYTE; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
260 text[textIndex++] = TXT2BYTE_Compass; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
261 text[textIndex++] = 0; |
| 38 | 262 write_topline(text); |
| 263 | |
| 264 text[0] = TXT_2BYTE; | |
| 265 text[2] = 0; | |
| 266 | |
| 267 text[1] = TXT2BYTE_SetBearing; | |
| 268 write_field_button(StMHARD2_Compass_SetCourse, 30, 800, ME_Y_LINE2, &FontT48, text); | |
| 269 | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
270 text[1] = TXT2BYTE_ResetBearing; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
271 write_field_button(StMHARD2_Compass_ResetCourse, 30, 800, ME_Y_LINE3, &FontT48, text); |
| 38 | 272 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
273 text[1] = TXT2BYTE_CompassCalib; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
274 write_field_button(StMHARD2_Compass_Calibrate, 30, 800, ME_Y_LINE4, &FontT48, text); |
| 38 | 275 |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
276 text[1] = TXT2BYTE_CompassInertia; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
277 textIndex = 2; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
278 text[textIndex++] = ':'; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
279 text[textIndex++] = ' '; |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
280 text[textIndex++] = '0' + settings->compassInertia; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
281 text[textIndex++] = 0; |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
282 |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
283 write_field_button(StMHARD2_Compass_Inertia, 30, 800, ME_Y_LINE5, &FontT48, text); |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
284 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
285 showCompassDeclination(settings, false); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
286 |
| 38 | 287 setEvent(StMHARD2_Compass_SetCourse, (uint32_t)OnAction_Bearing); |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
288 setEvent(StMHARD2_Compass_ResetCourse, (uint32_t)OnAction_BearingClear); |
| 38 | 289 setEvent(StMHARD2_Compass_Calibrate, (uint32_t)OnAction_Compass); |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
290 setEvent(StMHARD2_Compass_Inertia, (uint32_t)OnAction_InertiaLevel); |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
754
diff
changeset
|
291 setEvent(StMHARD2_Compass_Declination, (uint32_t)OnAction_CompassDeclination); |
| 38 | 292 |
| 854 | 293 tMenuEdit_select(StMHARD2_Compass_SetCourse); |
| 294 | |
| 38 | 295 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 296 } | |
| 297 | |
| 298 | |
| 299 uint8_t OnAction_Compass (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 300 { | |
| 301 calibrateCompass(); | |
| 302 return EXIT_TO_INFO_COMPASS; | |
| 303 } | |
| 304 | |
| 305 | |
| 306 uint8_t OnAction_Bearing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 307 { | |
| 709 | 308 if((int16_t)stateUsed->lifeData.compass_heading != -1) |
| 309 { | |
| 310 settingsGetPointer()->compassBearing = (int16_t)stateUsed->lifeData.compass_heading; | |
| 311 } | |
| 312 else | |
| 313 { | |
| 314 settingsGetPointer()->compassBearing = 0; | |
| 315 } | |
| 316 | |
| 38 | 317 if(settingsGetPointer()->compassBearing == 0) |
| 318 settingsGetPointer()->compassBearing = 360; | |
| 319 return UPDATE_AND_EXIT_TO_MENU; | |
| 320 } | |
| 321 | |
| 322 | |
| 323 uint8_t OnAction_BearingClear (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 324 { | |
| 325 settingsGetPointer()->compassBearing = 0; | |
| 326 return UPDATE_AND_EXIT_TO_MENU; | |
| 327 } | |
| 328 | |
|
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
329 |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
330 uint8_t OnAction_InertiaLevel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
331 { |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
332 uint8_t newLevel = 0; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
333 |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
334 newLevel = settingsGetPointer()->compassInertia + 1; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
335 if(newLevel > MAX_COMPASS_COMP) |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
336 { |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
337 newLevel = 0; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
338 } |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
339 settingsGetPointer()->compassInertia = newLevel; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
340 return UPDATE_DIVESETTINGS; |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
341 } |
|
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
525
diff
changeset
|
342 |
| 38 | 343 /* |
| 344 uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 345 { | |
| 346 return EXIT_TO_MENU; | |
| 347 } | |
| 348 */ | |
| 349 | |
| 350 void refresh_O2Sensors(void) | |
| 351 { | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
352 char strSensorId[20]; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
353 char strSensorValue[20]; |
| 38 | 354 uint16_t y_line; |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
355 uint8_t index = 0; |
| 38 | 356 |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
357 const SDiveState *pStateReal = stateRealGetPointer(); |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
358 SSettings *pSettings = settingsGetPointer(); |
| 38 | 359 |
| 797 | 360 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT) != 0) |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
361 { |
| 797 | 362 memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT); |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
363 pSettings->ppo2sensors_deactivated = 0x0; /* deactivation will be done by openEditO2Sensor if need */ |
| 827 | 364 pSettings->co2_sensor_active = 0; |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
365 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; |
| 827 | 366 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT - 1; index++) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
367 { |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
368 switch(pSettings->ext_sensor_map[index]) |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
369 { |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
370 case SENSOR_OPTIC: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
371 break; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
372 case SENSOR_ANALOG: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL) |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
373 { |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
374 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
375 } |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
376 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
377 { |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
378 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANALOG; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
379 } |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
380 break; |
| 797 | 381 case SENSOR_DIGO2M: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
382 { |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
383 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
384 } |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
385 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
386 { |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
387 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_DIGITAL; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
388 } |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
389 break; |
| 827 | 390 case SENSOR_CO2: |
| 391 case SENSOR_CO2M: pSettings->co2_sensor_active = 1; | |
| 392 break; | |
| 746 | 393 #ifdef ENABLE_SENTINEL_MODE |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
827
diff
changeset
|
394 case SENSOR_SENTINEL: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
827
diff
changeset
|
395 case SENSOR_SENTINELM: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_SENTINEL; |
| 745 | 396 break; |
| 746 | 397 #endif |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
398 default: |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
399 break; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
400 } |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
401 } |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
402 openEdit_O2Sensors(); |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
403 } |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
404 |
| 783 | 405 strSensorId[0] = '\001'; |
| 406 strSensorId[1] = TXT_o2Sensors; | |
| 407 strSensorId[2] = 0; | |
| 408 write_topline(strSensorId); | |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
409 |
| 783 | 410 strSensorId[0] = TXT_2BYTE; |
| 411 strSensorId[1] = TXT2BYTE_Sensor; | |
| 412 strSensorId[2] = ' '; | |
| 413 strSensorId[3] = TXT_2BYTE; | |
| 414 strSensorId[4] = 'X'; | |
| 415 strSensorId[5] = '1'; | |
| 416 strSensorId[6] = 0; | |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
417 |
| 783 | 418 for(index = 0; index < 3; index++) |
| 419 { | |
| 799 | 420 strSensorId[3] = TXT_2BYTE; |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
421 strSensorId[4] = 'X'; |
| 783 | 422 strSensorId[5] = '1' + index; |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
423 |
| 783 | 424 switch(pSettings->ext_sensor_map[index]) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
425 { |
| 748 | 426 case SENSOR_SEARCH: strSensorId[1] = TXT2BYTE_SensorDetect; |
| 427 strSensorId[2] = 0; | |
| 428 strSensorId[4] = 0; | |
| 745 | 429 break; |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
430 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
431 break; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
432 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog; |
|
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
433 break; |
| 797 | 434 case SENSOR_DIGO2: |
| 435 case SENSOR_DIGO2M: strSensorId[4] = TXT2BYTE_O2IFDigital; | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
436 break; |
| 799 | 437 case SENSOR_CO2: |
| 438 case SENSOR_CO2M: strSensorId[3] = 'C'; | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
439 strSensorId[4] = 'O'; |
| 978 | 440 strSensorId[5] = '2'; |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
441 break; |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
827
diff
changeset
|
442 case SENSOR_SENTINEL: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
827
diff
changeset
|
443 case SENSOR_SENTINELM: strSensorId[3] = 'S'; |
| 920 | 444 strSensorId[4] = 'e'; |
| 745 | 445 break; |
| 920 | 446 case SENSOR_GNSS: |
| 447 case SENSOR_GNSSM: strSensorId[3] = 'G'; | |
| 448 strSensorId[4] = 'N'; | |
| 449 break; | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
450 default: |
| 748 | 451 strSensorId[5] = 0; |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
452 break; |
| 783 | 453 } |
| 454 if(strSensorId[4] != 'X') | |
| 455 { | |
| 456 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, strSensorId); | |
| 457 } | |
| 458 strSensorValue[0] = 0; | |
| 459 if((pSettings->ext_sensor_map[index] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[index] < SENSOR_TYPE_O2_END)) | |
| 460 { | |
| 461 snprintf(strSensorValue, 20,"%01.2f, %01.1f mV", pStateReal->lifeData.ppO2Sensor_bar[index], pStateReal->lifeData.sensorVoltage_mV[index]); | |
| 462 } | |
| 799 | 463 else if(pSettings->ext_sensor_map[index] == SENSOR_CO2M) |
| 783 | 464 { |
| 465 snprintf(strSensorValue, 20,"%ld ppm", pStateReal->lifeData.CO2_data.CO2_ppm); | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
466 } |
| 783 | 467 y_line = ME_Y_LINE1 + (index * ME_Y_LINE_STEP); |
| 468 if(strSensorValue[0] != 0) | |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
469 { |
| 783 | 470 write_label_var( 480, 800, y_line, &FontT48, strSensorValue); |
| 471 } | |
| 472 } | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
473 |
| 783 | 474 if(pSettings->ext_sensor_map[0] == SENSOR_OPTIC) |
| 475 { | |
| 476 strSensorId[0] = TXT_2BYTE; | |
| 477 strSensorId[1] = TXT2BYTE_HUDbattery; | |
| 478 strSensorId[2] = 0; | |
| 479 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId); | |
| 480 | |
| 481 snprintf(strSensorId, 20,"%01.3fV", get_HUD_battery_voltage_V()); | |
| 482 write_label_var( 480, 800, ME_Y_LINE4, &FontT48, strSensorId); | |
| 483 } | |
| 484 else | |
| 485 { | |
| 486 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) | |
|
754
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
487 #ifdef ENABLE_SENTINEL_MODE |
| 746 | 488 || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_SENTINEL) |
| 489 #endif | |
| 490 ) | |
| 783 | 491 { |
| 492 strSensorId[0] = TXT_2BYTE; | |
| 493 strSensorId[1] = TXT2BYTE_O2Calib; | |
| 494 strSensorId[2] = 0; | |
| 495 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId); | |
| 496 snprintf(strSensorId, 20,"%d%%", O2_calib_gas); | |
| 497 write_label_var( 480, 800, ME_Y_LINE4, &FontT48, strSensorId); | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
498 } |
| 783 | 499 } |
| 500 if(DataEX_external_ADC_Present()) | |
| 501 { | |
| 502 strSensorId[0] = TXT_2BYTE; | |
| 503 strSensorId[1] = TXT2BYTE_SensorDetect; | |
| 504 strSensorId[2] = 0; | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
505 |
| 783 | 506 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, strSensorId); |
| 507 } | |
|
734
190e5814b2f5
Removed interface selection from sensor menu:
Ideenmodellierer
parents:
730
diff
changeset
|
508 |
| 827 | 509 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX)) |
| 783 | 510 { |
| 511 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1); | |
| 512 } | |
| 827 | 513 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX)) |
| 783 | 514 { |
| 515 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2); | |
| 516 } | |
| 827 | 517 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX)) |
| 783 | 518 { |
| 519 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3); | |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
520 } |
| 38 | 521 |
| 584 | 522 if(get_globalState() == StMHARD3_O2_Calibrate) |
| 523 { | |
| 524 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_O2Calib,TXT2BYTE_ButtonPlus); | |
| 525 } | |
| 526 else | |
| 527 { | |
| 528 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
| 529 } | |
| 38 | 530 } |
| 531 | |
| 532 | |
| 533 void openEdit_O2Sensors(void) | |
| 534 { | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
535 SSettings *pSettings = settingsGetPointer(); |
| 38 | 536 uint8_t sensorActive[3]; |
| 783 | 537 uint8_t index = 0; |
| 746 | 538 char text[3]; |
| 926 | 539 uint32_t firstSensorId = 0; |
| 38 | 540 |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
541 set_globalState(StMHARD3_Sensors); |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
542 resetMenuEdit(CLUT_MenuPageHardware); |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
543 |
| 783 | 544 for(index = 0; index < 3; index++ ) |
| 545 { | |
| 546 if(pSettings->ppo2sensors_deactivated & (0x01 << index)) | |
| 547 { | |
| 548 sensorActive[index] = 0; | |
| 549 } | |
| 550 else | |
| 551 { | |
| 552 sensorActive[index] = 1; | |
| 553 } | |
| 554 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
555 |
| 926 | 556 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_TYPE_O2_END))) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
557 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
558 pSettings->ppo2sensors_deactivated |= 1; |
| 930 | 559 if(pSettings->ext_sensor_map[0] == SENSOR_CO2M) |
| 560 { | |
| 561 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", pSettings->co2_sensor_active); | |
| 562 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
563 } |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
564 else |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
565 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
566 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); |
| 926 | 567 if(firstSensorId == 0) |
| 568 { | |
| 569 firstSensorId = StMHARD3_O2_Sensor1; | |
| 570 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
571 } |
| 926 | 572 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_TYPE_O2_END))) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
573 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
574 pSettings->ppo2sensors_deactivated |= 2; |
| 930 | 575 if(pSettings->ext_sensor_map[1] == SENSOR_CO2M) |
| 576 { | |
| 577 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", pSettings->co2_sensor_active); | |
| 578 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
579 } |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
580 else |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
581 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
582 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); |
| 926 | 583 if(firstSensorId == 0) |
| 584 { | |
| 585 firstSensorId = StMHARD3_O2_Sensor2; | |
| 586 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
587 } |
| 926 | 588 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_TYPE_O2_END))) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
589 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
590 pSettings->ppo2sensors_deactivated |= 4; |
| 930 | 591 if(pSettings->ext_sensor_map[2] == SENSOR_CO2M) |
| 592 { | |
| 593 write_field_on_off(StMHARD3_O2_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", pSettings->co2_sensor_active); | |
| 594 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
595 } |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
596 else |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
597 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
598 write_field_on_off(StMHARD3_O2_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); |
| 926 | 599 if(firstSensorId == 0) |
| 600 { | |
| 601 firstSensorId = StMHARD3_O2_Sensor3; | |
| 602 } | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
603 } |
|
814
26ae9e8f24fd
Dev Bugfix: O2 values of new detected sensors were shown as invalid:
Ideenmodellierer
parents:
799
diff
changeset
|
604 |
|
26ae9e8f24fd
Dev Bugfix: O2 values of new detected sensors were shown as invalid:
Ideenmodellierer
parents:
799
diff
changeset
|
605 stateRealGetPointerWrite()->diveSettings.ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; |
|
26ae9e8f24fd
Dev Bugfix: O2 values of new detected sensors were shown as invalid:
Ideenmodellierer
parents:
799
diff
changeset
|
606 |
| 38 | 607 if(settingsGetPointer()->ppo2sensors_deactivated & 1) |
| 608 sensorActive[0] = 0; | |
| 609 if(settingsGetPointer()->ppo2sensors_deactivated & 2) | |
| 610 sensorActive[1] = 0; | |
| 611 if(settingsGetPointer()->ppo2sensors_deactivated & 4) | |
| 612 sensorActive[2] = 0; | |
| 613 | |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
614 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) |
| 689 | 615 #ifdef ENABLE_SENTINEL_MODE |
| 616 || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_SENTINEL) | |
| 617 #endif | |
| 618 ) | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
619 { |
| 584 | 620 write_label_fix( 30, 800, ME_Y_LINE4, &FontT48, TXT2BYTE_O2Calib); |
| 621 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, "\016\016 %\017"); | |
| 622 | |
|
673
d7c5d592076b
Show 98% in case of Oxygen as the calibrating gas
heinrichsweikamp
parents:
605
diff
changeset
|
623 write_field_toggle(StMHARD3_O2_Calibrate, 400, 800, ME_Y_LINE4, &FontT48, "", 21, 98); |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
624 } |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
625 |
|
754
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
626 if(DataEX_external_ADC_Present()) |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
627 { |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
628 text[0] = TXT_2BYTE; |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
629 text[1] = TXT2BYTE_SensorDetect; |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
630 text[2] = 0; |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
631 |
|
754
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
632 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text); |
| 745 | 633 |
|
754
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
634 write_field_button(StMHARD3_Sensor_Detect, 30, 800, ME_Y_LINE6, &FontT48, text); |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
635 } |
| 745 | 636 |
| 827 | 637 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX)) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
638 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
639 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1); |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
640 } |
| 827 | 641 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX)) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
642 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
643 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2); |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
644 } |
| 827 | 645 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX)) |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
646 { |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
647 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3); |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
648 } |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
649 |
|
703
2f457024049b
Added selection of digital o2 sensor source to HW menu:
Ideenmodellierer
parents:
689
diff
changeset
|
650 if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) |
| 689 | 651 #ifdef ENABLE_SENTINEL_MODE |
| 652 || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_SENTINEL) | |
| 653 #endif | |
| 654 ) | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
655 { |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
656 setEvent(StMHARD3_O2_Calibrate, (uint32_t)OnAction_O2_Calibrate); |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
657 } |
|
708
7e3bf2c0cd40
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
703
diff
changeset
|
658 |
|
754
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
659 if(DataEX_external_ADC_Present()) |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
660 { |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
661 setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect); |
|
ec7b62983a8c
Only show autodetection in sensor menu if external interface is present:
Ideenmodellierer
parents:
748
diff
changeset
|
662 } |
| 38 | 663 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 926 | 664 |
| 665 switch(firstSensorId) | |
| 666 { | |
| 667 case StMHARD3_O2_Sensor2: tMenuEdit_select(StMHARD3_O2_Sensor2); | |
| 668 break; | |
| 669 case StMHARD3_O2_Sensor3: tMenuEdit_select(StMHARD3_O2_Sensor3); | |
| 670 break; | |
| 671 default: break; | |
| 672 } | |
| 38 | 673 } |
| 674 | |
| 675 | |
| 676 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 677 { | |
| 783 | 678 const SDiveState *pStateReal = stateRealGetPointer(); |
| 679 | |
| 827 | 680 if((pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_CO2M)) |
| 783 | 681 { |
| 682 return EXIT_TO_INFO_SENSOR; | |
| 683 } | |
| 684 else | |
| 685 { | |
| 686 if(settingsGetPointer()->ppo2sensors_deactivated & 1) | |
| 687 { | |
| 688 settingsGetPointer()->ppo2sensors_deactivated &= 4+2; | |
| 689 tMenuEdit_set_on_off(editId, 1); | |
| 690 } | |
| 691 else | |
| 692 { | |
| 693 settingsGetPointer()->ppo2sensors_deactivated |= 1; | |
| 694 tMenuEdit_set_on_off(editId, 0); | |
| 695 } | |
| 696 } | |
| 38 | 697 |
| 698 return UPDATE_DIVESETTINGS; | |
| 699 } | |
| 700 | |
| 701 | |
| 702 uint8_t OnAction_Sensor2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 703 { | |
| 783 | 704 const SDiveState *pStateReal = stateRealGetPointer(); |
| 38 | 705 |
| 827 | 706 if((pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_CO2M)) |
| 783 | 707 { |
| 708 return EXIT_TO_INFO_SENSOR; | |
| 709 } | |
| 710 else | |
| 711 { | |
| 712 if(settingsGetPointer()->ppo2sensors_deactivated & 2) | |
| 713 { | |
| 714 settingsGetPointer()->ppo2sensors_deactivated &= 4+1; | |
| 715 tMenuEdit_set_on_off(editId, 1); | |
| 716 } | |
| 717 else | |
| 718 { | |
| 719 settingsGetPointer()->ppo2sensors_deactivated |= 2; | |
| 720 tMenuEdit_set_on_off(editId, 0); | |
| 721 } | |
| 722 } | |
| 38 | 723 return UPDATE_DIVESETTINGS; |
| 724 } | |
| 725 | |
| 726 | |
| 727 uint8_t OnAction_Sensor3(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 728 { | |
| 783 | 729 const SDiveState *pStateReal = stateRealGetPointer(); |
| 730 | |
| 827 | 731 if((pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_CO2M)) |
| 783 | 732 { |
| 733 return EXIT_TO_INFO_SENSOR; | |
| 734 } | |
| 735 else | |
| 736 { | |
| 38 | 737 |
| 783 | 738 if(settingsGetPointer()->ppo2sensors_deactivated & 4) |
| 739 { | |
| 740 settingsGetPointer()->ppo2sensors_deactivated &= 2+1; | |
| 741 tMenuEdit_set_on_off(editId, 1); | |
| 742 } | |
| 743 else | |
| 744 { | |
| 745 settingsGetPointer()->ppo2sensors_deactivated |= 4; | |
| 746 tMenuEdit_set_on_off(editId, 0); | |
| 747 } | |
| 748 } | |
| 38 | 749 return UPDATE_DIVESETTINGS; |
| 750 } | |
| 751 | |
| 752 | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
753 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
754 { |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
755 uint8_t loop; |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
756 const SDiveState *pStateReal = stateRealGetPointer(); |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
757 SSettings* pSettings = settingsGetPointer(); |
| 584 | 758 uint8_t retVal = UNSPECIFIC_RETURN; |
| 759 float compensatedRef; | |
| 38 | 760 |
| 584 | 761 if(action == ACTION_BUTTON_ENTER_FINAL) |
| 762 { | |
| 763 if(O2_calib_gas == 21) | |
| 764 { | |
| 765 compensatedRef = O2_CALIB_FRACTION_AIR * pStateReal->lifeData.pressure_ambient_bar / 1.0; | |
| 766 } | |
| 767 else | |
| 768 { | |
| 605 | 769 compensatedRef = O2_CALIB_FRACTION_O2 * pStateReal->lifeData.pressure_ambient_bar / 1.0; |
| 584 | 770 } |
| 771 for(loop=0;loop<3;loop++) | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
772 { |
| 584 | 773 if((pSettings->ppo2sensors_deactivated & (0x1 << loop)) == 0) |
| 774 { | |
| 775 if(pStateReal->lifeData.sensorVoltage_mV[loop] > 0.0001) /* sensor connected ?*/ | |
| 776 { | |
|
724
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
777 #ifdef ENABLE_EXTERNAL_PRESSURE |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
778 if(loop == 2) |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
779 { |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
780 compensatedRef = pStateReal->lifeData.pressure_ambient_bar; |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
781 } |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
782 #endif |
|
f285424f04d9
Development feature: external pressure sensor
Ideenmodellierer
parents:
718
diff
changeset
|
783 |
| 584 | 784 pSettings->ppo2sensors_calibCoeff[loop] = compensatedRef / pStateReal->lifeData.sensorVoltage_mV[loop]; |
| 785 } | |
| 786 else | |
| 787 { | |
| 788 pSettings->ppo2sensors_calibCoeff[loop] = 0.0; | |
| 789 settingsGetPointer()->ppo2sensors_deactivated |= 0x1 << loop; | |
| 790 } | |
| 791 } | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
792 } |
| 584 | 793 tMenuEdit_newInput(editId, O2_calib_gas, 0, 0, 0); |
| 794 retVal = UPDATE_DIVESETTINGS; | |
| 795 } | |
| 796 if(action == ACTION_BUTTON_NEXT) | |
| 797 { | |
| 798 if(O2_calib_gas == 21) | |
| 799 { | |
|
673
d7c5d592076b
Show 98% in case of Oxygen as the calibrating gas
heinrichsweikamp
parents:
605
diff
changeset
|
800 O2_calib_gas = 98; |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
801 } |
| 584 | 802 else |
| 803 { | |
| 804 O2_calib_gas = 21; | |
| 805 } | |
| 806 } | |
| 807 retVal = O2_calib_gas; | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
808 |
| 584 | 809 if(action == ACTION_BUTTON_BACK) |
| 810 { | |
| 811 exitMenuEditField(); | |
| 812 } | |
| 813 | |
| 814 return retVal; | |
|
562
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
815 } |
|
ec76fa85009e
Added ADC sensor interface to O2 sensore menu structure:
Ideenmodellierer
parents:
539
diff
changeset
|
816 |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
817 uint8_t OnAction_Sensor_Info(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
818 { |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
819 return EXIT_TO_INFO_SENSOR; |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
820 } |
|
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
821 |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
822 uint8_t OnAction_Sensor_Detect(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
823 { |
|
957
3420e3ba698d
External sensor commands: Add sensor ID to command:
Ideenmodellierer
parents:
949
diff
changeset
|
824 DataEX_setExtInterface_Cmd(EXT_INTERFACE_AUTODETECT, 0); |
|
730
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
825 return UNSPECIFIC_RETURN; |
|
9c65d226f4f6
Update sensor menu support for automatic sensor detection:
Ideenmodellierer
parents:
724
diff
changeset
|
826 } |
|
718
b9f699d2e3d0
Updated menu structure to support new sensor information page:
Ideenmodellierer
parents:
709
diff
changeset
|
827 |
| 38 | 828 void openEdit_Brightness(void) |
| 829 { | |
| 830 uint8_t actualBrightness; | |
| 831 SSettings *pSettings = settingsGetPointer(); | |
| 832 | |
| 833 actualBrightness = pSettings->brightness; | |
| 834 actualBrightness++; | |
| 835 if(actualBrightness > 4) | |
| 836 actualBrightness = 0; | |
| 837 pSettings->brightness = actualBrightness; | |
| 838 exitEditWithUpdate(); | |
| 839 } | |
| 840 | |
| 841 | |
| 842 void buttonBalanceText_helper(uint8_t idOfButton, char *textOutput) | |
| 843 { | |
| 844 uint8_t txtcount = 0; | |
| 845 | |
| 846 if(idOfButton < 3) | |
| 847 { | |
| 848 textOutput[txtcount++] = '@' + settingsGetPointer()->buttonBalance[idOfButton]; | |
| 849 textOutput[txtcount++] = ' '; | |
| 850 textOutput[txtcount++] = ' '; | |
| 851 textOutput[txtcount++] = '('; | |
| 852 | |
| 853 switch(settingsGetPointer()->buttonBalance[idOfButton]) | |
| 854 { | |
| 855 case 1: | |
| 856 textOutput[txtcount++] = '-'; | |
| 857 textOutput[txtcount++] = '2'; | |
| 858 textOutput[txtcount++] = '0'; | |
| 859 break; | |
| 860 case 2: | |
| 861 textOutput[txtcount++] = '-'; | |
| 862 textOutput[txtcount++] = '1'; | |
| 863 textOutput[txtcount++] = '0'; | |
| 864 break; | |
| 865 case 3: | |
| 866 default: | |
| 867 textOutput[txtcount++] = '0'; | |
| 868 break; | |
| 869 case 4: | |
| 870 textOutput[txtcount++] = '+'; | |
| 871 textOutput[txtcount++] = '1'; | |
| 872 textOutput[txtcount++] = '0'; | |
| 873 break; | |
| 874 case 5: | |
| 875 textOutput[txtcount++] = '+'; | |
| 876 textOutput[txtcount++] = '2'; | |
| 877 textOutput[txtcount++] = '0'; | |
| 878 break; | |
| 879 } | |
| 880 textOutput[txtcount++] = ')'; | |
| 881 } | |
| 882 textOutput[txtcount++] = 0; | |
| 883 } | |
| 884 | |
| 885 /**# | |
| 886 ****************************************************************************** | |
| 887 * @brief BUTTONS | |
| 888 * @author heinrichs weikamp gmbh | |
| 889 * @version V 01 | |
| 890 * @date 15-Sept-2016 | |
| 891 ****************************************************************************** | |
| 892 * Button 0 is right, Button 1 is middle, Button 2 is left !!!! | |
| 893 * 2 1 0 (base value 3) | |
| 894 * Button 3 is used to store the base value, all others are balanced around this one! | |
| 895 * | |
| 896 */ | |
| 897 | |
| 898 void openEdit_ButtonSens(void) | |
| 899 { | |
| 900 char text[32]; | |
| 901 uint8_t sens; | |
| 902 const uint32_t eventListButtonBalance[3] = {StMHARD5_ButtonBalance1,StMHARD5_ButtonBalance2,StMHARD5_ButtonBalance3}; | |
| 903 | |
| 904 sens = (uint8_t)settingsGetPointer()->ButtonResponsiveness[3]; | |
| 905 write_field_3digit(StMHARD5_Button1, 360, 780, ME_Y_LINE1, &FontT48, "###", sens, 0, 0, 0); | |
| 906 | |
| 907 for(int i=2;i>=0;i--) | |
| 908 { | |
| 909 buttonBalanceText_helper(i,text); | |
| 910 write_field_button(eventListButtonBalance[i],360,500,ME_Y_LINE4-(i*ME_Y_LINE_STEP),&FontT48,text); | |
| 911 } | |
| 912 | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
913 snprintf(text,32,"%c",TXT_ButtonLock); |
| 884 | 914 write_field_on_off(StMHARD5_ButtonLock, 30, 700, ME_Y_LINE5, &FontT48, text, settingsGetPointer()->buttonLockActive); |
| 38 | 915 |
| 916 setEvent(StMHARD5_Button1, (uint32_t)OnAction_Button); | |
| 917 | |
| 918 for(int i=2;i>=0;i--) | |
| 919 { | |
| 920 setEvent(eventListButtonBalance[i], (uint32_t)OnAction_ButtonBalance); | |
| 921 } | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
922 setEvent(StMHARD5_ButtonLock, (uint32_t)OnAction_ButtonLock); |
| 38 | 923 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 924 } | |
| 925 | |
| 926 | |
| 927 void refresh_ButtonValuesFromPIC(void) | |
| 928 { | |
| 929 uint8_t sens[3]; | |
| 930 char text[64]; | |
| 931 | |
| 932 text[0] = '\001'; | |
| 933 text[1] = TXT_2BYTE; | |
| 934 text[2] = TXT2BYTE_ButtonSensitivity; | |
| 935 text[3] = 0; | |
| 936 write_topline(text); | |
| 937 | |
| 938 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
| 939 | |
| 940 for(int i=0;i<3;i++) | |
| 941 { | |
| 942 text[0] = TXT_2BYTE; | |
| 943 text[1] = TXT2BYTE_ButtonLeft+i; | |
| 944 text[2] = 0; | |
| 945 write_label_var( 20, 300, ME_Y_LINE2+(i*ME_Y_LINE_STEP), &FontT48, text); | |
| 946 } | |
| 947 | |
| 948 for(int i=0;i<3;i++) | |
| 949 { | |
| 950 sens[i] = settingsHelperButtonSens_translate_hwOS_values_to_percentage(stateRealGetPointer()->lifeData.buttonPICdata[i]); | |
| 951 } | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
952 snprintf(text,64,"\020\016\016%c%c \017 (%03u %03u %03u)",TXT_2BYTE,TXT2BYTE_LowerIsLess,sens[2],sens[1],sens[0]); |
| 884 | 953 write_label_var( 20, 700, ME_Y_LINE6, &FontT42, text); |
| 38 | 954 |
| 955 tMenuEdit_refresh_field(StMHARD5_Button1); | |
| 956 tMenuEdit_refresh_field(StMHARD5_ButtonBalance1); | |
| 957 tMenuEdit_refresh_field(StMHARD5_ButtonBalance2); | |
| 958 tMenuEdit_refresh_field(StMHARD5_ButtonBalance3); | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
959 tMenuEdit_refresh_field(StMHARD5_ButtonLock); |
| 38 | 960 } |
| 961 | |
| 962 | |
| 963 uint8_t OnAction_Button(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 964 { | |
| 965 uint8_t digitContentNew, remainder; | |
| 966 uint32_t newSensitivityGlobal; | |
| 967 | |
| 968 if(action == ACTION_BUTTON_NEXT) | |
| 969 { | |
| 970 digitContentNew = digitContent - '0'; | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
971 if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI) |
| 38 | 972 { |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
973 digitContentNew = MIN_BUTTONRESPONSIVENESS_GUI; |
| 38 | 974 } |
| 975 else | |
| 976 { | |
| 977 remainder = digitContentNew%5; | |
| 978 digitContentNew += 5 - remainder; | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
979 if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI) |
|
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
980 digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI; |
| 38 | 981 } |
| 982 return '0' + digitContentNew; | |
| 983 } | |
| 984 | |
| 985 if(action == ACTION_BUTTON_BACK) | |
| 986 { | |
| 987 digitContentNew = digitContent - '0'; | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
988 if(digitContentNew <= MIN_BUTTONRESPONSIVENESS_GUI) |
|
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
989 digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI; |
| 38 | 990 else |
| 991 { | |
| 992 remainder = digitContentNew%5; | |
| 993 if(remainder) | |
| 994 digitContentNew -= remainder; | |
| 995 else | |
| 996 digitContentNew -= 5; | |
| 997 } | |
| 998 return '0' + digitContentNew; | |
| 999 } | |
| 1000 | |
| 1001 if(action == ACTION_BUTTON_ENTER_FINAL) | |
| 1002 { | |
| 1003 evaluateNewString(editId, &newSensitivityGlobal, 0, 0, 0); | |
| 1004 settingsHelperButtonSens_keepPercentageValues(newSensitivityGlobal, settingsGetPointer()->ButtonResponsiveness); | |
| 1005 setButtonResponsiveness(settingsGetPointer()->ButtonResponsiveness); | |
| 1006 return UNSPECIFIC_RETURN; | |
| 1007 } | |
| 1008 return digitContent; | |
| 1009 } | |
| 1010 | |
| 1011 | |
| 1012 uint8_t OnAction_ButtonBalance(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 1013 { | |
| 1014 int8_t idBalance = -1; | |
| 1015 uint8_t *ptrSetting; | |
| 1016 char text[32]; | |
| 1017 | |
| 1018 const uint32_t eventListButtonBalance[3] = {StMHARD5_ButtonBalance1,StMHARD5_ButtonBalance2,StMHARD5_ButtonBalance3}; | |
| 1019 | |
| 1020 idBalance = -1; | |
| 1021 for(int i=0;i<3;i++) | |
| 1022 { | |
| 1023 if(editId == eventListButtonBalance[i]) | |
| 1024 { | |
| 1025 idBalance = i; | |
| 1026 break; | |
| 1027 } | |
| 1028 } | |
| 1029 | |
| 1030 if((idBalance >= 0) && (idBalance < 3)) | |
| 1031 { | |
| 1032 ptrSetting = &settingsGetPointer()->buttonBalance[idBalance]; | |
| 1033 | |
| 1034 *ptrSetting += 1; | |
| 1035 | |
| 1036 if(*ptrSetting > 5) | |
| 1037 *ptrSetting = 2; | |
| 1038 | |
| 1039 buttonBalanceText_helper(idBalance,text); | |
| 1040 tMenuEdit_newButtonText(eventListButtonBalance[idBalance],text); | |
| 1041 } | |
| 1042 | |
| 1043 return UNSPECIFIC_RETURN; | |
| 1044 } | |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1045 |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1046 uint8_t OnAction_ButtonLock(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1047 { |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1048 SSettings *pSettings = settingsGetPointer(); |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1049 |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1050 if(pSettings->buttonLockActive) |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1051 { |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1052 pSettings->buttonLockActive = 0; |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1053 tMenuEdit_set_on_off(editId, 0); |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1054 } |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1055 else |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1056 { |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1057 pSettings->buttonLockActive = 1; |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1058 tMenuEdit_set_on_off(editId, 1); |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1059 } |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1060 |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1061 return UNSPECIFIC_RETURN; |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
734
diff
changeset
|
1062 } |
