Mercurial > public > ostc4
annotate Discovery/Src/tMenuHardware.c @ 1007:65d35e66efb9 GasConsumption
Improve compass calibration dialog:
The previous calibration dialog showed some "magic" numbers and a 60 second count down. The new version is trying to guide the user through the calibration process: first rotate pitch, then roll and at last yaw angle. A step to the next angle is taken when enough data per angle is collected (change from red to green). To enable the yaw visualization a simple calibration is done while rotating the axis.
The function behind the calibration was not modified => the suggested process can be ignored and the same handling as the with old dialog may be applied. With the new process the dialog may be left early. Anyhow it will still be left after 60 seconds and the fine calibration is performed in the same way as before.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 05 May 2025 21:02:34 +0200 |
| parents | 85f7e19c6688 |
| children | f8e2895c91e5 |
| 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" | |
|
1005
85f7e19c6688
Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents:
999
diff
changeset
|
32 #include "ostc.h" |
| 38 | 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_o2Sensors; | |
| 80 if((stateUsed->lifeData.ppO2Sensor_bar[0] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0) || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0)) | |
| 81 { | |
| 82 text[textPointer++] = '\t'; | |
| 83 sensorStatusColor[0] = '\020'; | |
| 84 sensorStatusColor[1] = '\020'; | |
| 85 sensorStatusColor[2] = '\020'; | |
| 827 | 86 |
| 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 | 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 | 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 | 93 |
| 38 | 94 textPointer += snprintf(&text[textPointer],20,"%c%01.1f %c%01.1f %c%01.1f\020" |
| 95 ,sensorStatusColor[0], stateUsed->lifeData.ppO2Sensor_bar[0] | |
| 96 ,sensorStatusColor[1], stateUsed->lifeData.ppO2Sensor_bar[1] | |
| 97 ,sensorStatusColor[2], stateUsed->lifeData.ppO2Sensor_bar[2]); | |
| 98 } | |
| 99 } | |
| 100 nextline(text,&textPointer); | |
| 101 | |
| 999 | 102 if((line == 0) || (line == 3)) |
| 38 | 103 { |
| 104 text[textPointer++] = TXT_Brightness; | |
| 105 text[textPointer++] = '\t'; | |
| 106 | |
| 107 actualBrightness = data->brightness; | |
| 108 | |
| 109 if(actualBrightness == 0) | |
| 110 text[textPointer++] = TXT_Cave; | |
| 111 else if(actualBrightness == 1) | |
| 112 text[textPointer++] = TXT_Eco; | |
| 113 else if(actualBrightness == 2) | |
| 114 text[textPointer++] = TXT_Normal; | |
| 115 else if(actualBrightness == 3) | |
| 116 text[textPointer++] = TXT_Bright; | |
| 117 else if(actualBrightness == 4) | |
| 118 text[textPointer++] = TXT_Ultrabright; | |
| 119 else | |
| 120 text[textPointer++] = '+'; | |
| 121 } | |
| 122 nextline(text,&textPointer); | |
| 123 | |
| 999 | 124 if((line == 0) || (line == 4)) |
| 38 | 125 { |
| 126 text[textPointer++] = TXT_2BYTE; | |
| 127 text[textPointer++] = TXT2BYTE_ButtonSensitivity; | |
| 128 text[textPointer++] = '\t'; | |
| 129 | |
| 130 for(int i=0;i<=3;i++) | |
| 131 { | |
| 132 button[i] = (uint8_t)settingsGetPointer()->ButtonResponsiveness[i]; | |
| 133 } | |
| 134 // textPointer += snprintf(&text[textPointer],25,"%i %i %i",button[0],button[1],button[2]); | |
| 135 textPointer += snprintf(&text[textPointer],25, | |
| 317 | 136 "%li" |
| 38 | 137 "\016\016" |
| 138 " %%" | |
| 139 "\017", | |
| 140 button[3]); | |
| 141 } | |
| 142 nextline(text,&textPointer); | |
| 143 | |
|
1005
85f7e19c6688
Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents:
999
diff
changeset
|
144 if((isNewDisplay()) && ((line == 0) || (line == 5))) |
| 38 | 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'; |
| 38 | 155 } |
|
1005
85f7e19c6688
Switch menu position of Buzzer and flipdisplay option:
Ideenmodellierer
parents:
999
diff
changeset
|
156 nextline(text,&textPointer); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
157 |
| 38 | 158 return StMHARD; |
| 159 } |
