annotate Discovery/Src/demo.c @ 1045:b018e1f3082e GasConsumption

Deactivate OSTC5 BT init sequence: At the moment the OSTC BT is preconfigurated and starting in data mode => skip BT config in case a OSTC5 HW is detected
author Ideenmodellierer
date Mon, 03 Nov 2025 21:17:14 +0100
parents 5865f0aeb438
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @copyright heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @file demo.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-Nov-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @version 0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * @since 26-Nov-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @brief f�r die Messe und die Vitrine
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @bug
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * @warning
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 #include "demo.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #include "base.h" // for BUTTON_BACK, ...
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #include "data_exchange_main.h" // for time_elapsed_ms()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #include "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "ostc.h"
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
31 #include "tInfoLogger.h"
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
32 #include <string.h>
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #ifndef DEMOMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 uint8_t demoGetCommand(void) { return 0; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 uint8_t demoModeActive(void) { return 0; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 void demoSendCommand(uint8_t action) { return; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /* Private variables with external access ------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 uint8_t demoModeActiveStatus = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint32_t systickDemoMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint16_t demoModeActual = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 #define BUTTON_BACK (BUTTON_BACK_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 #define BUTTON_NEXT (BUTTON_NEXT_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 #define BUTTON_ENTER (BUTTON_ENTER_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 /* Private typedef -----------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 #define MAXCOMMANDS 200
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 #ifdef SHOWCCRMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 const uint8_t commandlist[MAXCOMMANDS][3] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 /* Button, deci-seconds to wait */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 // start for both
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {0, 40},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 // start OC, activate CC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 {BUTTON_ENTER, 0}, // Change to CC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 {BUTTON_ENTER, 0}, // Leave Edit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 {BUTTON_BACK, 0}, // Cursor
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 // start CC @ 20, set cursor to Sim Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 {BUTTON_BACK, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 // re-loop @ 30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {0, 3},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 {0, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 // menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 {BUTTON_ENTER, 30},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 // the end, repeat from start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 {255, 0}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 #else // OC Mode Demo
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 const uint8_t commandlist[MAXCOMMANDS][2] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 /* Button, seconds to wait */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 // start for both
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {0, 50}, // wait IS IMPORTANT
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 // start CC, activate OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 {BUTTON_BACK, 0}, // Leave Cursor Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 {BUTTON_NEXT, 0}, // OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 // start OC @ line 20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 {BUTTON_NEXT, 0}, // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 {BUTTON_BACK, 0}, // Exit Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 // re-loop @ 30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 {BUTTON_BACK, 4},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 {BUTTON_NEXT, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 {BUTTON_BACK, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 {BUTTON_BACK, 0}, // Exit Logbook Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 // menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 // activate Configure Deco Gas
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 {BUTTON_NEXT, 0}, // Start Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 {BUTTON_NEXT, 2}, // SIM -> OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 // Mix 30 -> 90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 // Mix 90 -> 99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 // First -> Deco
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 {BUTTON_BACK, 30},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 // SYS2 Layout
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 {BUTTON_BACK, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 {BUTTON_BACK, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 // SYS2 -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 {BUTTON_ENTER, 40}, // Start Simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 {BUTTON_ENTER, 90},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 {BUTTON_NEXT, 5}, // Quit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 {BUTTON_NEXT, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 {BUTTON_ENTER, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 {BUTTON_BACK, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 {BUTTON_BACK, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 {BUTTON_BACK, 0}, // Exit Logbook Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 // activate Configure Deco Gas, go to Gas 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 {BUTTON_NEXT, 0}, // Start Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 {BUTTON_NEXT, 2}, // SIM -> OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 // Mix Decogas 99 -> EAN30 First
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 {BUTTON_ENTER, 10}, // Now EAN 30 First
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 {BUTTON_BACK, 0}, // Exit Edit Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 {BUTTON_BACK, 30}, // Exit Cursor Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 // SYS2 Layout
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 {BUTTON_BACK, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 {BUTTON_BACK, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 // SYS -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 {BUTTON_ENTER, 40}, // Start Simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 {BUTTON_ENTER, 90},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 {BUTTON_NEXT, 5}, // Menu?
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 {BUTTON_NEXT, 5}, // Quit?
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 {BUTTON_ENTER, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 // the end, repeat from start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 {255, 0}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 uint8_t demoModeActive(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 return demoModeActiveStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 uint8_t demoGetCommand(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 if(!demoModeActiveStatus)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 uint32_t milliSecondsSinceLast;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 uint32_t systick_now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 systick_now = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 milliSecondsSinceLast = time_elapsed_ms(systickDemoMode, systick_now);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 #ifdef SHOWCCRMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 if((demoModeActual == 1) && (settingsGetPointer()->dive_mode == DIVEMODE_CCR))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 demoModeActual = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 if((demoModeActual == 1) && (settingsGetPointer()->dive_mode == DIVEMODE_OC))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 demoModeActual = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 if(demoModeActual > MAXCOMMANDS - 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 demoModeActual = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 uint32_t actualDelay = ((commandlist[demoModeActual][1]) * 100) + 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 if(milliSecondsSinceLast < actualDelay)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 systickDemoMode = systick_now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 if(commandlist[demoModeActual][0] == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 demoModeActual = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 demoModeActual++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 return commandlist[demoModeActual][0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 void demoSendCommand(uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 demoModeActiveStatus = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 void demoConfigureSettings(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 settingsGetPointer()->gas[1].oxygen_percentage = 21;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 settingsGetPointer()->gas[1].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 settingsGetPointer()->gas[1].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 settingsGetPointer()->gas[1].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 settingsGetPointer()->gas[1].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 settingsGetPointer()->gas[1].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 settingsGetPointer()->gas[1].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 settingsGetPointer()->gas[2].oxygen_percentage = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 settingsGetPointer()->gas[2].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 settingsGetPointer()->gas[2].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 settingsGetPointer()->gas[2].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 settingsGetPointer()->gas[2].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 settingsGetPointer()->gas[2].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 settingsGetPointer()->gas[2].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 settingsGetPointer()->ButtonResponsiveness[0] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 settingsGetPointer()->ButtonResponsiveness[1] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 settingsGetPointer()->ButtonResponsiveness[2] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 settingsGetPointer()->ButtonResponsiveness[3] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 /* Private variables with external access ------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 #endif // DEMO
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
430 #ifdef ENABLE_USART_RADIO /* debug function to check receiption of radio data */
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
431 void demo_HandleData(void)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
432 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
433 static uint8_t comStarted = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
434 static uint8_t text[50];
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
435 static uint8_t index = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
436 static uint32_t startTick = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
437 static uint8_t firstData = 1;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
438 uint8_t data = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
439
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
440 switch(comStarted)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
441 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
442 case 0: startTick = HAL_GetTick();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
443 comStarted++;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
444 break;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
445 case 1: if(time_elapsed_ms(startTick, HAL_GetTick()) > 5000)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
446 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
447 MX_UART_RADIO_Init_DMA();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
448 UART_StartDMARxRadio();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
449 comStarted++;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
450 sprintf((char*)text,"RadioStarted");
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
451 InfoLogger_writeLine(text,strlen((char*)text),1);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
452 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
453 break;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
454 case 2: data = UART_getChar();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
455 if(data != 0)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
456 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
457 if(firstData)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
458 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
459 firstData = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
460 sprintf((char*)text,"FirstData");
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
461 InfoLogger_writeLine(text,strlen((char*)text),1);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
462 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
463 if((index == 50) || (data =='r') || (data =='n'))
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
464 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
465 if(index > 0)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
466 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
467 InfoLogger_writeLine(text,index,0);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
468 index = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
469 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
470 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
471 else
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
472 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
473 text[index++] = data;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
474 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
475 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
476 break;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
477 default:
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
478 break;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
479 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
480
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
481
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
482 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
483 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
484 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
485 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 38
diff changeset
486
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/