annotate Discovery/Inc/tHome.h @ 664:667093daa937 Betatest

Stability improvment bluetooth startup: The previous implementation expected a default setup of the Bluetooth module. Deviations from the default expectation caused the init function to stop. The new implementation is able to fix wrong baud rate setting (reset baudrate to default 115200). In addition the function evaluating the answers of the module is not able to derive the status out of a data stream.
author Ideenmodellierer
date Tue, 21 Dec 2021 19:36:41 +0100
parents 280c11153080
children c00a80f26641
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 Discovery/Inc/tHome.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Control for Surface and Dive Templates
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 10-November-2014
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 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #ifndef THOME_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #define THOME_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include <stdio.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include <string.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "base.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "gfx.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "gfx_colors.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include "gfx_engine.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #include "text_multilanguage.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #include "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #include "data_exchange.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #include "check_warning.h"
493
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
45 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 extern const uint16_t BigFontSeperationLeftRight; // in t3.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 extern const uint16_t BigFontSeperationTopBottom; // in t3.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 #define MAX_AGE_DECOINFO_MS (120000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 enum EXTRADISPLAYS
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 EXTRADISPLAY_none = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 EXTRADISPLAY_BIGFONT,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 EXTRADISPLAY_DECOGAME,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 EXTRADISPLAY_END
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 enum CUSTOMVIEWS
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 CVIEW_noneOrDebug = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 CVIEW_sensors,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 CVIEW_Compass,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 CVIEW_Decolist,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 CVIEW_Tissues,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 CVIEW_Profile,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 CVIEW_EADTime,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 CVIEW_Gaslist,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 CVIEW_sensors_mV,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 CVIEW_Hello,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 CVIEW_CompassDebug,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 CVIEW_SummaryOfLeftCorner,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 CVIEW_END,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 CVIEW_T3_Decostop,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 CVIEW_T3_TTS,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 CVIEW_T3_MaxDepth,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 CVIEW_T3_ppO2andGas,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 CVIEW_T3_StopWatch,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 CVIEW_T3_GasList,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 CVIEW_T3_Temperature,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 CVIEW_T3_ApnoeSurfaceInfo,
493
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
83 CVIEW_T3_Navigation,
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
84 CVIEW_T3_DepthData,
542
6960df7ddb09 Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents: 505
diff changeset
85 CVIEW_T3_DecoTTS,
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 542
diff changeset
86 #ifdef ENABLE_T3_PROFILE_VIEW
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 542
diff changeset
87 CVIEW_T3_Profile,
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 542
diff changeset
88 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 CVIEW_T3_END
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 // for custom view switch on/off 161122 hw
379
0dbf550dc743 Added missing customerview selection
ideenmodellierer
parents: 361
diff changeset
93 extern const uint8_t cv_changelist[];
493
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
94 extern const uint8_t cv_changelist_BS[];
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
95
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 #define CHECK_BIT_THOME(var,pos) (((var)>>(pos)) & 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 uint16_t Hours;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 uint16_t Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 uint16_t Seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 uint32_t Total;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 } SDivetime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 uint8_t Days;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 uint8_t Hours;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 uint8_t Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 uint8_t Seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 uint32_t Total;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 } SSurfacetime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 extern _Bool warning_count_high_time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 extern _Bool display_count_high_time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 extern uint8_t errorsInSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 void tHome_init(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 void tHome_refresh(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 void tHome_sleepmode_fun(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 void set_globalState_tHome(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 void tHome_change_field_button_pressed(void);
361
b111fc4250e9 Pass action to customer vie update function.
Ideenmodellierer
parents: 289
diff changeset
128 void tHome_change_customview_button_pressed(uint8_t action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 void tHomeDiveMenuControl(uint8_t sendAction);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 void tHome_tick(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 void tHome_init_compass(void);
505
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
138 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 //void _findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 void t3_basics_colorscheme_mod(char *text);
505
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
147 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 #endif /* THOME_H */