Mercurial > public > ostc4
annotate Discovery/Src/tMenuSystem.c @ 1046:1d7c7a36df15 GasConsumption
Bugfix OSTC5 BT and enabling fast mode:
The OSTC5 BT was operating at default speed of 115200. To enable the faster communication some init steps have been added to set speed to 460800. Having the UART enabled while the module was shut down caused problems during initialisation. To avoid these the BT UART is now initialized after the the module is powered on and deinitialized while the module is switched off.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 14 Nov 2025 18:54:20 +0100 |
| parents | 677d293c669f |
| children |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tMenuSystem.c | |
| 5 /// \brief Main Template file for Menu Page System settings | |
| 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 "tMenuSystem.h" | |
| 32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | |
| 851 | 33 #include "t7.h" |
| 38 | 34 |
| 379 | 35 static uint8_t customviewsSubpage = 0; |
| 36 | |
| 38 | 37 /* Private function prototypes -----------------------------------------------*/ |
| 38 char customview_TXT2BYTE_helper(uint8_t customViewId); | |
| 39 | |
| 379 | 40 void set_CustomsviewsSubpage(uint8_t page) |
| 41 { | |
| 42 customviewsSubpage = page; | |
| 43 } | |
| 44 | |
| 38 | 45 /* Exported functions --------------------------------------------------------*/ |
| 46 | |
| 47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
| 48 { | |
| 49 SSettings *data; | |
| 379 | 50 int i; |
| 38 | 51 uint8_t textPointer; |
| 52 uint8_t RTEhigh, RTElow; | |
| 53 RTC_DateTypeDef Sdate; | |
| 54 RTC_TimeTypeDef Stime; | |
| 55 const SDiveState * pStateReal = stateRealGetPointer(); | |
| 56 | |
| 57 data = settingsGetPointer(); | |
| 58 textPointer = 0; | |
| 59 *tab = 300; | |
| 60 *subtext = 0; | |
| 1038 | 61 char tmpString[20]; |
| 38 | 62 |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
63 resetLineMask(StMSYS); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
64 |
| 38 | 65 // dive mode |
| 66 if(actual_menu_content != MENU_SURFACE) | |
| 67 { | |
| 68 uint8_t id; | |
| 69 | |
| 379 | 70 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ |
| 38 | 71 { |
| 379 | 72 id = cv_changelist[customviewsSubpage * 5 + i]; |
| 73 if(id == CVIEW_END) /* last list item? */ | |
| 74 { | |
| 75 break; | |
| 76 } | |
| 77 else | |
| 78 { | |
| 79 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); | |
| 80 text[textPointer++] = ' '; | |
| 81 textPointer += snprintf(&text[textPointer], 60, | |
| 82 "%c%c\n\r", | |
| 83 TXT_2BYTE, customview_TXT2BYTE_helper(id)); | |
| 84 } | |
| 38 | 85 } |
| 86 | |
| 379 | 87 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ |
| 88 { | |
| 89 text[textPointer++]='\n'; | |
| 90 text[textPointer++]='\r'; | |
| 91 text[textPointer] = 0; | |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
92 switch(i) |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
93 { |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
94 case 0: disableLine(StMSYS_Custom0); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
95 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
96 case 1: disableLine(StMSYS_Custom1); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
97 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
98 case 2: disableLine(StMSYS_Custom2); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
99 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
100 case 3: disableLine(StMSYS_Custom3); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
101 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
102 case 4: disableLine(StMSYS_Custom4); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
103 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
104 default: |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
105 case 5: disableLine(StMSYS_Custom5); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
106 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
107 } |
| 379 | 108 } |
| 109 | |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
110 text[textPointer++] = TXT_2BYTE; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
111 text[textPointer++] = TXT2BYTE_ButtonNext; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
112 text[textPointer] = 0; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
113 |
| 38 | 114 return StMSYS; |
| 115 } | |
| 116 | |
| 117 // surface mode | |
|
139
decb0461302a
Get version from local memory instead from incoming data
Ideenmodellierer
parents:
138
diff
changeset
|
118 getActualRTEandFONTversion(&RTEhigh,&RTElow,NULL,NULL); |
| 38 | 119 |
| 120 if((RTEhigh == 0xFF) || (RTElow == 0xFF)) | |
| 121 { | |
| 122 RTEhigh = 0; | |
| 123 RTElow = 0; | |
| 124 } | |
| 125 | |
| 126 if((line == 0) || (line == 1)) | |
| 127 { | |
| 128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
| 129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
| 130 | |
| 944 | 131 text[textPointer++] = TXT_Date; |
| 132 getStringOfFormat_DDMMYY(tmpString,15); | |
| 133 textPointer += snprintf(&text[textPointer], 40,"\016\016 %s ",tmpString); | |
| 1038 | 134 convertStringOfDate_DDMMYY(tmpString,15,Sdate.Date, Sdate.Month, Sdate.Year); |
| 944 | 135 textPointer += snprintf(&text[textPointer], 40,"\017\t%s ",tmpString); |
| 1038 | 136 formatStringOfTime(tmpString,20,Stime,0,1); |
| 137 textPointer += snprintf(&text[textPointer], 60,"%s\n\r",tmpString); | |
| 38 | 138 } |
| 139 else | |
| 140 { | |
| 141 strcpy(&text[textPointer],"\n\r"); | |
| 142 textPointer += 2; | |
| 143 } | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
144 #ifdef ENABLE_SETTING_PROFILES |
| 1027 | 145 if((line == 0) || (line == 2)) |
| 146 { | |
| 147 textPointer += snprintf(&text[textPointer], 40,"%c%c:\t%s\n\r",TXT_2BYTE,TXT2BYTE_Profile,data->profileName[data->activeProfile]); | |
| 148 } | |
| 149 else | |
| 150 { | |
| 151 strcpy(&text[textPointer],"\n\r"); | |
| 152 textPointer += 2; | |
| 153 } | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
154 #endif |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
155 #ifdef ENABLE_SETTING_PROFILES |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
156 if((line == 0) || (line == 3)) |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
157 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
158 if((line == 0) || (line == 2)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
159 #endif |
| 38 | 160 { |
| 161 text[textPointer++] = TXT_Language; | |
| 162 text[textPointer++] = '\t'; | |
| 163 text[textPointer++] = TXT_LanguageName; | |
| 164 text[textPointer++] = '\n'; | |
| 165 text[textPointer++] = '\r'; | |
| 166 text[textPointer] = 0; | |
| 167 } | |
| 168 else | |
| 169 { | |
| 170 strcpy(&text[textPointer],"\n\r"); | |
| 171 textPointer += 2; | |
| 172 } | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
173 #ifdef ENABLE_SETTING_PROFILES |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
174 if((line == 0) || (line == 4)) |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
175 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
176 if((line == 0) || (line == 3)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
177 #endif |
| 38 | 178 { |
| 179 text[textPointer++] = TXT_2BYTE; | |
| 180 text[textPointer++] = TXT2BYTE_Layout; | |
| 181 text[textPointer++] = '\t'; | |
| 182 | |
| 183 if(!data->showDebugInfo) | |
| 184 { | |
| 185 text[textPointer++] = TXT_2BYTE; | |
| 186 if(data->nonMetricalSystem == 0) | |
| 187 text[textPointer++] = TXT2BYTE_Units_metric; | |
| 188 else | |
| 189 text[textPointer++] = TXT2BYTE_Units_feet; | |
| 190 | |
| 191 if(data->tX_colorscheme != 0) | |
| 192 { | |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
193 text[textPointer++] = ' '; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
194 text[textPointer++] = '/'; |
| 38 | 195 text[textPointer++] = '\027'; |
| 196 text[textPointer++] = ' '; | |
| 197 text[textPointer++] = '0' + data->tX_colorscheme; | |
| 198 text[textPointer++] = '\020'; | |
| 199 } | |
| 200 } | |
| 201 else | |
| 202 { | |
| 203 if(data->nonMetricalSystem == 0) | |
| 204 { | |
| 205 text[textPointer++] = 'm'; | |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
206 text[textPointer++] = ' '; |
| 38 | 207 text[textPointer++] = '/'; |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
208 text[textPointer++] = ' '; |
| 38 | 209 text[textPointer++] = 'C'; |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
210 text[textPointer++] = ' '; |
| 38 | 211 } |
| 212 else | |
| 213 { | |
| 214 text[textPointer++] = 'f'; | |
| 215 text[textPointer++] = 't'; | |
| 216 text[textPointer++] = ' '; | |
| 217 text[textPointer++] = '/'; | |
| 218 text[textPointer++] = ' '; | |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
219 text[textPointer++] = 'F'; |
| 38 | 220 text[textPointer++] = ' '; |
|
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
221 } |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
222 if(data->tX_colorscheme != 0) |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
223 { |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
224 text[textPointer++] = '/'; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
225 text[textPointer++] = '\027'; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
226 text[textPointer++] = ' '; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
227 text[textPointer++] = '0' + data->tX_colorscheme; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
228 text[textPointer++] = ' '; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
229 text[textPointer++] = '\020'; |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
230 } |
|
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
231 text[textPointer++] = '/'; |
| 38 | 232 text[textPointer++] = ' '; |
| 233 text[textPointer++] = 'd'; | |
| 234 text[textPointer++] = 'e'; | |
| 235 text[textPointer++] = 'b'; | |
| 236 text[textPointer++] = 'u'; | |
| 237 text[textPointer++] = 'g'; | |
| 238 } | |
| 239 | |
| 240 text[textPointer++] = '\n'; | |
| 241 text[textPointer++] = '\r'; | |
| 242 text[textPointer] = 0; | |
| 243 } | |
| 244 else | |
| 245 { | |
| 246 strcpy(&text[textPointer],"\n\r"); | |
| 247 textPointer += 2; | |
| 248 } | |
| 249 | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
250 #ifdef ENABLE_SETTING_PROFILES |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
251 if((line == 0) || (line == 5)) |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
252 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
253 if((line == 0) || (line == 4)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
254 #endif |
| 38 | 255 { |
| 256 text[textPointer++] = TXT_Information; | |
| 257 text[textPointer++] = '\t'; | |
| 258 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i" | |
| 259 ,RTEhigh | |
| 260 ,RTElow | |
| 261 ,firmwareDataGetPointer()->versionFirst | |
| 262 ,firmwareDataGetPointer()->versionSecond | |
| 263 ,firmwareDataGetPointer()->versionThird | |
| 264 ); | |
| 265 } | |
| 266 strcpy(&text[textPointer],"\n\r"); | |
| 267 textPointer += 2; | |
| 268 | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
269 #ifdef ENABLE_SETTING_PROFILES |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
270 if((line == 0) || (line == 6)) |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
271 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
272 if((line == 0) || (line == 5)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1027
diff
changeset
|
273 #endif |
| 38 | 274 { |
| 275 text[textPointer++] = TXT_2BYTE; | |
| 276 text[textPointer++] = TXT2BYTE_ResetMenu; | |
| 277 text[textPointer] = 0; | |
| 278 } | |
| 279 strcpy(&text[textPointer],"\n\r"); | |
| 280 textPointer += 2; | |
| 281 | |
| 282 return StMSYS; | |
| 283 } | |
| 284 | |
| 285 | |
| 286 /* Private functions ---------------------------------------------------------*/ |
