1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 07:15:18 +03:00

New stack for OSD with full menus for PIDs etc.

There is a lot of changes and fixes in driver also
This commit is contained in:
Marcin Baliniak 2016-09-18 21:27:09 +02:00
parent 9a5e53d8ae
commit 1e2a961bcd
6 changed files with 1919 additions and 925 deletions

83
src/main/io/osd.h Normal file → Executable file
View file

@ -1,68 +1,47 @@
/*
* 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/>.
*/
#define MAX_MENU_ROWS 8
#define MAX_MENU_COLS 3
typedef struct {
const char* title;
uint8_t x_pos;
} osd_col_t;
typedef struct {
const char* title;
void (*update)(int value_change_direction, uint8_t col);
void (*print)(uint16_t pos, uint8_t col);
} osd_row_t;
typedef struct {
const char* title;
uint8_t cols_number;
uint8_t rows_number;
osd_col_t cols[MAX_MENU_COLS];
osd_row_t rows[MAX_MENU_ROWS];
} osd_page_t;
#pragma once
#include <stdint.h>
typedef enum {
OSD_MAIN_BATT_VOLTAGE,
OSD_RSSI_VALUE,
OSD_TIMER,
OSD_THROTTLE_POS,
OSD_CPU_LOAD,
OSD_VTX_CHANNEL,
OSD_VOLTAGE_WARNING,
OSD_ARMED,
OSD_DISARMED,
OSD_MAIN_BATT_VOLTAGE,
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_CRAFT_NAME,
OSD_GPS_SPEED,
OSD_GPS_SATS,
OSD_MAX_ITEMS, // MUST BE LAST
} osd_items_t;
typedef struct {
// AUTO / PAL / NTSC in VIDEO_TYPES enum
uint8_t video_system;
int16_t item_pos[OSD_MAX_ITEMS];
uint16_t item_pos[OSD_MAX_ITEMS];
//alarms
uint8_t rssi_alarm;
uint16_t cap_alarm;
uint16_t time_alarm;
uint8_t video_system;
} osd_profile;
void updateOsd(void);
typedef struct {
int16_t max_height;
int16_t max_speed;
int16_t min_voltage; // /10
int16_t max_current; // /10
int16_t min_rssi;
} tStatistic;
void osdInit(void);
void OSD_Update(uint8_t guiKey);
void OSD_OpenMenu(void);
void OSD_HandleGui(uint8_t cmd);
void OSD_ResetSettings(void);
void OSD_Message(char *line1, char *line2, uint8_t timeout);
void resetOsdConfig(osd_profile *osdProfile);
void updateOsd(void);