Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2136 | - | 1 | |
2 | /***************************************************************************** |
||
3 | * hier wird Code von den alten OSD-Screens ausgelagert um osd.c zu entkernen |
||
4 | *****************************************************************************/ |
||
5 | |||
6 | //############################################################################ |
||
7 | //# HISTORY osdold_screens.c |
||
8 | //# |
||
9 | //# 01.06.2014 OG * NEU * |
||
10 | //# Auslagerung von Funktionen fuer alte OSD-Screens aus osd.c |
||
11 | //############################################################################ |
||
12 | |||
13 | |||
14 | #include "../cpu.h" |
||
15 | #include <avr/io.h> |
||
16 | #include <inttypes.h> |
||
17 | #include <stdlib.h> |
||
18 | #include <avr/pgmspace.h> |
||
19 | #include <util/delay.h> |
||
20 | #include <string.h> |
||
21 | #include <util/atomic.h> |
||
22 | |||
23 | #include "../main.h" |
||
24 | #include "../lcd/lcd.h" |
||
25 | #include "../timer/timer.h" |
||
26 | #include "../uart/usart.h" |
||
27 | #include "../eeprom/eeprom.h" |
||
28 | #include "../messages.h" |
||
29 | #include "../sound/pwmsine8bit.h" |
||
30 | #include "../mk-data-structs.h" |
||
31 | #include "../pkt/pkt.h" |
||
32 | #include "../osd/osd.h" |
||
33 | #include "../utils/xutils.h" |
||
34 | #include "../mk/mkbase.h" |
||
35 | #include "../osd/osdold_messages.h" |
||
36 | #include "../osd/osdold_screens.h" |
||
37 | |||
38 | |||
39 | |||
40 | #ifdef USE_OSD_SCREEN_OLD |
||
41 | |||
42 | |||
43 | //-------------------------------------------------------------- |
||
44 | // OSD_Element_AltitudeControl( x, y) |
||
45 | //-------------------------------------------------------------- |
||
46 | void OSD_Element_AltitudeControl( uint8_t x, uint8_t y ) |
||
47 | { |
||
48 | //--------------------------------------------------------- |
||
49 | // 10.03.2013 OG: |
||
50 | // CFG2_HEIGHT_LIMIT im Augenblick nicht unterstuetzt |
||
51 | // Siehe Anmerkungen in osd() |
||
52 | //--------------------------------------------------------- |
||
53 | /* |
||
54 | if (Flags_ExtraConfig & CFG2_HEIGHT_LIMIT) |
||
55 | { |
||
56 | if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
||
57 | lcd_printp_at (x, y, strGet(OSD_ALTI_1), 0); // Höhe begr. |
||
58 | else |
||
59 | lcd_printp_at (x, y, strGetOSDOLD(OSD_ALTI_0), 0); // Höhe aus |
||
60 | } |
||
61 | else |
||
62 | { |
||
63 | if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
||
64 | lcd_printp_at (x, y, strGetOSDOLD(OSD_VARIO_1), 0); // Vario Höhe |
||
65 | else |
||
66 | lcd_printp_at (x, y, strGetOSDOLD(OSD_VARIO_0), 0); // Vario aus |
||
67 | } |
||
68 | */ |
||
69 | |||
70 | if (naviData->FCStatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) |
||
71 | lcd_printp_at (x, y, strGetOSDOLD(OSD_VARIO_1), 0); // Vario Höhe |
||
72 | else |
||
73 | lcd_printp_at (x, y, strGetOSDOLD(OSD_VARIO_0), 0); // Vario aus |
||
74 | } |
||
75 | |||
76 | |||
77 | //-------------------------------------------------------------- |
||
78 | // OSD_Element_CareFree( x, y) |
||
79 | //-------------------------------------------------------------- |
||
80 | void OSD_Element_CareFree( uint8_t x, uint8_t y ) |
||
81 | { |
||
82 | lcd_printp_at (x, y, strGetOSDOLD( naviData->FCStatusFlags2 & FC_STATUS2_CAREFREE ? OSD_CARE_FREE_1 : OSD_CARE_FREE_0 ), 0); |
||
83 | } |
||
84 | |||
85 | |||
86 | //-------------------------------------------------------------- |
||
87 | // OSD_Element_NaviMode( x, y) |
||
88 | //-------------------------------------------------------------- |
||
89 | void OSD_Element_NaviMode( uint8_t x, uint8_t y ) |
||
90 | { |
||
91 | if (naviData->NCFlags & NC_FLAG_FREE) |
||
92 | lcd_printp_at (x, y, strGetOSDOLD(OSD_NAVI_MODE_0), 0); // Navi aus |
||
93 | else if (naviData->NCFlags & NC_FLAG_PH) |
||
94 | lcd_printp_at (x, y, strGetOSDOLD(OSD_NAVI_MODE_1), 0); // Pos. Hold |
||
95 | else if (naviData->NCFlags & NC_FLAG_CH) |
||
96 | lcd_printp_at (x, y, strGetOSDOLD(OSD_NAVI_MODE_2), 0); // Coming Home |
||
97 | } |
||
98 | |||
99 | |||
100 | //-------------------------------------------------------------- |
||
101 | // OSD_Element_StatusFlags( x, y) |
||
102 | //-------------------------------------------------------------- |
||
103 | void OSD_Element_StatusFlags( uint8_t x, uint8_t y ) |
||
104 | { |
||
105 | // FC_StatusFlags 0.88 |
||
106 | // #define FC_STATUS_MOTOR_RUN 0x01 |
||
107 | // #define FC_STATUS_FLY 0x02 |
||
108 | // #define FC_STATUS_CALIBRATE 0x04 |
||
109 | // #define FC_STATUS_START 0x08 |
||
110 | // #define FC_STATUS_EMERGENCY_LANDING 0x10 |
||
111 | // #define FC_STATUS_LOWBAT 0x20 |
||
112 | // #define FC_STATUS_VARIO_TRIM_UP 0x40 |
||
113 | // #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
||
114 | |||
115 | if (naviData->FCStatusFlags & FC_STATUS_CALIBRATE) |
||
116 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_1), 0); // Calibrate |
||
117 | else if (naviData->FCStatusFlags & FC_STATUS_START) |
||
118 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_2), 0); // Start |
||
119 | else if (naviData->FCStatusFlags & FC_STATUS_MOTOR_RUN) |
||
120 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_3), 0); // Run |
||
121 | else if (naviData->FCStatusFlags & FC_STATUS_FLY) |
||
122 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_4), 0); // Fly |
||
123 | else if (naviData->FCStatusFlags & FC_STATUS_EMERGENCY_LANDING) |
||
124 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_5), 0); // Landing |
||
125 | else if (naviData->FCStatusFlags & FC_STATUS_LOWBAT) |
||
126 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_6), 0); // LowBat |
||
127 | else |
||
128 | // lcd_printp_at (x, y, PSTR(" "), 0); // Clear |
||
129 | lcd_printp_at (x, y, strGetOSDOLD(OSD_FLAGS_0), 0); // Clear |
||
130 | } |
||
131 | |||
132 | |||
133 | |||
134 | //############################################################## |
||
135 | //# OLD OSD-Screens |
||
136 | //############################################################## |
||
137 | |||
138 | //-------------------------------------------------------------- |
||
139 | // ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 0 |
||
140 | //-------------------------------------------------------------- |
||
141 | void OSD_Screen_OSD0( void ) |
||
142 | { |
||
143 | //uint8_t xoffs; |
||
144 | |||
145 | //----------------------------------------- |
||
146 | // REDRAW static screen elements |
||
147 | //----------------------------------------- |
||
148 | if( OSDScreenRefresh == OSD_SCREEN_REDRAW ) |
||
149 | { |
||
150 | // do things here for static screen elements like labels and so.... |
||
151 | } |
||
152 | |||
153 | OSD_Element_AltitudeControl ( 0, 3); |
||
154 | OSD_Element_Altitude ( 11, 3, 0); |
||
155 | OSD_Element_BatteryLevel ( 0, 7, 0); |
||
156 | OSD_Element_Capacity ( 13, 7); |
||
157 | OSD_Element_Current ( 8, 7); |
||
158 | OSD_Element_CareFree ( 0, 5); |
||
159 | OSD_Element_CompassDegree ( 13, 0, 0); |
||
160 | OSD_Element_CompassDirection( 18, 0, 0,0); |
||
161 | OSD_Element_CompassRose ( 12, 1); |
||
162 | OSD_Element_FlyingTime ( 0, 1); |
||
163 | OSD_Element_GroundSpeed ( 0, 0); |
||
164 | OSD_Element_HomeCircle ( 16, 4, 5, 0, 0,0); |
||
165 | OSD_Element_HomeDegree ( 12, 4); |
||
166 | OSD_Element_HomeDistance ( 10, 5, 0); |
||
167 | OSD_Element_Target ( 10, 6, 0); |
||
168 | //OSD_Element_TargetDegree ( x, y); |
||
169 | OSD_Element_WayPoint ( 5, 6); |
||
170 | OSD_Element_LED1Output ( 0, 6); |
||
171 | OSD_Element_LED2Output ( 3, 6); |
||
172 | //OSD_Element_Manuell ( x, y); |
||
173 | OSD_Element_NaviMode ( 0, 4); |
||
174 | //OSD_Element_RCIntensity ( x, y); |
||
175 | OSD_Element_VarioWert ( 12, 2); |
||
176 | OSD_Element_SatsInUse ( 18, 2, 0); |
||
177 | OSD_Element_StatusFlags ( 0, 2); |
||
178 | OSD_Element_Variometer ( 9, 0); |
||
179 | } |
||
180 | |||
181 | |||
182 | //-------------------------------------------------------------- |
||
183 | // ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 1 |
||
184 | //-------------------------------------------------------------- |
||
185 | void OSD_Screen_OSD1( void ) |
||
186 | { |
||
187 | //uint8_t xoffs; |
||
188 | |||
189 | //----------------------------------------- |
||
190 | // REDRAW static screen elements |
||
191 | //----------------------------------------- |
||
192 | if( OSDScreenRefresh == OSD_SCREEN_REDRAW ) |
||
193 | { |
||
194 | // do things here for static screen elements like labels and so.... |
||
195 | } |
||
196 | |||
197 | //OSD_Element_AltitudeControl( x, y); |
||
198 | OSD_Element_Altitude ( 1, 1, 1); |
||
199 | OSD_Element_BatteryLevel ( 0, 7, 1); |
||
200 | OSD_Element_Capacity ( 13, 7); |
||
201 | OSD_Element_Current ( 8, 7); |
||
202 | //OSD_Element_CareFree ( x, y); |
||
203 | OSD_Element_CompassDegree ( 13, 0, 1); |
||
204 | OSD_Element_CompassDirection( 18, 0, 0,0); |
||
205 | OSD_Element_CompassRose ( 12, 1); |
||
206 | OSD_Element_FlyingTime ( 7, 6); |
||
207 | OSD_Element_GroundSpeed ( 0, 0); |
||
208 | OSD_Element_HomeCircle ( 1, 3, 7, 0, 0,0); |
||
209 | OSD_Element_HomeDegree ( 8, 3); |
||
210 | OSD_Element_HomeDistance ( 7, 2, 1); |
||
211 | //OSD_Element_Target ( x, y, 1); |
||
212 | //OSD_Element_TargetDegree ( x, y); |
||
213 | //OSD_Element_WayPoint ( x, y); |
||
214 | //OSD_Element_LED1Output ( x, y); |
||
215 | //OSD_Element_LED2Output ( x, y); |
||
216 | //OSD_Element_Manuell ( x, y); |
||
217 | OSD_Element_NaviMode ( 8, 5); |
||
218 | OSD_Element_RCIntensity ( 15, 6); |
||
219 | OSD_Element_VarioWert ( 15, 2); |
||
220 | OSD_Element_SatsInUse ( 8, 4, 1); |
||
221 | //OSD_Element_StatusFlags ( x, y); |
||
222 | OSD_Element_Variometer ( 9, 0); |
||
223 | } |
||
224 | |||
225 | |||
226 | //-------------------------------------------------------------- |
||
227 | // ehemals: OSD_ALTITUDE,Config.OSD_ScreenMode == 2 |
||
228 | //-------------------------------------------------------------- |
||
229 | void OSD_Screen_OSD2( void ) |
||
230 | { |
||
231 | //uint8_t xoffs; |
||
232 | |||
233 | //----------------------------------------- |
||
234 | // REDRAW static screen elements |
||
235 | //----------------------------------------- |
||
236 | if( OSDScreenRefresh == OSD_SCREEN_REDRAW ) |
||
237 | { |
||
238 | // do things here for static screen elements like labels and so.... |
||
239 | } |
||
240 | |||
241 | OSD_Element_AltitudeControl ( 0, 1); |
||
242 | OSD_Element_Altitude ( 0, 4, 2); |
||
243 | OSD_Element_BatteryLevel ( 13, 7, 2); |
||
244 | OSD_Element_Capacity ( 0, 7); |
||
245 | OSD_Element_Current ( 8, 7); |
||
246 | OSD_Element_CareFree ( 0, 3); |
||
247 | OSD_Element_CompassDegree ( 12, 3, 2); |
||
248 | //OSD_Element_CompassDirection( x, y, 0,0); |
||
249 | //OSD_Element_CompassRose ( x, y); |
||
250 | OSD_Element_FlyingTime ( 15, 5); |
||
251 | //OSD_Element_GroundSpeed ( x, y); |
||
252 | OSD_Element_HomeCircle ( 16, 0, 5, 0, 0,0); |
||
253 | OSD_Element_HomeDegree ( 11, 5); |
||
254 | OSD_Element_HomeDistance ( 0, 5, 2); |
||
255 | OSD_Element_Target ( 0, 6, 2); |
||
256 | OSD_Element_TargetDegree ( 11, 6); |
||
257 | //OSD_Element_WayPoint ( x, y); |
||
258 | OSD_Element_LED1Output ( 12, 2); |
||
259 | OSD_Element_LED2Output ( 14, 2); |
||
260 | //OSD_Element_Manuell ( x, y); |
||
261 | OSD_Element_NaviMode ( 0, 2); |
||
262 | //OSD_Element_RCIntensity ( x, y); |
||
263 | OSD_Element_VarioWert ( 15, 4); |
||
264 | OSD_Element_SatsInUse ( 10, 0, 2); |
||
265 | OSD_Element_StatusFlags ( 0, 0); |
||
266 | //OSD_Element_Variometer ( x, y); |
||
267 | } |
||
268 | |||
269 | |||
270 | |||
271 | #endif // ifdef: USE_OSD_SCREEN_OLD |