Mercurial > public > ostc4
annotate Discovery/Src/tInfoCompass.c @ 824:2a9a47547b05 Evo_2_23
Bugfix Flipscreen visualization:
In Timer and CCR overview the free custom fram coordinates were not initialized. Depending on which view was activ before the coordinates of the former view were used and sometimes resulting in a bad visualization. To fix the problem the coordinates are now initialized by the views.
The top menu bar text in the flip view did not consider spacings in the text position calculation causing an offset between color bar and text. The offset has been corrected.
author | Ideenmodellierer |
---|---|
date | Mon, 09 Oct 2023 16:50:11 +0200 |
parents | b7b481df4f22 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tInfoCompass.c | |
5 /// \brief there is only compass_DX_f, compass_DY_f, compass_DZ_f output during this mode | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 23-Feb-2015 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
243
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
30 |
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
31 #include "gfx_engine.h" |
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
32 #include "gfx_fonts.h" |
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
33 #include "tHome.h" |
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
34 #include "tInfo.h" |
38 | 35 #include "tInfoCompass.h" |
36 | |
37 #include <string.h> | |
38 | |
39 /* Private variables ---------------------------------------------------------*/ | |
40 | |
41 uint16_t tInfoCompassTimeout = 0; | |
42 int16_t minMaxCompassDX[3][2] = { 0 }; | |
43 | |
44 /* Exported functions --------------------------------------------------------*/ | |
45 void openInfo_Compass(void) | |
46 { | |
47 set_globalState(StICOMPASS); | |
48 tInfoCompassTimeout = settingsGetPointer()->timeoutInfoCompass; | |
49 tInfoCompassTimeout *= 10; | |
50 | |
51 for(int i = 0; i<3;i ++) | |
52 { | |
53 minMaxCompassDX[i][0] = 999; | |
54 minMaxCompassDX[i][1] = -999; | |
55 } | |
56 } | |
57 | |
58 | |
59 // =============================================================================== | |
60 // refreshInfo_Compass | |
61 /// @brief there is only compass_DX_f, compass_DY_f, compass_DZ_f output during this mode | |
62 /// the accel is not called during this process | |
63 // =============================================================================== | |
243
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
64 void refreshInfo_Compass(GFX_DrawCfgScreen s) |
38 | 65 { |
243
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
66 |
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
67 tHome_show_lost_connection_count(&s); |
38 | 68 tInfoCompassTimeout--; |
69 if(tInfoCompassTimeout == 0) | |
70 { | |
71 exitInfo(); | |
72 return; | |
73 } | |
74 | |
75 char text[80]; | |
76 | |
77 int16_t compassValues[3]; | |
78 | |
79 compassValues[0] = stateUsed->lifeData.compass_DX_f; | |
80 compassValues[1] = stateUsed->lifeData.compass_DY_f; | |
81 compassValues[2] = stateUsed->lifeData.compass_DZ_f; | |
82 | |
83 for(int i = 0; i<3;i ++) | |
84 { | |
85 // do not accept zero | |
86 if(minMaxCompassDX[i][0] == 0) | |
87 minMaxCompassDX[i][0] = compassValues[i]; | |
88 | |
89 // do not accept zero | |
90 if(minMaxCompassDX[i][1] == 0) | |
91 minMaxCompassDX[i][1] = compassValues[i]; | |
92 | |
93 if(compassValues[i] < minMaxCompassDX[i][0]) | |
94 minMaxCompassDX[i][0] = compassValues[i]; | |
95 | |
96 if(compassValues[i] > minMaxCompassDX[i][1]) | |
97 minMaxCompassDX[i][1] = compassValues[i]; | |
98 } | |
99 | |
100 snprintf(text,80,"Time left: %u s",(tInfoCompassTimeout+9)/10); | |
243
b7b481df4f22
debug: add SPI error counter to compass calibration
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
101 tInfo_write_content_simple( 20,800, 25, &FontT42, text, CLUT_InfoCompass); |
38 | 102 |
103 for(int i = 0; i<3;i ++) | |
104 { | |
105 snprintf(text,80,"%c: %i" "\t(%i, %i)", | |
106 'X'+i, | |
107 compassValues[i], | |
108 minMaxCompassDX[i][0], | |
109 minMaxCompassDX[i][1]); | |
110 tInfo_write_content_simple( 20,800, 96 + (i*96), &FontT48, text, CLUT_InfoCompass); | |
111 } | |
112 | |
113 snprintf(text,80,"roll %.1f" "\tpitch %.1f", | |
114 stateUsed->lifeData.compass_roll, | |
115 stateUsed->lifeData.compass_pitch); | |
116 tInfo_write_content_simple( 20,800, 96 * 4, &FontT42, text, CLUT_InfoCompass); | |
117 } |