annotate Discovery/Src/demo.c @ 250:822416168585 bm-2

Buelmann: new implementation for ceiling Since my first functional fix in the ceiling computation in commit ceecabfddb57, I noticed that the computation used a linear search, that became rather computational expensive after that commit. The simple question is: why not a binary search? So, this commit implements the binary search. But there is a long story attached to this. Comparing ceiling results from hwOS and this OSTC4 code were very different. Basically, the original OSTC4 algorithm computed the ceiling using the same GFlow to GFhigh slope, in such a way, that the ceiling was in sync with the presented deco stops, where the hwOS code presents a GFhigh based ceiling. This said, it is more logical when the OSTC4 and hwOS code give similar results. This new recursive algorithm gives very similar results for the ceiling compared to hwOS. To be complete here, the Buelmann ceiling is the depth to which you can ascend, so that the leading tissue reaches GFhigh. This also explains why the deepest deco stop is normally deeper than the ceiling (unless one dives with GF like 80/80). The code implemented here is rather straightforward recursion. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Thu, 11 Apr 2019 17:48:48 +0200
parents 5f11787b4f42
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"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #ifndef DEMOMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 uint8_t demoGetCommand(void) { return 0; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 uint8_t demoModeActive(void) { return 0; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 void demoSendCommand(uint8_t action) { return; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /* Private variables with external access ------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 uint8_t demoModeActiveStatus = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 uint32_t systickDemoMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint16_t demoModeActual = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 #define BUTTON_BACK (BUTTON_BACK_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 #define BUTTON_NEXT (BUTTON_NEXT_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 #define BUTTON_ENTER (BUTTON_ENTER_PIN | 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 /* Private typedef -----------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 #define MAXCOMMANDS 200
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 #ifdef SHOWCCRMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 const uint8_t commandlist[MAXCOMMANDS][3] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /* Button, deci-seconds to wait */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 // start for both
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 {0, 40},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 // start OC, activate CC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 {BUTTON_ENTER, 0}, // Change to CC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {BUTTON_ENTER, 0}, // Leave Edit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 {BUTTON_BACK, 0}, // Cursor
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 {BUTTON_NEXT, 0},
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_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 {0, 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 // start CC @ 20, set cursor to Sim Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 {BUTTON_NEXT, 0},
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_BACK, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 // re-loop @ 30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 {0, 3},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 {0, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 // menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 {BUTTON_NEXT, 0},
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_ENTER, 30},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 {BUTTON_ENTER, 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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 // the end, repeat from start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 {255, 0}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 #else // OC Mode Demo
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 const uint8_t commandlist[MAXCOMMANDS][2] =
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 /* Button, seconds to wait */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 // start for both
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 {0, 50}, // wait IS IMPORTANT
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 // start CC, activate OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 {BUTTON_NEXT, 0},
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_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 {BUTTON_ENTER, 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_BACK, 0}, // Leave Cursor Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 {BUTTON_NEXT, 0},
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}, // OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 {0, 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 // start OC @ line 20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 {BUTTON_NEXT, 0},
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}, // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 {BUTTON_BACK, 0}, // Exit Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 {0, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 // re-loop @ 30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 {BUTTON_BACK, 4},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 {BUTTON_NEXT, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 {BUTTON_BACK, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 {BUTTON_BACK, 0}, // Exit Logbook Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 // menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 // activate Configure Deco Gas
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 {BUTTON_NEXT, 0}, // Start Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 {BUTTON_NEXT, 2}, // SIM -> OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 // Mix 30 -> 90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 {BUTTON_NEXT, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 {BUTTON_NEXT, 0},
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_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 // Mix 90 -> 99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 // First -> Deco
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 {BUTTON_ENTER, 2},
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_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 {BUTTON_BACK, 30},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 {BUTTON_NEXT, 2},
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, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 // SYS2 Layout
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 {BUTTON_NEXT, 2},
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_ENTER, 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_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 {BUTTON_ENTER, 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_BACK, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 {BUTTON_BACK, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 // SYS2 -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 {BUTTON_ENTER, 40}, // Start Simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 {BUTTON_ENTER, 10},
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, 90},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 {BUTTON_NEXT, 5}, // Quit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 {BUTTON_NEXT, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 {BUTTON_ENTER, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 // Logbook
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 {BUTTON_BACK, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 {BUTTON_ENTER, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 {BUTTON_NEXT, 20},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 {BUTTON_BACK, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 {BUTTON_BACK, 0}, // Exit Logbook Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 // surface screen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 {0, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 // activate Configure Deco Gas, go to Gas 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 {BUTTON_NEXT, 0}, // Start Menu
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 {BUTTON_NEXT, 2}, // SIM -> OC
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 {BUTTON_NEXT, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 {BUTTON_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 // Mix Decogas 99 -> EAN30 First
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 {BUTTON_BACK, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 {BUTTON_BACK, 0},
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_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 {BUTTON_NEXT, 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_ENTER, 0},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 {BUTTON_ENTER, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 {BUTTON_ENTER, 10}, // Now EAN 30 First
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 {BUTTON_BACK, 0}, // Exit Edit Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 {BUTTON_BACK, 30}, // Exit Cursor Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 // OC -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 {BUTTON_NEXT, 2},
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, 1},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 // SYS2 Layout
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 {BUTTON_NEXT, 2},
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_ENTER, 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_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 {BUTTON_ENTER, 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_BACK, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 {BUTTON_BACK, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 // SYS -> SIM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 {BUTTON_NEXT, 2},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 // simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 {BUTTON_ENTER, 40}, // Start Simulator
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 {BUTTON_ENTER, 5},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 {BUTTON_ENTER, 10},
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, 90},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 {BUTTON_NEXT, 5}, // Menu?
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 {BUTTON_NEXT, 5}, // Quit?
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 {BUTTON_ENTER, 10},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 {BUTTON_ENTER, 50},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 // the end, repeat from start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 {255, 0}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 uint8_t demoModeActive(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 return demoModeActiveStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 uint8_t demoGetCommand(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 if(!demoModeActiveStatus)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 uint32_t milliSecondsSinceLast;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 uint32_t systick_now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 systick_now = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 milliSecondsSinceLast = time_elapsed_ms(systickDemoMode, systick_now);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 #ifdef SHOWCCRMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 if((demoModeActual == 1) && (settingsGetPointer()->dive_mode == DIVEMODE_CCR))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 demoModeActual = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 if((demoModeActual == 1) && (settingsGetPointer()->dive_mode == DIVEMODE_OC))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 demoModeActual = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 if(demoModeActual > MAXCOMMANDS - 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 demoModeActual = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 uint32_t actualDelay = ((commandlist[demoModeActual][1]) * 100) + 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 if(milliSecondsSinceLast < actualDelay)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 systickDemoMode = systick_now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 if(commandlist[demoModeActual][0] == 255)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 demoModeActual = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 demoModeActual++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 return commandlist[demoModeActual][0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 void demoSendCommand(uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 demoModeActiveStatus = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 void demoConfigureSettings(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 settingsGetPointer()->gas[1].oxygen_percentage = 21;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 settingsGetPointer()->gas[1].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 settingsGetPointer()->gas[1].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 settingsGetPointer()->gas[1].note.ub.first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 settingsGetPointer()->gas[1].note.ub.active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 settingsGetPointer()->gas[1].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 settingsGetPointer()->gas[1].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 settingsGetPointer()->gas[2].oxygen_percentage = 30;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 settingsGetPointer()->gas[2].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 settingsGetPointer()->gas[2].depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 settingsGetPointer()->gas[2].note.ub.first = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 settingsGetPointer()->gas[2].note.ub.active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 settingsGetPointer()->gas[2].note.ub.deco = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 settingsGetPointer()->gas[2].note.ub.travel = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 settingsGetPointer()->ButtonResponsiveness[0] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 settingsGetPointer()->ButtonResponsiveness[1] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 settingsGetPointer()->ButtonResponsiveness[2] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 settingsGetPointer()->ButtonResponsiveness[3] = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 /* Private variables with external access ------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 #endif // DEMO
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/