Mercurial > public > ostc4
annotate Discovery/Src/tMenuPlanner.c @ 804:391b3d420a39
Cleanup initialisation code:
Some variables were not initialised during awake transition and the mapping of to the legacy adc slots were done at several location. This has been cleaned up not.
Do not run UART during ADC sensor detection:
A operation UART sensor caused the false detection of a not connected ADC sensor. To avoid this the UART is now deactivated during ADC detection phase.
author | Ideenmodellierer |
---|---|
date | Thu, 10 Aug 2023 21:35:34 +0200 |
parents | 52df13712fa3 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuPlanner.c | |
5 /// \brief Deco Planner and Simulator | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 19-Dec-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 <stdio.h> | |
31 #include <string.h> | |
32 #include "tMenu.h" | |
33 #include "tStructure.h" | |
34 #include "tMenuPlanner.h" | |
35 #include "text_multilanguage.h" | |
36 #include "settings.h" | |
37 #include "unit.h" | |
38 | |
39 #define STD_depth (50) | |
40 #define STD_intervall (0) | |
41 #define STD_divetime (20) | |
42 | |
43 uint16_t tMplan_depth_meter = STD_depth, tMplan_intervall_time_minutes = STD_intervall, tMplan_dive_time_minutes = STD_divetime; | |
567 | 44 uint16_t tMplan_depth_editor; |
38 | 45 |
46 /* Exported functions --------------------------------------------------------*/ | |
47 | |
48 uint32_t tMPlanner_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
49 { | |
50 uint8_t textPointer; | |
51 | |
52 textPointer = 0; | |
53 *tab = 400;//550; | |
54 *subtext = 0; | |
55 | |
56 uint8_t tMplan_gasConsumTravel = settingsGetPointer()->gasConsumption_travel_l_min; | |
57 uint8_t tMplan_gasConsumDeco = settingsGetPointer()->gasConsumption_deco_l_min; | |
58 | |
59 // SSettings *data = settingsGetPointer(); | |
60 | |
61 /* | |
62 if(line == 0) | |
63 strcpy(subtext, | |
64 "\005" | |
65 "a b c d e f g h i k l" | |
66 "\n\r" | |
67 "m n o p q r s t u v w" | |
68 "\n\r" | |
69 "x y z A B" | |
70 "\006" | |
71 ); | |
72 */ | |
73 if(line == 0) | |
74 { | |
75 tMplan_depth_meter = STD_depth; | |
76 tMplan_intervall_time_minutes = STD_intervall; | |
77 tMplan_dive_time_minutes = STD_divetime; | |
78 } | |
79 | |
80 if((line == 0) || (line == 1)) | |
81 { | |
82 text[textPointer++] = TXT_2BYTE; | |
83 text[textPointer++] = TXT2BYTE_StartSimulator; | |
84 } | |
85 strcpy(&text[textPointer],"\n\r"); | |
86 textPointer += 2; | |
87 if((line == 0) || (line == 2)) | |
88 { | |
89 text[textPointer++] = TXT_2BYTE; | |
90 text[textPointer++] = TXT2BYTE_Intervall; | |
91 text[textPointer++] = '\t'; | |
567 | 92 textPointer += snprintf(&text[textPointer],30,"%u \016\016min\017",tMplan_intervall_time_minutes); |
38 | 93 } |
94 strcpy(&text[textPointer],"\n\r"); | |
95 textPointer += 2; | |
96 if((line == 0) || (line == 3)) | |
97 { | |
98 text[textPointer++] = TXT_2BYTE; | |
99 text[textPointer++] = TXT2BYTE_SimDiveTime; | |
100 text[textPointer++] = '\t'; | |
567 | 101 textPointer += snprintf(&text[textPointer],30,"%u \016\016min\017",tMplan_dive_time_minutes); |
38 | 102 } |
103 strcpy(&text[textPointer],"\n\r"); | |
104 textPointer += 2; | |
105 if((line == 0) || (line == 4)) | |
106 { | |
107 text[textPointer++] = TXT_2BYTE; | |
108 text[textPointer++] = TXT2BYTE_SimMaxDepth; | |
109 text[textPointer++] = '\t'; | |
110 textPointer += snprintf(&text[textPointer],30,"%u\016\016 %c%c\017", | |
111 unit_depth_integer(tMplan_depth_meter), | |
112 unit_depth_char1(), | |
113 unit_depth_char2() | |
114 ); | |
115 } | |
116 strcpy(&text[textPointer],"\n\r"); | |
117 textPointer += 2; | |
118 if((line == 0) || (line == 5)) | |
119 { | |
120 text[textPointer++] = TXT_2BYTE; | |
121 text[textPointer++] = TXT2BYTE_CalculateDeco; | |
122 } | |
123 strcpy(&text[textPointer],"\n\r"); | |
124 textPointer += 2; | |
125 | |
126 if((line == 0) || (line == 6)) | |
127 { | |
128 text[textPointer++] = TXT_2BYTE; | |
129 text[textPointer++] = TXT2BYTE_SimConsumption; | |
130 text[textPointer++] = '\t'; | |
131 textPointer += snprintf(&text[textPointer],30, | |
132 "%u" | |
679
52df13712fa3
cleanup: Use correct "per" symbol
Jan Mulder <jan@jlmulder.nl>
parents:
567
diff
changeset
|
133 "\016\016 l/min\017", |
38 | 134 tMplan_gasConsumTravel); |
135 text[textPointer++] = ' '; | |
136 text[textPointer++] = ' '; | |
137 textPointer += snprintf(&text[textPointer],30, | |
138 "\016\016deco\017" | |
139 " %u" | |
679
52df13712fa3
cleanup: Use correct "per" symbol
Jan Mulder <jan@jlmulder.nl>
parents:
567
diff
changeset
|
140 "\016\016 l/min\017", |
38 | 141 tMplan_gasConsumDeco); |
142 } | |
143 strcpy(&text[textPointer],"\n\r"); | |
144 textPointer += 2; | |
145 | |
146 return StMPLAN; | |
147 } | |
148 |