Mercurial > public > ostc4
annotate Discovery/Src/tMenuHardware.c @ 117:e6b190f5fbc7 FlipDisplay
Submenus may have 6 items
Write_content_simple is screen orientation aware => remove not needed code
author | Ideenmodellierer |
---|---|
date | Sun, 06 Jan 2019 22:30:35 +0100 |
parents | cc8e24374b83 |
children | cc9c18075e00 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuHardware.c | |
5 /// \brief Main Template file for Menu Page Hardware | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 05-Aug-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenu.h" | |
31 #include "tMenuHardware.h" | |
32 //#include "bonex4.h" | |
33 | |
34 //#define NEXTLINE(text, textPointer) {text[(textPointer)++] = '\n'; text[textPointer++] = '\r'; text[textPointer] = 0;} | |
35 // NEXTLINE(text,textPointer); | |
36 | |
37 | |
38 //\ text[(*textPointer)++] = '\r'; text[*textPointer] = 0; | |
39 | |
40 /* Exported functions --------------------------------------------------------*/ | |
41 | |
42 uint32_t tMHardware_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
43 { | |
44 | |
45 SSettings *data; | |
46 uint8_t textPointer, actualBrightness; | |
47 char sensorStatusColor[3]; | |
48 int32_t button[4]; | |
49 data = settingsGetPointer(); | |
50 textPointer = 0; | |
51 *tab = 450; | |
52 *subtext = 0; | |
53 /* | |
54 const char content[6] = | |
55 { TXT_Compass, | |
56 TXT_o2Sensors, | |
57 TXT_Brightness, | |
58 TXT_FirmwareUpdate,//TXT_Luftintegration, | |
59 0,//TXT_FirmwareUpdate, | |
60 0 | |
61 }; | |
62 tM_refresh(text,&textPointer,line,content); | |
63 */ | |
64 if((line == 0) || (line == 1)) | |
65 { | |
66 text[textPointer++] = TXT_2BYTE; | |
67 text[textPointer++] = TXT2BYTE_Bluetooth; | |
68 text[textPointer++] = '\t'; | |
69 if(settingsGetPointer()->bluetoothActive) | |
70 text[textPointer++] = '\005'; | |
71 else | |
72 text[textPointer++] = '\006'; | |
73 text[textPointer] = 0; | |
74 } | |
75 nextline(text,&textPointer); | |
76 | |
77 if((line == 0) || (line == 2)) | |
78 { | |
79 text[textPointer++] = TXT_2BYTE; | |
80 text[textPointer++] = TXT2BYTE_Compass; | |
81 text[textPointer++] = '\t'; | |
82 | |
83 if(settingsGetPointer()->compassBearing != 0) | |
84 { | |
85 textPointer += snprintf(&text[textPointer],20,"(%03u`)",settingsGetPointer()->compassBearing); | |
86 } | |
87 text[textPointer] = 0; | |
88 /* | |
89 textPointer += snprintf(&text[textPointer],20,"%i %i %i" | |
90 ,stateUsed->lifeData.compass_DX_f | |
91 ,stateUsed->lifeData.compass_DY_f | |
92 ,stateUsed->lifeData.compass_DZ_f); | |
93 */ | |
94 } | |
95 nextline(text,&textPointer); | |
96 | |
97 if((line == 0) || (line == 3)) | |
98 { | |
99 text[textPointer++] = TXT_o2Sensors; | |
100 if((stateUsed->lifeData.ppO2Sensor_bar[0] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0)) | |
101 { | |
102 text[textPointer++] = '\t'; | |
103 sensorStatusColor[0] = '\020'; | |
104 sensorStatusColor[1] = '\020'; | |
105 sensorStatusColor[2] = '\020'; | |
106 if(stateUsed->diveSettings.ppo2sensors_deactivated) | |
107 { | |
108 if(stateUsed->diveSettings.ppo2sensors_deactivated & 1) | |
109 sensorStatusColor[0] = '\021'; | |
110 if(stateUsed->diveSettings.ppo2sensors_deactivated & 2) | |
111 sensorStatusColor[1] = '\021'; | |
112 if(stateUsed->diveSettings.ppo2sensors_deactivated & 4) | |
113 sensorStatusColor[2] = '\021'; | |
114 } | |
115 textPointer += snprintf(&text[textPointer],20,"%c%01.1f %c%01.1f %c%01.1f\020" | |
116 ,sensorStatusColor[0], stateUsed->lifeData.ppO2Sensor_bar[0] | |
117 ,sensorStatusColor[1], stateUsed->lifeData.ppO2Sensor_bar[1] | |
118 ,sensorStatusColor[2], stateUsed->lifeData.ppO2Sensor_bar[2]); | |
119 } | |
120 } | |
121 nextline(text,&textPointer); | |
122 | |
123 if((line == 0) || (line == 4)) | |
124 { | |
125 text[textPointer++] = TXT_Brightness; | |
126 text[textPointer++] = '\t'; | |
127 | |
128 actualBrightness = data->brightness; | |
129 | |
130 if(actualBrightness == 0) | |
131 text[textPointer++] = TXT_Cave; | |
132 else if(actualBrightness == 1) | |
133 text[textPointer++] = TXT_Eco; | |
134 else if(actualBrightness == 2) | |
135 text[textPointer++] = TXT_Normal; | |
136 else if(actualBrightness == 3) | |
137 text[textPointer++] = TXT_Bright; | |
138 else if(actualBrightness == 4) | |
139 text[textPointer++] = TXT_Ultrabright; | |
140 else | |
141 text[textPointer++] = '+'; | |
142 } | |
143 nextline(text,&textPointer); | |
144 | |
145 if((line == 0) || (line == 5)) | |
146 { | |
147 text[textPointer++] = TXT_2BYTE; | |
148 text[textPointer++] = TXT2BYTE_ButtonSensitivity; | |
149 text[textPointer++] = '\t'; | |
150 | |
151 for(int i=0;i<=3;i++) | |
152 { | |
153 button[i] = (uint8_t)settingsGetPointer()->ButtonResponsiveness[i]; | |
154 } | |
155 // textPointer += snprintf(&text[textPointer],25,"%i %i %i",button[0],button[1],button[2]); | |
156 textPointer += snprintf(&text[textPointer],25, | |
157 "%i" | |
158 "\016\016" | |
159 " %%" | |
160 "\017", | |
161 button[3]); | |
162 } | |
163 nextline(text,&textPointer); | |
164 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
165 if((line == 0) || (line == 6)) |
38 | 166 { |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
167 if(getLicence() == LICENCEBONEX) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
168 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
169 text[textPointer++] = TXT_2BYTE; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
170 text[textPointer++] = TXT2BYTE_ScooterSetup; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
171 text[textPointer++] = '\t'; |
38 | 172 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
173 // textPointer += snprintf(&text[textPointer],25,"D%i L%i ",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
174 textPointer += snprintf(&text[textPointer],25,"D%i L%i %i\016\016 Wh\017",settingsGetPointer()->scooterDrag, settingsGetPointer()->scooterLoad, settingsGetPointer()->scooterBattSize); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
175 // textPointer += bo4GetBatteryName(&text[textPointer], settingsGetPointer()->scooterBattType); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
176 nextline(text,&textPointer); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
177 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
178 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
179 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
180 text[textPointer++] = TXT_2BYTE; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
181 text[textPointer++] = TXT2BYTE_FLIPDISPLAY; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
182 text[textPointer++] = '\t'; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
183 if(settingsGetPointer()->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
184 text[textPointer++] = '\005'; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
185 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
186 text[textPointer++] = '\006'; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
187 text[textPointer] = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
188 nextline(text,&textPointer); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
189 } |
38 | 190 } |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
191 |
38 | 192 return StMHARD; |
193 } |