Fix WS2812 led definition
[inav.git] / src / main / io / osd.h
blob9cb4eaabd81bf722129fb2b2e6f390564bb70b72
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "common/time.h"
22 #include "config/parameter_group.h"
24 #include "drivers/osd.h"
25 #include "drivers/display.h"
27 #ifndef OSD_ALTERNATE_LAYOUT_COUNT
28 #define OSD_ALTERNATE_LAYOUT_COUNT 3
29 #endif
30 #define OSD_LAYOUT_COUNT (OSD_ALTERNATE_LAYOUT_COUNT + 1)
32 // 00vb yyyy yyxx xxxx
33 // (visible)(blink)(yCoord)(xCoord)
35 #define OSD_VISIBLE_FLAG 0x2000
36 #define OSD_VISIBLE(x) ((x) & OSD_VISIBLE_FLAG)
38 #define OSD_POS(x,y) (((x) & 0x3F) | (((y) & 0x3F) << 6))
39 #define OSD_X(x) ((x) & 0x3F)
40 #define OSD_Y(x) (((x) >> 6) & 0x3F)
41 #define OSD_POS_MAX 0xFFF
43 // For DJI compatibility
44 #define OSD_VISIBLE_FLAG_SD 0x0800
45 #define OSD_POS_SD(x,y) (((x) & 0x1F) | (((y) & 0x1F) << 5))
47 #define OSD_POS_MAX_CLI (OSD_POS_MAX | OSD_VISIBLE_FLAG)
49 #define OSD_HOMING_LIM_H1 6
50 #define OSD_HOMING_LIM_H2 16
51 #define OSD_HOMING_LIM_H3 38
52 #define OSD_HOMING_LIM_V1 5
53 #define OSD_HOMING_LIM_V2 10
54 #define OSD_HOMING_LIM_V3 15
56 // Message defines to be use in OSD and/or telemetry exports
57 #define OSD_MSG_RC_RX_LINK_LOST "!RC RX LINK LOST!"
58 #define OSD_MSG_TURN_ARM_SW_OFF "TURN ARM SWITCH OFF"
59 #define OSD_MSG_DISABLED_BY_FS "DISABLED BY FAILSAFE"
60 #define OSD_MSG_AIRCRAFT_UNLEVEL "AIRCRAFT IS NOT LEVEL"
61 #define OSD_MSG_SENSORS_CAL "SENSORS CALIBRATING"
62 #define OSD_MSG_SYS_OVERLOADED "SYSTEM OVERLOADED"
63 #define OSD_MSG_WAITING_GPS_FIX "WAITING FOR GPS FIX"
64 #define OSD_MSG_DISABLE_NAV_FIRST "DISABLE NAVIGATION FIRST"
65 #define OSD_MSG_JUMP_WP_MISCONFIG "JUMP WAYPOINT MISCONFIGURED"
66 #define OSD_MSG_MAG_NOT_CAL "COMPASS NOT CALIBRATED"
67 #define OSD_MSG_ACC_NOT_CAL "ACCELEROMETER NOT CALIBRATED"
68 #define OSD_MSG_DISARM_1ST "DISABLE ARM SWITCH FIRST"
69 #define OSD_MSG_GYRO_FAILURE "GYRO FAILURE"
70 #define OSD_MSG_ACC_FAIL "ACCELEROMETER FAILURE"
71 #define OSD_MSG_MAG_FAIL "COMPASS FAILURE"
72 #define OSD_MSG_BARO_FAIL "BAROMETER FAILURE"
73 #define OSD_MSG_GPS_FAIL "GPS FAILURE"
74 #define OSD_MSG_RANGEFINDER_FAIL "RANGE FINDER FAILURE"
75 #define OSD_MSG_PITOT_FAIL "PITOT METER FAILURE"
76 #define OSD_MSG_HW_FAIL "HARDWARE FAILURE"
77 #define OSD_MSG_FS_EN "FAILSAFE MODE ENABLED"
78 #define OSD_MSG_KILL_SW_EN "KILLSWITCH MODE ENABLED"
79 #define OSD_MSG_NO_RC_LINK "NO RC LINK"
80 #define OSD_MSG_THROTTLE_NOT_LOW "THROTTLE IS NOT LOW"
81 #define OSD_MSG_ROLLPITCH_OFFCENTER "ROLLPITCH NOT CENTERED"
82 #define OSD_MSG_AUTOTRIM_ACTIVE "AUTOTRIM IS ACTIVE"
83 #define OSD_MSG_NOT_ENOUGH_MEMORY "NOT ENOUGH MEMORY"
84 #define OSD_MSG_INVALID_SETTING "INVALID SETTING"
85 #define OSD_MSG_CLI_ACTIVE "CLI IS ACTIVE"
86 #define OSD_MSG_PWM_INIT_ERROR "PWM INIT ERROR"
87 #define OSD_MSG_NO_PREARM "NO PREARM"
88 #define OSD_MSG_DSHOT_BEEPER "MOTOR BEEPER ACTIVE"
89 #define OSD_MSG_RTH_FS "(RTH)"
90 #define OSD_MSG_EMERG_LANDING_FS "(EMERGENCY LANDING)"
91 #define OSD_MSG_MOVE_EXIT_FS "!MOVE STICKS TO EXIT FS!"
92 #define OSD_MSG_STARTING_RTH "STARTING RTH"
93 #define OSD_MSG_RTH_CLIMB "ADJUSTING RTH ALTITUDE"
94 #define OSD_MSG_RTH_TRACKBACK "RTH BACK TRACKING"
95 #define OSD_MSG_HEADING_HOME "EN ROUTE TO HOME"
96 #define OSD_MSG_WP_FINISHED "WP END>HOLDING POSITION"
97 #define OSD_MSG_WP_LANDED "WP END>LANDED"
98 #define OSD_MSG_PREPARE_NEXT_WP "PREPARING FOR NEXT WAYPOINT"
99 #define OSD_MSG_ADJUSTING_WP_ALT "ADJUSTING WP ALTITUDE"
100 #define OSD_MSG_MISSION_PLANNER "(WP MISSION PLANNER)"
101 #define OSD_MSG_WP_RTH_CANCEL "CANCEL WP TO EXIT RTH"
102 #define OSD_MSG_WP_MISSION_LOADED "* MISSION LOADED *"
103 #define OSD_MSG_EMERG_LANDING "EMERGENCY LANDING"
104 #define OSD_MSG_LANDING "LANDING"
105 #define OSD_MSG_LOITERING_HOME "LOITERING AROUND HOME"
106 #define OSD_MSG_HOVERING "HOVERING"
107 #define OSD_MSG_LANDED "LANDED"
108 #define OSD_MSG_PREPARING_LAND "PREPARING TO LAND"
109 #define OSD_MSG_AUTOLAUNCH "AUTOLAUNCH"
110 #define OSD_MSG_AUTOLAUNCH_MANUAL "AUTOLAUNCH (MANUAL)"
111 #define OSD_MSG_ALTITUDE_HOLD "(ALTITUDE HOLD)"
112 #define OSD_MSG_AUTOTRIM "(AUTOTRIM)"
113 #define OSD_MSG_AUTOTUNE "(AUTOTUNE)"
114 #define OSD_MSG_AUTOTUNE_ACRO "SWITCH TO ACRO"
115 #define OSD_MSG_HEADFREE "(HEADFREE)"
116 #define OSD_MSG_NAV_SOARING "(SOARING)"
117 #define OSD_MSG_UNABLE_ARM "UNABLE TO ARM"
118 #define OSD_MSG_SAVING_SETTNGS "** SAVING SETTINGS **"
119 #define OSD_MSG_SETTINGS_SAVED "** SETTINGS SAVED **"
121 #ifdef USE_DEV_TOOLS
122 #define OSD_MSG_GRD_TEST_MODE "GRD TEST > MOTORS DISABLED"
123 #endif
125 #if defined(USE_SAFE_HOME)
126 #define OSD_MSG_DIVERT_SAFEHOME "DIVERTING TO SAFEHOME"
127 #define OSD_MSG_LOITERING_SAFEHOME "LOITERING AROUND SAFEHOME"
128 #endif
130 typedef enum {
131 OSD_RSSI_VALUE,
132 OSD_MAIN_BATT_VOLTAGE,
133 OSD_CROSSHAIRS,
134 OSD_ARTIFICIAL_HORIZON,
135 OSD_HORIZON_SIDEBARS,
136 OSD_ONTIME,
137 OSD_FLYTIME,
138 OSD_FLYMODE,
139 OSD_CRAFT_NAME,
140 OSD_THROTTLE_POS,
141 OSD_VTX_CHANNEL,
142 OSD_CURRENT_DRAW,
143 OSD_MAH_DRAWN,
144 OSD_GPS_SPEED,
145 OSD_GPS_SATS,
146 OSD_ALTITUDE,
147 OSD_ROLL_PIDS,
148 OSD_PITCH_PIDS,
149 OSD_YAW_PIDS,
150 OSD_POWER,
151 OSD_GPS_LON,
152 OSD_GPS_LAT,
153 OSD_HOME_DIR,
154 OSD_HOME_DIST,
155 OSD_HEADING,
156 OSD_VARIO,
157 OSD_VARIO_NUM,
158 OSD_AIR_SPEED,
159 OSD_ONTIME_FLYTIME,
160 OSD_RTC_TIME,
161 OSD_MESSAGES,
162 OSD_GPS_HDOP,
163 OSD_MAIN_BATT_CELL_VOLTAGE,
164 OSD_THROTTLE_POS_AUTO_THR,
165 OSD_HEADING_GRAPH,
166 OSD_EFFICIENCY_MAH_PER_KM,
167 OSD_WH_DRAWN,
168 OSD_BATTERY_REMAINING_CAPACITY,
169 OSD_BATTERY_REMAINING_PERCENT,
170 OSD_EFFICIENCY_WH_PER_KM,
171 OSD_TRIP_DIST,
172 OSD_ATTITUDE_PITCH,
173 OSD_ATTITUDE_ROLL,
174 OSD_MAP_NORTH,
175 OSD_MAP_TAKEOFF,
176 OSD_RADAR,
177 OSD_WIND_SPEED_HORIZONTAL,
178 OSD_WIND_SPEED_VERTICAL,
179 OSD_REMAINING_FLIGHT_TIME_BEFORE_RTH,
180 OSD_REMAINING_DISTANCE_BEFORE_RTH,
181 OSD_HOME_HEADING_ERROR,
182 OSD_COURSE_HOLD_ERROR,
183 OSD_COURSE_HOLD_ADJUSTMENT,
184 OSD_SAG_COMPENSATED_MAIN_BATT_VOLTAGE,
185 OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE,
186 OSD_POWER_SUPPLY_IMPEDANCE,
187 OSD_LEVEL_PIDS,
188 OSD_POS_XY_PIDS,
189 OSD_POS_Z_PIDS,
190 OSD_VEL_XY_PIDS,
191 OSD_VEL_Z_PIDS,
192 OSD_HEADING_P,
193 OSD_BOARD_ALIGN_ROLL,
194 OSD_BOARD_ALIGN_PITCH,
195 OSD_RC_EXPO,
196 OSD_RC_YAW_EXPO,
197 OSD_THROTTLE_EXPO,
198 OSD_PITCH_RATE,
199 OSD_ROLL_RATE,
200 OSD_YAW_RATE,
201 OSD_MANUAL_RC_EXPO,
202 OSD_MANUAL_RC_YAW_EXPO,
203 OSD_MANUAL_PITCH_RATE,
204 OSD_MANUAL_ROLL_RATE,
205 OSD_MANUAL_YAW_RATE,
206 OSD_NAV_FW_CRUISE_THR,
207 OSD_NAV_FW_PITCH2THR,
208 OSD_FW_MIN_THROTTLE_DOWN_PITCH_ANGLE,
209 OSD_DEBUG, // Intentionally absent from configurator and CMS. Set it from CLI.
210 OSD_FW_ALT_PID_OUTPUTS,
211 OSD_FW_POS_PID_OUTPUTS,
212 OSD_MC_VEL_X_PID_OUTPUTS,
213 OSD_MC_VEL_Y_PID_OUTPUTS,
214 OSD_MC_VEL_Z_PID_OUTPUTS,
215 OSD_MC_POS_XYZ_P_OUTPUTS,
216 OSD_3D_SPEED,
217 OSD_IMU_TEMPERATURE,
218 OSD_BARO_TEMPERATURE,
219 OSD_TEMP_SENSOR_0_TEMPERATURE,
220 OSD_TEMP_SENSOR_1_TEMPERATURE,
221 OSD_TEMP_SENSOR_2_TEMPERATURE,
222 OSD_TEMP_SENSOR_3_TEMPERATURE,
223 OSD_TEMP_SENSOR_4_TEMPERATURE,
224 OSD_TEMP_SENSOR_5_TEMPERATURE,
225 OSD_TEMP_SENSOR_6_TEMPERATURE,
226 OSD_TEMP_SENSOR_7_TEMPERATURE,
227 OSD_ALTITUDE_MSL,
228 OSD_PLUS_CODE,
229 OSD_MAP_SCALE,
230 OSD_MAP_REFERENCE,
231 OSD_GFORCE,
232 OSD_GFORCE_X,
233 OSD_GFORCE_Y,
234 OSD_GFORCE_Z,
235 OSD_RC_SOURCE,
236 OSD_VTX_POWER,
237 OSD_ESC_RPM,
238 OSD_ESC_TEMPERATURE,
239 OSD_AZIMUTH,
240 OSD_CRSF_RSSI_DBM,
241 OSD_CRSF_LQ,
242 OSD_CRSF_SNR_DB,
243 OSD_CRSF_TX_POWER,
244 OSD_GVAR_0,
245 OSD_GVAR_1,
246 OSD_GVAR_2,
247 OSD_GVAR_3,
248 OSD_TPA,
249 OSD_NAV_FW_CONTROL_SMOOTHNESS,
250 OSD_VERSION,
251 OSD_RANGEFINDER,
252 OSD_PLIMIT_REMAINING_BURST_TIME,
253 OSD_PLIMIT_ACTIVE_CURRENT_LIMIT,
254 OSD_PLIMIT_ACTIVE_POWER_LIMIT,
255 OSD_GLIDESLOPE,
256 OSD_GPS_MAX_SPEED,
257 OSD_3D_MAX_SPEED,
258 OSD_AIR_MAX_SPEED,
259 OSD_ACTIVE_PROFILE,
260 OSD_MISSION,
261 OSD_SWITCH_INDICATOR_0,
262 OSD_SWITCH_INDICATOR_1,
263 OSD_SWITCH_INDICATOR_2,
264 OSD_SWITCH_INDICATOR_3,
265 OSD_TPA_TIME_CONSTANT,
266 OSD_FW_LEVEL_TRIM,
267 OSD_GLIDE_TIME_REMAINING,
268 OSD_GLIDE_RANGE,
269 OSD_CLIMB_EFFICIENCY,
270 OSD_NAV_WP_MULTI_MISSION_INDEX,
271 OSD_GROUND_COURSE, // 140
272 OSD_CROSS_TRACK_ERROR,
273 OSD_PILOT_NAME,
274 OSD_ITEM_COUNT // MUST BE LAST
275 } osd_items_e;
277 typedef enum {
278 OSD_UNIT_IMPERIAL,
279 OSD_UNIT_METRIC,
280 OSD_UNIT_METRIC_MPH, // Old UK units, all metric except speed in mph
281 OSD_UNIT_UK, // Show everything in imperial, temperature in C
282 OSD_UNIT_GA, // General Aviation: Knots, Nautical Miles, Feet, Degrees C
284 OSD_UNIT_MAX = OSD_UNIT_GA,
285 } osd_unit_e;
287 typedef enum {
288 OSD_STATS_ENERGY_UNIT_MAH,
289 OSD_STATS_ENERGY_UNIT_WH,
290 } osd_stats_energy_unit_e;
292 typedef enum {
293 OSD_STATS_MIN_VOLTAGE_UNIT_BATTERY,
294 OSD_STATS_MIN_VOLTAGE_UNIT_CELL,
295 } osd_stats_min_voltage_unit_e;
297 typedef enum {
298 OSD_CROSSHAIRS_STYLE_DEFAULT,
299 OSD_CROSSHAIRS_STYLE_AIRCRAFT,
300 OSD_CROSSHAIRS_STYLE_TYPE3,
301 OSD_CROSSHAIRS_STYLE_TYPE4,
302 OSD_CROSSHAIRS_STYLE_TYPE5,
303 OSD_CROSSHAIRS_STYLE_TYPE6,
304 OSD_CROSSHAIRS_STYLE_TYPE7,
305 } osd_crosshairs_style_e;
307 typedef enum {
308 OSD_SIDEBAR_SCROLL_NONE,
309 OSD_SIDEBAR_SCROLL_ALTITUDE,
310 OSD_SIDEBAR_SCROLL_SPEED,
311 OSD_SIDEBAR_SCROLL_HOME_DISTANCE,
313 OSD_SIDEBAR_SCROLL_MAX = OSD_SIDEBAR_SCROLL_HOME_DISTANCE,
314 } osd_sidebar_scroll_e;
316 typedef enum {
317 OSD_ALIGN_LEFT,
318 OSD_ALIGN_RIGHT
319 } osd_alignment_e;
321 typedef enum {
322 OSD_AHI_STYLE_DEFAULT,
323 OSD_AHI_STYLE_LINE,
324 } osd_ahi_style_e;
326 typedef enum {
327 OSD_CRSF_LQ_TYPE1,
328 OSD_CRSF_LQ_TYPE2,
329 OSD_CRSF_LQ_TYPE3
330 } osd_crsf_lq_format_e;
332 typedef struct osdLayoutsConfig_s {
333 // Layouts
334 uint16_t item_pos[OSD_LAYOUT_COUNT][OSD_ITEM_COUNT];
335 } osdLayoutsConfig_t;
337 PG_DECLARE(osdLayoutsConfig_t, osdLayoutsConfig);
339 #define OSD_SWITCH_INDICATOR_NAME_LENGTH 4
341 typedef struct osdConfig_s {
342 // Alarms
343 uint8_t rssi_alarm; // rssi %
344 uint16_t time_alarm; // fly minutes
345 uint16_t alt_alarm; // positive altitude in m
346 uint16_t dist_alarm; // home distance in m
347 uint16_t neg_alt_alarm; // abs(negative altitude) in m
348 uint8_t current_alarm; // current consumption in A
349 int16_t imu_temp_alarm_min;
350 int16_t imu_temp_alarm_max;
351 int16_t esc_temp_alarm_min;
352 int16_t esc_temp_alarm_max;
353 float gforce_alarm;
354 float gforce_axis_alarm_min;
355 float gforce_axis_alarm_max;
356 #ifdef USE_SERIALRX_CRSF
357 int8_t snr_alarm; //CRSF SNR alarm in dB
358 int8_t link_quality_alarm;
359 int16_t rssi_dbm_alarm; // in dBm
360 int16_t rssi_dbm_max; // Perfect RSSI. Set to High end of curve. RSSI at 100%
361 int16_t rssi_dbm_min; // Worst RSSI. Set to low end of curve or RX sensitivity level. RSSI at 0%
362 #endif
363 #ifdef USE_BARO
364 int16_t baro_temp_alarm_min;
365 int16_t baro_temp_alarm_max;
366 #endif
367 #ifdef USE_TEMPERATURE_SENSOR
368 osd_alignment_e temp_label_align;
369 #endif
370 #ifdef USE_PITOT
371 float airspeed_alarm_min;
372 float airspeed_alarm_max;
373 #endif
375 videoSystem_e video_system;
376 uint8_t row_shiftdown;
377 int16_t msp_displayport_fullframe_interval;
379 // Preferences
380 uint8_t main_voltage_decimals;
381 uint8_t ahi_reverse_roll;
382 uint8_t ahi_max_pitch;
383 uint8_t crosshairs_style; // from osd_crosshairs_style_e
384 int8_t horizon_offset;
385 int8_t camera_uptilt;
386 bool ahi_camera_uptilt_comp;
387 uint8_t camera_fov_h;
388 uint8_t camera_fov_v;
389 uint8_t hud_margin_h;
390 uint8_t hud_margin_v;
391 bool hud_homing;
392 bool hud_homepoint;
393 uint8_t hud_radar_disp;
394 uint16_t hud_radar_range_min;
395 uint16_t hud_radar_range_max;
396 uint8_t hud_radar_alt_difference_display_time;
397 uint8_t hud_radar_distance_display_time;
398 uint8_t hud_wp_disp;
400 uint8_t left_sidebar_scroll; // from osd_sidebar_scroll_e
401 uint8_t right_sidebar_scroll; // from osd_sidebar_scroll_e
402 uint8_t sidebar_scroll_arrows;
404 uint8_t units; // from osd_unit_e
405 uint8_t stats_energy_unit; // from osd_stats_energy_unit_e
406 uint8_t stats_min_voltage_unit; // from osd_stats_min_voltage_unit_e
407 uint8_t stats_page_auto_swap_time; // stats page auto swap interval time (seconds)
409 #ifdef USE_WIND_ESTIMATOR
410 bool estimations_wind_compensation; // use wind compensation for estimated remaining flight/distance
411 #endif
413 uint8_t coordinate_digits;
415 bool osd_failsafe_switch_layout;
416 uint8_t plus_code_digits; // Number of digits to use in OSD_PLUS_CODE
417 uint8_t plus_code_short;
418 uint8_t ahi_style;
419 uint8_t force_grid; // Force a pixel based OSD to use grid mode.
420 uint8_t ahi_bordered; // Only used by the AHI widget
421 uint8_t ahi_width; // In pixels, only used by the AHI widget
422 uint8_t ahi_height; // In pixels, only used by the AHI widget
423 int8_t ahi_vertical_offset; // Offset from center in pixels. Positive moves the AHI down. Widget only.
424 int8_t sidebar_horizontal_offset; // Horizontal offset from default position. Units are grid slots for grid OSDs, pixels for pixel based OSDs. Positive values move sidebars closer to the edges.
425 uint8_t left_sidebar_scroll_step; // How many units each sidebar step represents. 0 means the default value for the scroll type.
426 uint8_t right_sidebar_scroll_step; // Same as left_sidebar_scroll_step, but for the right sidebar.
427 bool osd_home_position_arm_screen;
428 uint8_t pan_servo_index; // Index of the pan servo used for home direction offset
429 int8_t pan_servo_pwm2centideg; // Centidegrees of servo rotation per us pwm
430 uint8_t crsf_lq_format;
431 uint8_t sidebar_height; // sidebar height in rows, 0 turns off sidebars leaving only level indicator arrows
432 uint8_t telemetry; // use telemetry on displayed pixel line 0
433 uint8_t esc_rpm_precision; // Number of characters used for the RPM numbers.
434 uint16_t system_msg_display_time; // system message display time for multiple messages (ms)
435 uint8_t mAh_used_precision; // Number of numbers used for mAh drawn. Plently of packs now are > 9999 mAh
436 uint8_t ahi_pitch_interval; // redraws AHI at set pitch interval (Not pixel OSD)
437 char osd_switch_indicator0_name[OSD_SWITCH_INDICATOR_NAME_LENGTH + 1]; // Name to use for switch indicator 0.
438 uint8_t osd_switch_indicator0_channel; // RC Channel to use for switch indicator 0.
439 char osd_switch_indicator1_name[OSD_SWITCH_INDICATOR_NAME_LENGTH + 1]; // Name to use for switch indicator 1.
440 uint8_t osd_switch_indicator1_channel; // RC Channel to use for switch indicator 1.
441 char osd_switch_indicator2_name[OSD_SWITCH_INDICATOR_NAME_LENGTH + 1]; // Name to use for switch indicator 2.
442 uint8_t osd_switch_indicator2_channel; // RC Channel to use for switch indicator 2.
443 char osd_switch_indicator3_name[OSD_SWITCH_INDICATOR_NAME_LENGTH + 1]; // Name to use for switch indicator 3.
444 uint8_t osd_switch_indicator3_channel; // RC Channel to use for switch indicator 3.
445 bool osd_switch_indicators_align_left; // Align switch indicator name to left of the switch.
446 } osdConfig_t;
448 PG_DECLARE(osdConfig_t, osdConfig);
450 typedef struct displayPort_s displayPort_t;
451 typedef struct displayCanvas_s displayCanvas_t;
453 void osdInit(displayPort_t *osdDisplayPort);
454 bool osdDisplayIsPAL(void);
455 void osdUpdate(timeUs_t currentTimeUs);
456 void osdStartFullRedraw(void);
457 // Sets a fixed OSD layout ignoring the RC input. Set it
458 // to -1 to disable the override. If layout is >= 0 and
459 // duration is > 0, the override is automatically cleared by
460 // the OSD after the given duration. Otherwise, the caller must
461 // explicitely remove it.
462 void osdOverrideLayout(int layout, timeMs_t duration);
463 // Returns the current current layout as well as wether its
464 // set by the user configuration (modes, etc..) or by overriding it.
465 int osdGetActiveLayout(bool *overridden);
466 bool osdItemIsFixed(osd_items_e item);
467 uint8_t osdIncElementIndex(uint8_t elementIndex);
469 displayPort_t *osdGetDisplayPort(void);
470 displayCanvas_t *osdGetDisplayPortCanvas(void);
472 int16_t osdGetHeading(void);
473 int32_t osdGetAltitude(void);
475 void osdStartedSaveProcess(void);
476 void osdShowEEPROMSavedNotification(void);
478 void osdCrosshairPosition(uint8_t *x, uint8_t *y);
479 bool osdFormatCentiNumber(char *buff, int32_t centivalue, uint32_t scale, int maxDecimals, int maxScaledDecimals, int length);
480 void osdFormatAltitudeSymbol(char *buff, int32_t alt);
481 void osdFormatVelocityStr(char* buff, int32_t vel, bool _3D, bool _max);
482 // Returns a heading angle in degrees normalized to [0, 360).
483 int osdGetHeadingAngle(int angle);
486 * @brief Get the OSD system message
487 * @param buff pointer to the message buffer
488 * @param buff_size size of the buffer array
489 * @param isCenteredText if true, centered text based on buff_size
490 * @return osd text attributes (Blink, Inverted, Solid)
492 textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenteredText);