annotate Common/Inc/settings.h @ 322:31e471d60797 O2_SensorSync

Added start of frame detection for HUD data In the previous impmenentation the reception and evaluation of 15 byte were used without start detection. As a result sensor data could be stuck in case the frame sequence does not match the structure (e.g. cause by an framing error). To resolve this in case of an invalid checksumme in combination with a data lost detection a byte based reception is startet to detect the start of a frame using the break between two transmissions. In addition a babbling idiot protecting has been added because a faulty hardware could have an impact on the OSTC operation (high interrupt load)
author ideenmodellierer
date Sun, 30 Jun 2019 21:25:58 +0200
parents b2a9e9b02df0
children 38367bb982b8 50ea68c7a153
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 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Common/Inc/settings.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Heinrichs Weikamp
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 2018
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #ifndef SETTINGS_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #define SETTINGS_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 // From Common/Inc:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "FirmwareData.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 //#include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
92
be35821a4974 Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
35 #include "global_constants.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 // From Common/Drivers/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include <stdint.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
92
be35821a4974 Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
41
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #define NUM_GASES 5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #define NUM_OFFSET_DILUENT 5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #define SPECIAL_GAS_ID 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 #define ERROR_ 0xFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 #define CCRMODE_FixedSetpoint 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 #define CCRMODE_Sensors 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 #define DIVEMODE_OC 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 #define DIVEMODE_CCR 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 #define DIVEMODE_Gauge 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 #define DIVEMODE_Apnea 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 #define GF_MODE 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 #define VPM_MODE 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 #define VPM_FROM_FORTRAN 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 #define VPM_BACHELORWORK 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 #define BUEHLMANN_OSTC4 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 #define BUEHLMANN_hwOS 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 #define MMDDYY 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 #define DDMMYY 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 #define YYMMDD 2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 /* 2015 Jan 30, hw, deco and travel added for MenuEditGas
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 * can be used for buehlmann, vpm, etc. later but be carefull
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 * with current implemenation */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 uint8_t active:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 uint8_t first:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 uint8_t deco:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint8_t travel:1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 uint8_t senderCode:4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 } gasubit8_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 gasubit8_t ub;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 uint8_t uw;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 } gasbit8_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 uint8_t standard:4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 uint8_t alternative:4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 } ubit2x4_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 ubit2x4_t ub;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 uint8_t uw;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 } split2x4_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 uint8_t u8[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 uint32_t u32;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 } general32to8_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 uint8_t oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 uint8_t helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 gasbit8_Type note;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 uint8_t depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 uint8_t depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 uint8_t bottle_size_liter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 // uint8_t bottle_wireless_status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 uint16_t bottle_wireless_id;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 } SGasLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 uint8_t setpoint_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 uint8_t depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 gasbit8_Type note;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 } SSetpointLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /* SSettings
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 * gas[0] and setpoint[0] are the special ones configurable during the dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 uint32_t header;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 uint8_t warning_blink_dsec;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 uint8_t lastDiveLogId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 uint32_t logFlashNextSampleStartAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 SGasLine gas[1 + (2*NUM_GASES)];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 SSetpointLine setpoint[1 + NUM_GASES];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 uint8_t CCR_Mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 uint8_t dive_mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 split2x4_Type deco_type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 uint8_t ppO2_max_deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 uint8_t ppO2_max_std;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 uint8_t ppO2_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 uint8_t CNS_max;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 uint8_t ascent_MeterPerMinute_max;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 uint8_t ascent_MeterPerMinute_showGraph;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 uint8_t future_TTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 uint8_t GF_high;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 uint8_t GF_low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 uint8_t aGF_high;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 uint8_t aGF_low;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 split2x4_Type VPM_conservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 uint8_t safetystopDuration;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 uint8_t AtemMinutenVolumenLiter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 uint8_t ReserveFractionDenominator;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 uint8_t salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 uint8_t last_stop_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 uint8_t stop_increment_depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 uint8_t brightness;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 uint8_t date_format;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 uint8_t selected_language;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 char customtext[60];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 uint16_t timeoutSurfacemode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 uint8_t timeoutMenuSurface;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 uint8_t timeoutMenuDive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 uint8_t timeoutMenuEdit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 uint8_t timeoutInfo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 uint8_t timeoutInfoCompass;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 uint8_t design;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 uint16_t timeoutDiveReachedZeroDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 uint16_t divetimeToCreateLogbook;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 uint8_t serialHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 uint8_t serialLow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 // SUFirmware firmwareVersion16to32bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 uint32_t backup_localtime_rtc_tr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 uint32_t backup_localtime_rtc_dr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 uint16_t totalDiveCounter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 uint16_t personalDiveCount;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 uint8_t showDebugInfo;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 uint8_t ButtonResponsiveness[4];// changed content in 0xFFFF0016
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 uint8_t nonMetricalSystem;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 uint8_t fallbackToFixedSetpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 uint8_t bluetoothActive; /* will be set to zero on each startup at the moment */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 uint8_t safetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 uint32_t updateSettingsAllowedFromHeader;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 uint8_t scooterControl;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 uint8_t scooterDrag;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 uint8_t scooterLoad;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 uint8_t scooterNumberOfBatteries;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 uint16_t scooterBattSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 uint8_t scooterSPARE1[7];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 uint8_t scooterSPARE2[19];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 // new in 0xFFFF0006
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 uint8_t ppo2sensors_deactivated;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 uint8_t tX_colorscheme;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 uint8_t tX_userselectedLeftLowerCornerPrimary;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 uint8_t tX_userselectedLeftLowerCornerTimeout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 uint8_t tX_customViewPrimary;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 uint8_t tX_customViewTimeout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 uint8_t timeoutEnterButtonSelectDive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 uint16_t logbookOffset;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 uint8_t alwaysShowPPO2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 uint8_t extraDisplay;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 uint16_t display_toogle_desc;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 int8_t offsetPressure_mbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 int8_t offsetTemperature_centigrad;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 uint8_t gasConsumption_travel_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 uint8_t gasConsumption_bottom_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 uint8_t gasConsumption_deco_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 uint8_t debugModeOnStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 uint8_t IAmStolenPleaseKillMe;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 int16_t compassBearing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 uint8_t lastKnownBatteryPercentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 uint8_t buttonBalance[3]; // 0 = right, 1 = center, 2 = left
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 uint8_t firmwareVersion[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 uint16_t timeoutSurfacemodeWithSensors;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 // new in 0xFFFF0016
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 uint8_t VPM_model;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 uint8_t GF_model;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 // new in 0xFFFF0017
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 uint8_t FactoryButtonBase;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 uint8_t FactoryButtonBalance[3];
112
fdf0272e9213 Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents: 38
diff changeset
215 /* new in 0xFFFF0018 */
fdf0272e9213 Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents: 38
diff changeset
216 uint8_t FlipDisplay;
210
b2a9e9b02df0 New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents: 138
diff changeset
217 /* new in 0xFFFF0019 */
b2a9e9b02df0 New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents: 138
diff changeset
218 uint32_t cv_configuration;
112
fdf0272e9213 Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents: 38
diff changeset
219
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 } SSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 // 8 bytes
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 uint16_t primarySerial;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 uint8_t primaryLicence;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 uint8_t revision8bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 uint8_t production_year;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 uint8_t production_month;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 uint8_t production_day;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 uint8_t production_bluetooth_name_set;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 // 44 bytes
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 char production_info[44];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 // 8 bytes
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 uint16_t secondarySerial;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 uint8_t secondaryLicence;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 uint8_t secondaryReason8bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 uint8_t secondary_year;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 uint8_t secondary_month;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 uint8_t secondary_day;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 uint8_t secondary_bluetooth_name_set;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 // 4 bytes
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 char secondary_info[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 } SHardwareData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 uint8_t writeData(uint8_t *);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 uint8_t readData(uint8_t what,uint8_t *);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 uint8_t getPPO2Max(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 uint8_t getPPO2Min(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 uint8_t getDiveMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 uint8_t getCCRMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 uint8_t getDecoType(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 uint8_t getFutureTTS(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 SSettings* settingsGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 const SSettings* settingsGetPointerStandard(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 void set_settings_to_Standard(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 void mod_settings_for_first_start_with_empty_ext_flash(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 const SFirmwareData* firmwareDataGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 const SHardwareData* hardwareDataGetPointer(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 uint8_t firmwareVersion_16bit_high(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 uint8_t firmwareVersion_16bit_low(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 void hardwareBatchCode(uint8_t *high, uint8_t *low);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 uint8_t RTEminimum_required_high(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 uint8_t RTEminimum_required_low(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 uint8_t FONTminimum_required_high(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 uint8_t FONTminimum_required_low(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 void setActualRTEversion(uint8_t high, uint8_t low);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 void set_new_settings_missing_in_ext_flash(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 uint8_t check_and_correct_settings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 uint8_t newFirmwareVersionCheckViaSettings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 void set_settings_button_to_standard_with_individual_buttonBalance(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 uint8_t getLicence(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 void firmwareGetDate(RTC_DateTypeDef *SdateOutput);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 #endif // SETTINGS_H