Mercurial > public > ostc4
annotate Discovery/Inc/Fonts/image_battery.h @ 224:ceecabfddb57 div-fixes-3
Bugfix, deco: fix 2 (small) problems with calculated ceiling
This fixes 1 trivial, and 1 not really trivial bug in the calculation
of the ceiling. When simulating a bounce dive to 80m, things become
clear (tried this on a CCR dive, fixed setpoint 1.2bar, about 15 minutes
of bottom time). Closely watch the behavior of the ceiling data. At some
point during the ascent, the ceiling begins to decrease in 10cm steps.
Then suddenly (while still ascending), the ceiling increases again with 1m,
does not change for some time, and then suddenly steps 1.1m less deep.
While not very relevant to real deco diving, it is simply wrong.
The reason for this is subtle. The algorithm used to find the ceiling
is a sort of linear search, stepping down a meter, overshoot the depth, and
search back in 10cm steps. It seems some numerical instability. Fixing
this, was a bit more computational intensive search by stepping up down in
equal steps of 10cm. But, I'm pretty sure that things can be speeded up here, as a
ceiling does not change fast, so it should be not that difficult to limit
the search space, or use a binary search algorithm instead.
The trivial second problem fixed, is that the ceiling ends at the surface
and not at 1m depth. This small issue became visible after changing the step
down size above.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Sun, 31 Mar 2019 19:35:51 +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}; |