Mercurial > public > ostc4
annotate Discovery/Inc/base.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 | 50ea68c7a153 |
children | e3237f580ae9 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/base.h | |
5 /// \brief main(): init hardware and start sub-systems | |
6 /// \author MCD Application Team | |
7 /// \date 26-February-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 /// \par COPYRIGHT(c) 2014 STMicroelectronics | |
27 /// | |
28 /// Redistribution and use in source and binary forms, with or without modification, | |
29 /// are permitted provided that the following conditions are met: | |
30 /// 1. Redistributions of source code must retain the above copyright notice, | |
31 /// this list of conditions and the following disclaimer. | |
32 /// 2. Redistributions in binary form must reproduce the above copyright notice, | |
33 /// this list of conditions and the following disclaimer in the documentation | |
34 /// and/or other materials provided with the distribution. | |
35 /// 3. Neither the name of STMicroelectronics nor the names of its contributors | |
36 /// may be used to endorse or promote products derived from this software | |
37 /// without specific prior written permission. | |
38 /// | |
39 /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
40 /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
41 /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
42 /// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
43 /// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
44 /// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
45 /// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
46 /// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
47 /// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
48 /// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
49 ////////////////////////////////////////////////////////////////////////////// | |
50 | |
51 /* Define to prevent recursive inclusion -------------------------------------*/ | |
52 #ifndef BASE_H | |
53 #define BASE_H | |
54 | |
55 /* Includes ------------------------------------------------------------------*/ | |
56 #include "stm32f4xx_hal.h" | |
57 #include "tStructure.h" | |
58 | |
59 /* Exported types ------------------------------------------------------------*/ | |
60 /* Exported constants --------------------------------------------------------*/ | |
61 /* Exported macro ------------------------------------------------------------*/ | |
62 | |
63 #define TOP_LAYER 1 | |
64 #define BACKGRD_LAYER 0 | |
65 | |
66 #define SURFMODE 1 | |
67 #define DIVEMODE 2 | |
68 | |
69 typedef enum | |
70 { | |
71 ST_Boot = 0, | |
72 ST_Surface, | |
73 ST_Dive, | |
74 ST_Menu, | |
75 ST_END | |
76 } SState; | |
77 | |
78 typedef enum | |
79 { | |
80 ACTION_IDLE_TICK = 0, | |
81 ACTION_IDLE_SECOND, | |
82 ACTION_MODE_CHANGE, | |
83 ACTION_TIMEOUT, | |
84 ACTION_BUTTON_CUSTOM, | |
85 ACTION_BUTTON_BACK, | |
86 ACTION_BUTTON_NEXT, | |
87 ACTION_BUTTON_ENTER, | |
88 ACTION_BUTTON_ENTER_FINAL, | |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
361
diff
changeset
|
89 ACTION_PITCH_POS, |
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
361
diff
changeset
|
90 ACTION_PITCH_NEG, |
38 | 91 ACTION_END |
92 } SAction; | |
93 | |
94 /* Exported macro ------------------------------------------------------------*/ | |
95 /* Exported functions ------------------------------------------------------- */ | |
96 | |
97 uint32_t get_globalState(void); | |
98 void set_globalState(uint32_t newID); | |
99 void get_globalStateList(SStateList *output); | |
100 void set_globalState_Menu_Page(uint8_t page); | |
101 void set_globalState_Menu_Line(uint8_t line); | |
102 void get_idSpecificStateList(uint32_t id, SStateList *output); | |
103 void delayMicros(uint32_t micros); | |
104 void get_RTC_DateTime(RTC_DateTypeDef * sdatestructureget, RTC_TimeTypeDef * stimestructureget); | |
105 void set_RTC_DateTime(RTC_DateTypeDef * sdatestructure, RTC_TimeTypeDef * stimestructure); | |
106 uint8_t get_globalMode(void); | |
107 void set_globalMode(uint8_t newMode); | |
108 void set_globalState_Log_Page(uint8_t pageIsLine); | |
109 void set_returnFromComm(void); | |
110 uint8_t font_update_required(void); | |
111 | |
112 #endif /* BASE_H */ | |
113 | |
114 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |