mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Added visual beeper to OSD.
This commit is contained in:
parent
71958b6732
commit
41668fa702
4 changed files with 27 additions and 19 deletions
|
@ -137,7 +137,7 @@ OSD_Entry menuOsdActiveElemsEntries[] =
|
||||||
{"YAW PID", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_YAW_PIDS], 0},
|
{"YAW PID", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_YAW_PIDS], 0},
|
||||||
{"PROFILES", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PIDRATE_PROFILE], 0},
|
{"PROFILES", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PIDRATE_PROFILE], 0},
|
||||||
{"DEBUG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DEBUG], 0},
|
{"DEBUG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DEBUG], 0},
|
||||||
{"BATT WARN", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_MAIN_BATT_WARNING], 0},
|
{"WARNINGS", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_WARNINGS], 0},
|
||||||
{"DISARMED", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DISARMED], 0},
|
{"DISARMED", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DISARMED], 0},
|
||||||
{"PIT ANG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PITCH_ANGLE], 0},
|
{"PIT ANG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PITCH_ANGLE], 0},
|
||||||
{"ROL ANG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ROLL_ANGLE], 0},
|
{"ROL ANG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ROLL_ANGLE], 0},
|
||||||
|
|
|
@ -652,7 +652,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_debug_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_DEBUG]) },
|
{ "osd_debug_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_DEBUG]) },
|
||||||
{ "osd_power_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_POWER]) },
|
{ "osd_power_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_POWER]) },
|
||||||
{ "osd_pidrate_profile_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PIDRATE_PROFILE]) },
|
{ "osd_pidrate_profile_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PIDRATE_PROFILE]) },
|
||||||
{ "osd_battery_warning_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MAIN_BATT_WARNING]) },
|
{ "osd_warnings_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_WARNINGS]) },
|
||||||
{ "osd_avg_cell_voltage_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_AVG_CELL_VOLTAGE]) },
|
{ "osd_avg_cell_voltage_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_AVG_CELL_VOLTAGE]) },
|
||||||
{ "osd_pit_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PITCH_ANGLE]) },
|
{ "osd_pit_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PITCH_ANGLE]) },
|
||||||
{ "osd_rol_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ROLL_ANGLE]) },
|
{ "osd_rol_ang_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_ROLL_ANGLE]) },
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include "drivers/vtx_common.h"
|
#include "drivers/vtx_common.h"
|
||||||
|
|
||||||
#include "io/asyncfatfs/asyncfatfs.h"
|
#include "io/asyncfatfs/asyncfatfs.h"
|
||||||
|
#include "io/beeper.h"
|
||||||
#include "io/flashfs.h"
|
#include "io/flashfs.h"
|
||||||
#include "io/gps.h"
|
#include "io/gps.h"
|
||||||
#include "io/osd.h"
|
#include "io/osd.h"
|
||||||
|
@ -95,7 +96,8 @@
|
||||||
|
|
||||||
// Blink control
|
// Blink control
|
||||||
|
|
||||||
bool blinkState = true;
|
static bool blinkState = true;
|
||||||
|
static bool showVisualBeeper = false;
|
||||||
|
|
||||||
static uint32_t blinkBits[(OSD_ITEM_COUNT + 31)/32];
|
static uint32_t blinkBits[(OSD_ITEM_COUNT + 31)/32];
|
||||||
#define SET_BLINK(item) (blinkBits[(item) / 32] |= (1 << ((item) % 32)))
|
#define SET_BLINK(item) (blinkBits[(item) / 32] |= (1 << ((item) % 32)))
|
||||||
|
@ -518,7 +520,7 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OSD_MAIN_BATT_WARNING:
|
case OSD_WARNINGS:
|
||||||
switch(getBatteryState()) {
|
switch(getBatteryState()) {
|
||||||
case BATTERY_WARNING:
|
case BATTERY_WARNING:
|
||||||
tfp_sprintf(buff, "LOW BATTERY");
|
tfp_sprintf(buff, "LOW BATTERY");
|
||||||
|
@ -529,7 +531,13 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
if (showVisualBeeper) {
|
||||||
|
tfp_sprintf(buff, " * * * *");
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -613,7 +621,7 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
displayWrite(osdDisplayPort, elemPosX + elemOffsetX, elemPosY, buff);
|
displayWrite(osdDisplayPort, elemPosX + elemOffsetX, elemPosY, buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void osdDrawElements(void)
|
static void osdDrawElements(void)
|
||||||
{
|
{
|
||||||
displayClearScreen(osdDisplayPort);
|
displayClearScreen(osdDisplayPort);
|
||||||
|
|
||||||
|
@ -621,13 +629,6 @@ void osdDrawElements(void)
|
||||||
if (IS_RC_MODE_ACTIVE(BOXOSD))
|
if (IS_RC_MODE_ACTIVE(BOXOSD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (currentElement)
|
|
||||||
osdDrawElementPositioningHelp();
|
|
||||||
#else
|
|
||||||
if (false)
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
#ifdef CMS
|
#ifdef CMS
|
||||||
else if (sensors(SENSOR_ACC) || displayIsGrabbed(osdDisplayPort))
|
else if (sensors(SENSOR_ACC) || displayIsGrabbed(osdDisplayPort))
|
||||||
#else
|
#else
|
||||||
|
@ -654,7 +655,7 @@ void osdDrawElements(void)
|
||||||
osdDrawSingleElement(OSD_YAW_PIDS);
|
osdDrawSingleElement(OSD_YAW_PIDS);
|
||||||
osdDrawSingleElement(OSD_POWER);
|
osdDrawSingleElement(OSD_POWER);
|
||||||
osdDrawSingleElement(OSD_PIDRATE_PROFILE);
|
osdDrawSingleElement(OSD_PIDRATE_PROFILE);
|
||||||
osdDrawSingleElement(OSD_MAIN_BATT_WARNING);
|
osdDrawSingleElement(OSD_WARNINGS);
|
||||||
osdDrawSingleElement(OSD_AVG_CELL_VOLTAGE);
|
osdDrawSingleElement(OSD_AVG_CELL_VOLTAGE);
|
||||||
osdDrawSingleElement(OSD_DEBUG);
|
osdDrawSingleElement(OSD_DEBUG);
|
||||||
osdDrawSingleElement(OSD_PITCH_ANGLE);
|
osdDrawSingleElement(OSD_PITCH_ANGLE);
|
||||||
|
@ -706,7 +707,7 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
||||||
osdConfig->item_pos[OSD_YAW_PIDS] = OSD_POS(7, 15) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_YAW_PIDS] = OSD_POS(7, 15) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_POWER] = OSD_POS(1, 10) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_POWER] = OSD_POS(1, 10) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_PIDRATE_PROFILE] = OSD_POS(25, 10) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_PIDRATE_PROFILE] = OSD_POS(25, 10) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_MAIN_BATT_WARNING] = OSD_POS(9, 10) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_WARNINGS] = OSD_POS(9, 10) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_AVG_CELL_VOLTAGE] = OSD_POS(12, 2) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_AVG_CELL_VOLTAGE] = OSD_POS(12, 2) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_DEBUG] = OSD_POS(1, 0) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_DEBUG] = OSD_POS(1, 0) | VISIBLE_FLAG;
|
||||||
osdConfig->item_pos[OSD_PITCH_ANGLE] = OSD_POS(1, 8) | VISIBLE_FLAG;
|
osdConfig->item_pos[OSD_PITCH_ANGLE] = OSD_POS(1, 8) | VISIBLE_FLAG;
|
||||||
|
@ -802,12 +803,12 @@ void osdUpdateAlarms(void)
|
||||||
CLR_BLINK(OSD_RSSI_VALUE);
|
CLR_BLINK(OSD_RSSI_VALUE);
|
||||||
|
|
||||||
if (getBatteryState() == BATTERY_OK) {
|
if (getBatteryState() == BATTERY_OK) {
|
||||||
|
CLR_BLINK(OSD_WARNINGS);
|
||||||
CLR_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
CLR_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
||||||
CLR_BLINK(OSD_MAIN_BATT_WARNING);
|
|
||||||
CLR_BLINK(OSD_AVG_CELL_VOLTAGE);
|
CLR_BLINK(OSD_AVG_CELL_VOLTAGE);
|
||||||
} else {
|
} else {
|
||||||
|
SET_BLINK(OSD_WARNINGS);
|
||||||
SET_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
SET_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
||||||
SET_BLINK(OSD_MAIN_BATT_WARNING);
|
|
||||||
SET_BLINK(OSD_AVG_CELL_VOLTAGE);
|
SET_BLINK(OSD_AVG_CELL_VOLTAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,7 +840,7 @@ void osdResetAlarms(void)
|
||||||
{
|
{
|
||||||
CLR_BLINK(OSD_RSSI_VALUE);
|
CLR_BLINK(OSD_RSSI_VALUE);
|
||||||
CLR_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
CLR_BLINK(OSD_MAIN_BATT_VOLTAGE);
|
||||||
CLR_BLINK(OSD_MAIN_BATT_WARNING);
|
CLR_BLINK(OSD_WARNINGS);
|
||||||
CLR_BLINK(OSD_GPS_SATS);
|
CLR_BLINK(OSD_GPS_SATS);
|
||||||
CLR_BLINK(OSD_FLYTIME);
|
CLR_BLINK(OSD_FLYTIME);
|
||||||
CLR_BLINK(OSD_MAH_DRAWN);
|
CLR_BLINK(OSD_MAH_DRAWN);
|
||||||
|
@ -1083,6 +1084,11 @@ static void osdRefresh(timeUs_t currentTimeUs)
|
||||||
void osdUpdate(timeUs_t currentTimeUs)
|
void osdUpdate(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
static uint32_t counter = 0;
|
static uint32_t counter = 0;
|
||||||
|
|
||||||
|
if (isBeeperOn()) {
|
||||||
|
showVisualBeeper = true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MAX7456_DMA_CHANNEL_TX
|
#ifdef MAX7456_DMA_CHANNEL_TX
|
||||||
// don't touch buffers if DMA transaction is in progress
|
// don't touch buffers if DMA transaction is in progress
|
||||||
if (displayIsTransferInProgress(osdDisplayPort)) {
|
if (displayIsTransferInProgress(osdDisplayPort)) {
|
||||||
|
@ -1108,6 +1114,8 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
if (counter++ % DRAW_FREQ_DENOM == 0) {
|
if (counter++ % DRAW_FREQ_DENOM == 0) {
|
||||||
osdRefresh(currentTimeUs);
|
osdRefresh(currentTimeUs);
|
||||||
|
|
||||||
|
showVisualBeeper = false;
|
||||||
} else { // rest of time redraw screen 10 chars per idle so it doesn't lock the main idle
|
} else { // rest of time redraw screen 10 chars per idle so it doesn't lock the main idle
|
||||||
displayDrawScreen(osdDisplayPort);
|
displayDrawScreen(osdDisplayPort);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef enum {
|
||||||
OSD_YAW_PIDS,
|
OSD_YAW_PIDS,
|
||||||
OSD_POWER,
|
OSD_POWER,
|
||||||
OSD_PIDRATE_PROFILE,
|
OSD_PIDRATE_PROFILE,
|
||||||
OSD_MAIN_BATT_WARNING,
|
OSD_WARNINGS,
|
||||||
OSD_AVG_CELL_VOLTAGE,
|
OSD_AVG_CELL_VOLTAGE,
|
||||||
OSD_GPS_LON,
|
OSD_GPS_LON,
|
||||||
OSD_GPS_LAT,
|
OSD_GPS_LAT,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue