Mercurial > public > ostc4
annotate Discovery/Inc/Fonts/image_battery.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 | 219943ef9dc0 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/Fonts/image_battery.h | |
5 /// \brief Font to display battery filling up. | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 2015-06-03 | |
8 /// | |
9 /// \details | |
10 /// Imported from Batt2Top - gaia by hw | |
11 /// | |
12 /// $Id$ | |
13 /////////////////////////////////////////////////////////////////////////////// | |
14 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
15 /// | |
16 /// This program is free software: you can redistribute it and/or modify | |
17 /// it under the terms of the GNU General Public License as published by | |
18 /// the Free Software Foundation, either version 3 of the License, or | |
19 /// (at your option) any later version. | |
20 /// | |
21 /// This program is distributed in the hope that it will be useful, | |
22 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 /// GNU General Public License for more details. | |
25 /// | |
26 /// You should have received a copy of the GNU General Public License | |
27 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 ////////////////////////////////////////////////////////////////////////////// | |
29 | |
30 #include "gfx_fonts.h" | |
31 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
32 static const uint8_t image_data_Batt2Top[168] UPPER_IMAGES = { |
38 | 33 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, |
34 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, | |
35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
39 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
40 }; | |
41 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
42 static const uint8_t image_data_Batt2Empty4px_of_40px[96] UPPER_IMAGES = { |
38 | 43 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, |
44 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, | |
45 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, | |
46 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00 | |
47 }; | |
48 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
49 static const uint8_t image_data_Batt2Full4px_of_40px[96] UPPER_IMAGES = { |
38 | 50 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
51 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | |
52 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | |
53 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 | |
54 }; | |
55 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
56 static const uint8_t image_data_Batt2Bottom[72] UPPER_IMAGES = { |
38 | 57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
58 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, | |
59 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 | |
60 }; | |
61 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
62 static const uint8_t image_data_Batt2Blitz[312] UPPER_IMAGES = { |
38 | 63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
64 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
65 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
66 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
67 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
68 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | |
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, | |
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, | |
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | |
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, | |
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | |
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
76 }; | |
77 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
78 static const tImage Batt2Top UPPER_IMAGES = { image_data_Batt2Top, 7, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
79 static const tImage Batt2Empty4px_of_40px UPPER_IMAGES = { image_data_Batt2Empty4px_of_40px, 4, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
80 static const tImage Batt2Full4px_of_40px UPPER_IMAGES = { image_data_Batt2Full4px_of_40px, 4, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
81 static const tImage Batt2Bottom UPPER_IMAGES = { image_data_Batt2Bottom, 3, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
82 static const tImage Batt2Blitz UPPER_IMAGES = { image_data_Batt2Blitz, 13, 24}; |
38 | 83 |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
84 static const tChar batt2_array[] UPPER_IMAGES = { |
38 | 85 |
86 // character: battery header | |
87 {'0', &Batt2Top}, | |
88 | |
89 // character: battery empty | |
90 {'1', &Batt2Empty4px_of_40px}, | |
91 | |
92 // character: battery full | |
93 {'2', &Batt2Full4px_of_40px}, | |
94 | |
95 // character: battery footer | |
96 {'3', &Batt2Bottom}, | |
97 | |
98 // character: battery lightning | |
99 {'4', &Batt2Blitz}, | |
100 }; | |
101 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
102 const tFont Batt24 UPPER_IMAGE_DIRECTORY = { 5, batt2_array , 18, 18, 24}; |