annotate Discovery/Src/tMenuHardware.c @ 1039:f8e2895c91e5 GasConsumption

Reorder the 'SYS' menus so that they follow 'features / hardware / display' which should be less confusing for users. Also fix a bug with a non-implemented menu entry in the 'SYS1' menu on OSTC 4 (mikeller)
author heinrichsweikamp
date Mon, 13 Oct 2025 15:44:12 +0200
parents 85f7e19c6688
children
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/tMenuHardware.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for Menu Page Hardware
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 05-Aug-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 "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "tMenuHardware.h"
1005
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
32 #include "ostc.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 //#define NEXTLINE(text, textPointer) {text[(textPointer)++] = '\n'; text[textPointer++] = '\r'; text[textPointer] = 0;}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 // NEXTLINE(text,textPointer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 //\ text[(*textPointer)++] = '\r'; text[*textPointer] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 uint32_t tMHardware_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
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 SSettings *data;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 uint8_t textPointer, actualBrightness;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 char sensorStatusColor[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 int32_t button[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 *tab = 450;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 *subtext = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 const char content[6] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 { TXT_Compass,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 TXT_o2Sensors,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 TXT_Brightness,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 TXT_FirmwareUpdate,//TXT_Luftintegration,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 0,//TXT_FirmwareUpdate,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 tM_refresh(text,&textPointer,line,content);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 if((line == 0) || (line == 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 text[textPointer++] = TXT2BYTE_Bluetooth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 if(settingsGetPointer()->bluetoothActive)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 text[textPointer++] = '\005';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 text[textPointer++] = '\006';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 text[textPointer] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 nextline(text,&textPointer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 if((line == 0) || (line == 2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 text[textPointer++] = TXT_o2Sensors;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 if((stateUsed->lifeData.ppO2Sensor_bar[0] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 sensorStatusColor[0] = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 sensorStatusColor[1] = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 sensorStatusColor[2] = '\020';
827
ffb1036c27c2 Moved CO2 Menu from Xtra to Hardware:
Ideenmodellierer
parents: 759
diff changeset
86
ffb1036c27c2 Moved CO2 Menu from Xtra to Hardware:
Ideenmodellierer
parents: 759
diff changeset
87 if((stateUsed->diveSettings.ppo2sensors_deactivated & 1) || (data->ext_sensor_map[0] > SENSOR_DIGO2M))
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 317
diff changeset
88 sensorStatusColor[0] = '\031';
827
ffb1036c27c2 Moved CO2 Menu from Xtra to Hardware:
Ideenmodellierer
parents: 759
diff changeset
89 if((stateUsed->diveSettings.ppo2sensors_deactivated & 2) || (data->ext_sensor_map[1] > SENSOR_DIGO2M))
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 317
diff changeset
90 sensorStatusColor[1] = '\031';
827
ffb1036c27c2 Moved CO2 Menu from Xtra to Hardware:
Ideenmodellierer
parents: 759
diff changeset
91 if((stateUsed->diveSettings.ppo2sensors_deactivated & 4) || (data->ext_sensor_map[1] > SENSOR_DIGO2M))
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 317
diff changeset
92 sensorStatusColor[2] = '\031';
827
ffb1036c27c2 Moved CO2 Menu from Xtra to Hardware:
Ideenmodellierer
parents: 759
diff changeset
93
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 textPointer += snprintf(&text[textPointer],20,"%c%01.1f %c%01.1f %c%01.1f\020"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 ,sensorStatusColor[0], stateUsed->lifeData.ppO2Sensor_bar[0]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 ,sensorStatusColor[1], stateUsed->lifeData.ppO2Sensor_bar[1]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 ,sensorStatusColor[2], stateUsed->lifeData.ppO2Sensor_bar[2]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 nextline(text,&textPointer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
999
ac25c35a3c97 New Tab for dynamic configuration:
Ideenmodellierer
parents: 827
diff changeset
102 if((line == 0) || (line == 3))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 text[textPointer++] = TXT_Brightness;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 actualBrightness = data->brightness;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 if(actualBrightness == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 text[textPointer++] = TXT_Cave;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 else if(actualBrightness == 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 text[textPointer++] = TXT_Eco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 else if(actualBrightness == 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 text[textPointer++] = TXT_Normal;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 else if(actualBrightness == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 text[textPointer++] = TXT_Bright;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 else if(actualBrightness == 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 text[textPointer++] = TXT_Ultrabright;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 text[textPointer++] = '+';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 nextline(text,&textPointer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123
999
ac25c35a3c97 New Tab for dynamic configuration:
Ideenmodellierer
parents: 827
diff changeset
124 if((line == 0) || (line == 4))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 text[textPointer++] = TXT2BYTE_ButtonSensitivity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 for(int i=0;i<=3;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 button[i] = (uint8_t)settingsGetPointer()->ButtonResponsiveness[i];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 // textPointer += snprintf(&text[textPointer],25,"%i %i %i",button[0],button[1],button[2]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 textPointer += snprintf(&text[textPointer],25,
317
5e8ad1cd353f Resolved warning
ideenmodellierer
parents: 138
diff changeset
136 "%li"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 " %%"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 "\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 button[3]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 nextline(text,&textPointer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143
1005
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
144 if((isNewDisplay()) && ((line == 0) || (line == 5)))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 {
1005
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
146 text[textPointer++] = TXT_2BYTE;
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
147 text[textPointer++] = TXT2BYTE_BUZZER;
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
148 text[textPointer++] = ' ';
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
149 text[textPointer++] = TXT_Warning;
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
150 text[textPointer++] = '\t';
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
151 if(settingsGetPointer()->warningBuzzer)
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
152 text[textPointer++] = '\005';
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
153 else
85f7e19c6688 Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents: 999
diff changeset
154 text[textPointer++] = '\006';
1039
f8e2895c91e5 Reorder the 'SYS' menus so that they follow 'features / hardware / display' which should be less confusing for users.
heinrichsweikamp
parents: 1005
diff changeset
155 nextline(text,&textPointer);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 38
diff changeset
157
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 return StMHARD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 }