Mercurial > public > ostc4
annotate Discovery/Inc/tHome.h @ 471:73da921869d9 fix-bat-2
bugfix: implement battery charge percentage in dive header
This commit is (much) less trivial than the related 919e5cb51c92.
First, rename the CCRmode attribute (corresponding to byte Ox59) of
the SLogbookHeaderOSTC3. This byte (according to the hwOS interface
document) does not contain any CCR related value, but it contains
"battery information". Already since 2017, this byte is used from
libdivecomputer to interface the charge percentage. So, its
renamed from CCRmode to batteryCharge, to reflect its true purpose.
Now, simply add a batteryCharge attribute to the SLogbookHeader
(and see below why that is possible, without breaking things).
The remaining changes are trivial to implement battery charge
percentage in dive header.
Caveat: do not get confused by the exact role of the individual
logbook header types. SLogbookHeaderOSTC3 is the formal type of
the logbook format that the OSTC4 produces. This format is
supposed to identical to the format, as is used in hwOS for the
series of small OSTCs. Only some values of attributes are different.
For example, the OSTC4 supports VPM, so byte 0x79 (deco model used
for this dive) also has a value for VPM. But the SLogbookHeader
type, despite its name and structure, is *not* a true logbook
header, as it includes attributes that are not available in the
SLogbookHeaderOSTC3 formal header type.
Signed-off-by: Jan Mulder <jan@jlmulder.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Wed, 22 Apr 2020 13:08:57 +0200 |
parents | 39c147e47c1c |
children | b560e474e319 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/tHome.h | |
5 /// \brief Control for Surface and Dive Templates | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 10-November-2014 | |
8 /// | |
9 /// $Id$ | |
10 /////////////////////////////////////////////////////////////////////////////// | |
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
12 /// | |
13 /// This program is free software: you can redistribute it and/or modify | |
14 /// it under the terms of the GNU General Public License as published by | |
15 /// the Free Software Foundation, either version 3 of the License, or | |
16 /// (at your option) any later version. | |
17 /// | |
18 /// This program is distributed in the hope that it will be useful, | |
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 /// GNU General Public License for more details. | |
22 /// | |
23 /// You should have received a copy of the GNU General Public License | |
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 ////////////////////////////////////////////////////////////////////////////// | |
26 | |
27 /* Define to prevent recursive inclusion -------------------------------------*/ | |
28 #ifndef THOME_H | |
29 #define THOME_H | |
30 | |
31 /* Includes ------------------------------------------------------------------*/ | |
32 | |
33 #include <stdio.h> | |
34 #include <string.h> | |
35 #include "stm32f4xx_hal.h" | |
36 #include "base.h" | |
37 #include "gfx.h" | |
38 #include "gfx_colors.h" | |
39 #include "gfx_engine.h" | |
40 #include "text_multilanguage.h" | |
41 #include "settings.h" | |
42 #include "data_central.h" | |
43 #include "data_exchange.h" | |
44 #include "check_warning.h" | |
45 | |
46 extern const uint16_t BigFontSeperationLeftRight; // in t3.c | |
47 extern const uint16_t BigFontSeperationTopBottom; // in t3.c | |
48 | |
49 #define MAX_AGE_DECOINFO_MS (120000) | |
50 | |
51 enum EXTRADISPLAYS | |
52 { | |
53 EXTRADISPLAY_none = 0, | |
54 EXTRADISPLAY_BIGFONT, | |
55 EXTRADISPLAY_DECOGAME, | |
56 EXTRADISPLAY_END | |
57 }; | |
58 | |
59 enum CUSTOMVIEWS | |
60 { | |
61 CVIEW_noneOrDebug = 0, | |
62 CVIEW_sensors, | |
63 CVIEW_Compass, | |
64 CVIEW_Decolist, | |
65 CVIEW_Tissues, | |
66 CVIEW_Profile, | |
67 CVIEW_EADTime, | |
68 CVIEW_Gaslist, | |
69 CVIEW_sensors_mV, | |
70 CVIEW_Hello, | |
71 CVIEW_CompassDebug, | |
72 CVIEW_SummaryOfLeftCorner, | |
73 CVIEW_END, | |
74 CVIEW_T3_Decostop, | |
75 CVIEW_T3_TTS, | |
76 CVIEW_T3_MaxDepth, | |
77 CVIEW_T3_ppO2andGas, | |
78 CVIEW_T3_StopWatch, | |
79 CVIEW_T3_GasList, | |
80 CVIEW_T3_Temperature, | |
81 CVIEW_T3_ApnoeSurfaceInfo, | |
82 CVIEW_T3_END | |
83 }; | |
84 | |
85 // for custom view switch on/off 161122 hw | |
379 | 86 extern const uint8_t cv_changelist[]; |
38 | 87 #define CHECK_BIT_THOME(var,pos) (((var)>>(pos)) & 1) |
88 | |
89 typedef struct | |
90 { | |
91 uint16_t Hours; | |
92 uint16_t Minutes; | |
93 uint16_t Seconds; | |
94 uint32_t Total; | |
95 | |
96 } SDivetime; | |
97 | |
98 | |
99 typedef struct | |
100 { | |
101 uint8_t Days; | |
102 uint8_t Hours; | |
103 uint8_t Minutes; | |
104 uint8_t Seconds; | |
105 uint32_t Total; | |
106 } SSurfacetime; | |
107 | |
108 | |
109 extern _Bool warning_count_high_time; | |
110 extern _Bool display_count_high_time; | |
111 extern uint8_t errorsInSettings; | |
112 | |
113 | |
114 void tHome_init(void); | |
115 void tHome_refresh(void); | |
116 void tHome_sleepmode_fun(void); | |
117 void set_globalState_tHome(void); | |
118 void tHome_change_field_button_pressed(void); | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
119 void tHome_change_customview_button_pressed(uint8_t action); |
38 | 120 |
121 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut); | |
122 void tHomeDiveMenuControl(uint8_t sendAction); | |
123 void tHome_tick(void); | |
124 | |
125 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text); | |
126 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput); | |
127 | |
128 void tHome_init_compass(void); | |
129 | |
130 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode); | |
131 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1); | |
132 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1); | |
133 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode); | |
134 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode); | |
135 //void _findNextStop(const uint16_t *list, uint8_t *depthOut, uint16_t *lengthOut); | |
136 void t3_basics_colorscheme_mod(char *text); | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
379
diff
changeset
|
137 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action); |
38 | 138 |
139 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn); | |
140 | |
141 #endif /* THOME_H */ |