Mercurial > public > ostc4
annotate Discovery/Src/tMenuHardware.c @ 1001:21142f4fa968 GasConsumption
Cleanup menu structucture afer menu shift:
Compass and timer have been moved to the new menu => some code cleanup was needed.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 28 Apr 2025 22:53:36 +0200 |
| parents | ac25c35a3c97 |
| children | 85f7e19c6688 |
| 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 | |
| 33 //#define NEXTLINE(text, textPointer) {text[(textPointer)++] = '\n'; text[textPointer++] = '\r'; text[textPointer] = 0;} | |
| 34 // NEXTLINE(text,textPointer); | |
| 35 | |
| 36 | |
| 37 //\ text[(*textPointer)++] = '\r'; text[*textPointer] = 0; | |
| 38 | |
| 39 /* Exported functions --------------------------------------------------------*/ | |
| 40 | |
| 41 uint32_t tMHardware_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
| 42 { | |
| 43 | |
| 44 SSettings *data; | |
| 45 uint8_t textPointer, actualBrightness; | |
| 46 char sensorStatusColor[3]; | |
| 47 int32_t button[4]; | |
| 48 data = settingsGetPointer(); | |
| 49 textPointer = 0; | |
| 50 *tab = 450; | |
| 51 *subtext = 0; | |
| 52 /* | |
| 53 const char content[6] = | |
| 54 { TXT_Compass, | |
| 55 TXT_o2Sensors, | |
| 56 TXT_Brightness, | |
| 57 TXT_FirmwareUpdate,//TXT_Luftintegration, | |
| 58 0,//TXT_FirmwareUpdate, | |
| 59 0 | |
| 60 }; | |
| 61 tM_refresh(text,&textPointer,line,content); | |
| 62 */ | |
| 63 if((line == 0) || (line == 1)) | |
| 64 { | |
| 65 text[textPointer++] = TXT_2BYTE; | |
| 66 text[textPointer++] = TXT2BYTE_Bluetooth; | |
| 67 text[textPointer++] = '\t'; | |
| 68 if(settingsGetPointer()->bluetoothActive) | |
| 69 text[textPointer++] = '\005'; | |
| 70 else | |
| 71 text[textPointer++] = '\006'; | |
| 72 text[textPointer] = 0; | |
| 73 } | |
| 74 nextline(text,&textPointer); | |
| 75 | |
| 76 if((line == 0) || (line == 2)) | |
| 77 { | |
| 78 text[textPointer++] = TXT_o2Sensors; | |
| 79 if((stateUsed->lifeData.ppO2Sensor_bar[0] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0)) | |
| 80 { | |
| 81 text[textPointer++] = '\t'; | |
| 82 sensorStatusColor[0] = '\020'; | |
| 83 sensorStatusColor[1] = '\020'; | |
| 84 sensorStatusColor[2] = '\020'; | |
| 827 | 85 |
| 86 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
|
87 sensorStatusColor[0] = '\031'; |
| 827 | 88 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
|
89 sensorStatusColor[1] = '\031'; |
| 827 | 90 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
|
91 sensorStatusColor[2] = '\031'; |
| 827 | 92 |
| 38 | 93 textPointer += snprintf(&text[textPointer],20,"%c%01.1f %c%01.1f %c%01.1f\020" |
| 94 ,sensorStatusColor[0], stateUsed->lifeData.ppO2Sensor_bar[0] | |
| 95 ,sensorStatusColor[1], stateUsed->lifeData.ppO2Sensor_bar[1] | |
| 96 ,sensorStatusColor[2], stateUsed->lifeData.ppO2Sensor_bar[2]); | |
| 97 } | |
| 98 } | |
| 99 nextline(text,&textPointer); | |
| 100 | |
| 999 | 101 if((line == 0) || (line == 3)) |
| 38 | 102 { |
| 103 text[textPointer++] = TXT_Brightness; | |
| 104 text[textPointer++] = '\t'; | |
| 105 | |
| 106 actualBrightness = data->brightness; | |
| 107 | |
| 108 if(actualBrightness == 0) | |
| 109 text[textPointer++] = TXT_Cave; | |
| 110 else if(actualBrightness == 1) | |
| 111 text[textPointer++] = TXT_Eco; | |
| 112 else if(actualBrightness == 2) | |
| 113 text[textPointer++] = TXT_Normal; | |
| 114 else if(actualBrightness == 3) | |
| 115 text[textPointer++] = TXT_Bright; | |
| 116 else if(actualBrightness == 4) | |
| 117 text[textPointer++] = TXT_Ultrabright; | |
| 118 else | |
| 119 text[textPointer++] = '+'; | |
| 120 } | |
| 121 nextline(text,&textPointer); | |
| 122 | |
| 999 | 123 if((line == 0) || (line == 4)) |
| 38 | 124 { |
| 125 text[textPointer++] = TXT_2BYTE; | |
| 126 text[textPointer++] = TXT2BYTE_ButtonSensitivity; | |
| 127 text[textPointer++] = '\t'; | |
| 128 | |
| 129 for(int i=0;i<=3;i++) | |
| 130 { | |
| 131 button[i] = (uint8_t)settingsGetPointer()->ButtonResponsiveness[i]; | |
| 132 } | |
| 133 // textPointer += snprintf(&text[textPointer],25,"%i %i %i",button[0],button[1],button[2]); | |
| 134 textPointer += snprintf(&text[textPointer],25, | |
| 317 | 135 "%li" |
| 38 | 136 "\016\016" |
| 137 " %%" | |
| 138 "\017", | |
| 139 button[3]); | |
| 140 } | |
| 141 nextline(text,&textPointer); | |
| 142 | |
| 999 | 143 if((line == 0) || (line == 5)) |
| 38 | 144 { |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
145 text[textPointer++] = TXT_2BYTE; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
146 text[textPointer++] = TXT2BYTE_FLIPDISPLAY; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
147 text[textPointer++] = '\t'; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
148 if(settingsGetPointer()->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
149 text[textPointer++] = '\005'; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
150 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
151 text[textPointer++] = '\006'; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
152 text[textPointer] = 0; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
153 nextline(text,&textPointer); |
| 38 | 154 } |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
155 |
| 38 | 156 return StMHARD; |
| 157 } |
