forked from iNavFlight/inav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osd.h
executable file
·125 lines (110 loc) · 3.19 KB
/
osd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/time.h"
#include "config/parameter_group.h"
#define VISIBLE_FLAG 0x0800
#define VISIBLE(x) (x & VISIBLE_FLAG)
#define OSD_POS_MAX 0x3FF
#define OSD_POS_MAX_CLI (OSD_POS_MAX | VISIBLE_FLAG)
typedef enum {
OSD_RSSI_VALUE,
OSD_MAIN_BATT_VOLTAGE,
OSD_CROSSHAIRS,
OSD_ARTIFICIAL_HORIZON,
OSD_HORIZON_SIDEBARS,
OSD_ONTIME,
OSD_FLYTIME,
OSD_FLYMODE,
OSD_CRAFT_NAME,
OSD_THROTTLE_POS,
OSD_VTX_CHANNEL,
OSD_CURRENT_DRAW,
OSD_MAH_DRAWN,
OSD_GPS_SPEED,
OSD_GPS_SATS,
OSD_ALTITUDE,
OSD_ROLL_PIDS,
OSD_PITCH_PIDS,
OSD_YAW_PIDS,
OSD_POWER,
OSD_GPS_LON,
OSD_GPS_LAT,
OSD_HOME_DIR,
OSD_HOME_DIST,
OSD_HEADING,
OSD_VARIO,
OSD_VARIO_NUM,
OSD_AIR_SPEED,
OSD_ONTIME_FLYTIME,
OSD_RTC_TIME,
OSD_MESSAGES,
OSD_GPS_HDOP,
OSD_MAIN_BATT_CELL_VOLTAGE,
OSD_THROTTLE_POS_AUTO_THR,
OSD_HEADING_GRAPH,
OSD_EFFICIENCY_MAH_PER_KM,
OSD_WH_DRAWN,
OSD_BATTERY_REMAINING_CAPACITY,
OSD_BATTERY_REMAINING_PERCENT,
OSD_EFFICIENCY_WH_PER_KM,
OSD_ITEM_COUNT // MUST BE LAST
} osd_items_e;
typedef enum {
OSD_UNIT_IMPERIAL,
OSD_UNIT_METRIC,
OSD_UNIT_UK, // Show speed in mp/h, other values in metric
} osd_unit_e;
typedef enum {
OSD_STATS_ENERGY_UNIT_MAH,
OSD_STATS_ENERGY_UNIT_WH,
} osd_stats_energy_unit_e;
typedef enum {
OSD_CROSSHAIRS_STYLE_DEFAULT,
OSD_CROSSHAIRS_STYLE_AIRCRAFT,
} osd_crosshairs_style_e;
typedef enum {
OSD_SIDEBAR_SCROLL_NONE,
OSD_SIDEBAR_SCROLL_ALTITUDE,
OSD_SIDEBAR_SCROLL_GROUND_SPEED,
OSD_SIDEBAR_SCROLL_HOME_DISTANCE,
} osd_sidebar_scroll_e;
typedef struct osdConfig_s {
uint16_t item_pos[OSD_ITEM_COUNT];
// Alarms
uint8_t rssi_alarm; // rssi %
uint16_t time_alarm; // fly minutes
uint16_t alt_alarm; // positive altitude in m
uint16_t dist_alarm; // home distance in m
uint16_t neg_alt_alarm; // abs(negative altitude) in m
uint8_t video_system;
uint8_t row_shiftdown;
// Preferences
uint8_t main_voltage_decimals;
uint8_t ahi_reverse_roll;
osd_crosshairs_style_e crosshairs_style;
osd_sidebar_scroll_e left_sidebar_scroll;
osd_sidebar_scroll_e right_sidebar_scroll;
uint8_t sidebar_scroll_arrows;
osd_unit_e units;
osd_stats_energy_unit_e stats_energy_unit;
} osdConfig_t;
PG_DECLARE(osdConfig_t, osdConfig);
struct displayPort_s;
void osdInit(struct displayPort_s *osdDisplayPort);
void osdUpdate(timeUs_t currentTimeUs);
void osdStartFullRedraw(void);