Mercurial > public > ostc4
annotate Discovery/Inc/gfx_fonts.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 | f2d98ad6f1be |
children | 1c95f811967c |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/gfx_fonts.h | |
5 /// \brief Header file to control placement of font in STM32 Flash | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 14-Aug-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 GFX_FONTS_H | |
29 #define GFX_FONTS_H | |
30 | |
31 #include "gfx.h" | |
32 | |
33 // From image_heinrichs_weikamp.c | |
34 enum { indexHWcolorSIZE = 256 }; | |
35 | |
36 // Forward declarations | |
37 // | |
38 // 2018-01-01 jDG: | |
39 // - the exact address is fixed in linker script CPU1-F429.ld, | |
40 // so that every font can be used even when not included in the actual | |
41 // binary (boot-loader, fonts, or firmware). | |
42 // | |
43 // - Actual font data is defined by the OSTC4/FontPack project, that shall | |
44 // be loaded before the firmware is executed. | |
45 // | |
46 // - Font directory starts at address 0x081E0000. Each header is 12 bytes. | |
47 // A 0xFFFFFFFF (32 bits) marks the directory's end. | |
48 // It is stored between __font_directory and __font_directory_end; | |
49 // | |
50 // - Font data (chars) is stored after 0x08132040 (end of font's SFirmareData). | |
51 // So there is space for 0x081E0000 - 0x08132040 = ADFC0 = 694 KB of fonts. | |
52 // Actual data is stored between __upper_font_data and __upper_font_data_end, | |
53 // and uses 0x081b9a3a - 0x08132040 = 879FA = 542 KB. | |
54 // | |
55 extern const tFont Awe48; | |
56 extern const tFont FontT24; | |
57 extern const tFont FontT42; | |
58 extern const tFont FontT48; | |
59 extern const tFont FontT54; | |
60 extern const tFont FontT84; | |
61 extern const tFont FontT105; | |
62 extern const tFont FontT144; | |
63 | |
64 extern const tFont Batt24; | |
65 | |
66 extern const tImage ImgHWcolor; | |
67 extern const tImage ImgOSTC; | |
68 | |
69 extern const uint32_t indexHWcolor[indexHWcolorSIZE]; | |
70 | |
71 // Macro to store in UPPER rom font sections | |
44
7c786c7aa99b
Placed directory sections in firmware memory space
Ideenmodellierer
parents:
38
diff
changeset
|
72 /* TODO: Looking at older map files the directories should be placed within the firmware memory */ |
7c786c7aa99b
Placed directory sections in firmware memory space
Ideenmodellierer
parents:
38
diff
changeset
|
73 /* As well as the image data => to be confirmed */ |
74 | 74 #define UPPER_FONT_DIRECTORY __attribute__ (( used, section(".upper_font_directory") )) |
44
7c786c7aa99b
Placed directory sections in firmware memory space
Ideenmodellierer
parents:
38
diff
changeset
|
75 |
7c786c7aa99b
Placed directory sections in firmware memory space
Ideenmodellierer
parents:
38
diff
changeset
|
76 #define UPPER_IMAGE_DIRECTORY __attribute__(( section(".lower_image_directory") )) |
7c786c7aa99b
Placed directory sections in firmware memory space
Ideenmodellierer
parents:
38
diff
changeset
|
77 #define UPPER_IMAGES __attribute__(( section(".lower_images") )) |
38 | 78 |
79 #endif // GFX_FONTS_H |