chore(radio): Cleanup startup code, fix throttle warning led color, startup haptic option (#4027)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "keys.h"
|
||||
#include "common/stdlcd/menus.h"
|
||||
#include "common/stdlcd/features.h"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
|
||||
@@ -38,13 +38,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
|
||||
static int viewpage = ANAVIEW_FIRST;
|
||||
|
||||
// TODO enum
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
#define ANAS_ITEMS_COUNT 3
|
||||
#else
|
||||
#define ANAS_ITEMS_COUNT 1
|
||||
#endif
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_BREAK(KEY_PAGEDN):
|
||||
@@ -74,11 +67,11 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
switch (viewpage) {
|
||||
case (ANAVIEW_CALIB):
|
||||
SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_CALIB,
|
||||
HEADER_LINE+ANAS_ITEMS_COUNT);
|
||||
HEADER_LINE+1);
|
||||
break;
|
||||
case (ANAVIEW_RAWLOWFPS):
|
||||
SIMPLE_SUBMENU(STR_MENU_RADIO_ANALOGS_RAWLOWFPS,
|
||||
HEADER_LINE+ANAS_ITEMS_COUNT);
|
||||
HEADER_LINE+1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,6 @@ const unsigned char sticks[] = {
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, nullptr, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
|
||||
#if defined(SPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
#else
|
||||
#define CASE_SPLASH_PARAM(x)
|
||||
#endif
|
||||
|
||||
#if defined(BATTGRAPH)
|
||||
#define CASE_BATTGRAPH(x) x,
|
||||
#else
|
||||
@@ -83,7 +77,6 @@ enum {
|
||||
CASE_IMU(ITEM_RADIO_SETUP_IMU_OFFSET)
|
||||
ITEM_RADIO_SETUP_ALARMS_LABEL,
|
||||
ITEM_RADIO_SETUP_BATTERY_WARNING,
|
||||
CASE_CAPACITY(ITEM_RADIO_SETUP_CAPACITY_WARNING)
|
||||
ITEM_RADIO_SETUP_INACTIVITY_ALARM,
|
||||
ITEM_RADIO_SETUP_MEMORY_WARNING,
|
||||
ITEM_RADIO_SETUP_ALARM_WARNING,
|
||||
@@ -188,7 +181,7 @@ void menuRadioSetup(event_t event)
|
||||
CASE_IMU(LABEL(IMU))
|
||||
CASE_IMU(0)
|
||||
CASE_IMU(0)
|
||||
LABEL(ALARMS), 0, CASE_CAPACITY(0)
|
||||
LABEL(ALARMS), 0,
|
||||
0, 0, 0, 0, /* ITEM_RADIO_SETUP_INACTIVITY_ALARM ITEM_RADIO_SETUP_MEMORY_WARNING ITEM_RADIO_SETUP_ALARM_WARNING ITEM_RADIO_SETUP_RSSI_POWEROFF_ALARM */
|
||||
CASE_BACKLIGHT(LABEL(BACKLIGHT))
|
||||
CASE_BACKLIGHT(0)
|
||||
@@ -526,14 +519,6 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
case ITEM_RADIO_SETUP_CAPACITY_WARNING:
|
||||
lcdDrawTextAlignedLeft(y, STR_CAPAWARNING);
|
||||
drawValueWithUnit(LCD_W-2, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|RIGHT) ;
|
||||
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.mAhWarn, 0, 100);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_RADIO_SETUP_INACTIVITY_ALARM:
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_INACTIVITYALARM);
|
||||
lcdDrawNumber(LCD_W-7, y, g_eeGeneral.inactivityTimer, attr|RIGHT);
|
||||
@@ -588,7 +573,6 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH)
|
||||
case ITEM_RADIO_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
@@ -602,7 +586,6 @@ void menuRadioSetup(event_t event)
|
||||
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case ITEM_RADIO_SETUP_START_SOUND:
|
||||
lcdDrawTextAlignedLeft(y, STR_PLAY_HELLO);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(SPLASH)
|
||||
const unsigned char splashdata[] = {
|
||||
'S','P','S',0,
|
||||
#include "bitmaps/128x64/splash.lbm"
|
||||
@@ -35,4 +34,3 @@ void drawSplash()
|
||||
lcdDraw1bitBitmap(0, 0, splash_lbm, 0, 0);
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -169,25 +169,8 @@ void menuStatisticsDebug(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
uint8_t y = FH + 1;
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
// current
|
||||
lcdDrawTextAlignedLeft(y, STR_CPU_CURRENT);
|
||||
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, getCurrent(), UNIT_MILLIAMPS, LEFT);
|
||||
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration;
|
||||
lcdDrawChar(MENU_DEBUG_COL2_OFS, y, '>');
|
||||
drawValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, y, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
|
||||
y += FH;
|
||||
|
||||
// consumption
|
||||
lcdDrawTextAlignedLeft(y, STR_CPU_MAH);
|
||||
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1);
|
||||
y += FH;
|
||||
#endif
|
||||
|
||||
|
||||
lcdDrawTextAlignedLeft(y, STR_FREE_MEM_LABEL);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, availableMemory(), LEFT);
|
||||
lcdDrawText(lcdLastRightPos+FW, y, STR_BYTES);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "keys.h"
|
||||
#include "common/stdlcd/menus.h"
|
||||
#include "common/stdlcd/features.h"
|
||||
|
||||
inline bool isRadioMenuDisplayed()
|
||||
{
|
||||
|
||||
@@ -41,12 +41,6 @@ const unsigned char sticks[] = {
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, nullptr, nullptr, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
|
||||
#if defined(SPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
#else
|
||||
#define CASE_SPLASH_PARAM(x)
|
||||
#endif
|
||||
|
||||
enum MenuRadioSetupItems {
|
||||
CASE_RTCLOCK(ITEM_RADIO_SETUP_DATE)
|
||||
CASE_RTCLOCK(ITEM_RADIO_SETUP_TIME)
|
||||
@@ -535,7 +529,6 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH)
|
||||
case ITEM_RADIO_SETUP_DISABLE_SPLASH:
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
if (SPLASH_NEEDED()) {
|
||||
@@ -547,7 +540,6 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_RADIO_SETUP_START_SOUND:
|
||||
lcdDrawTextAlignedLeft(y, STR_PLAY_HELLO);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(SPLASH)
|
||||
#define MAXIMUM_SPLASH_IMAGE_SIZE 3072
|
||||
const struct {
|
||||
const uint8_t __magic_prefix[4] = { 'S','P','S',0 };
|
||||
@@ -39,4 +38,3 @@ void drawSplash()
|
||||
lcdDrawRleBitmap(0, 0, splash_lbm);
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -49,36 +49,63 @@ FullScreenDialog::FullScreenDialog(
|
||||
|
||||
bringToTop();
|
||||
|
||||
init();
|
||||
build();
|
||||
|
||||
lv_obj_add_event_cb(lvobj, FullScreenDialog::long_pressed, LV_EVENT_LONG_PRESSED, nullptr);
|
||||
lv_obj_add_event_cb(lvobj, FullScreenDialog::on_draw, LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
}
|
||||
|
||||
void FullScreenDialog::init()
|
||||
void FullScreenDialog::on_draw(lv_event_t* e)
|
||||
{
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
|
||||
std::string t;
|
||||
if (type == WARNING_TYPE_ALERT) {
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
|
||||
t = std::string(STR_WARNING) + "\n" + title;
|
||||
#else
|
||||
t = title + "\n" + STR_WARNING;
|
||||
#endif
|
||||
} else if (!title.empty()) {
|
||||
t = title;
|
||||
auto dlg = (FullScreenDialog*)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (dlg) {
|
||||
if (!dlg->loaded) {
|
||||
dlg->loaded = true;
|
||||
dlg->delayedInit();
|
||||
}
|
||||
new StaticText(this,
|
||||
rect_t{ALERT_TITLE_LEFT, ALERT_TITLE_TOP, LCD_W - ALERT_TITLE_LEFT - PAGE_PADDING, LCD_H - ALERT_TITLE_TOP - PAGE_PADDING},
|
||||
t.c_str(), 0, COLOR_THEME_WARNING | FONT(XL));
|
||||
}
|
||||
}
|
||||
|
||||
messageLabel = new StaticText(this,
|
||||
rect_t{ALERT_MESSAGE_LEFT, ALERT_MESSAGE_TOP, LCD_W - ALERT_MESSAGE_LEFT - PAGE_PADDING, LCD_H - ALERT_MESSAGE_TOP - PAGE_PADDING},
|
||||
message.c_str(), 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
void FullScreenDialog::build()
|
||||
{
|
||||
std::string t;
|
||||
if (type == WARNING_TYPE_ALERT) {
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
|
||||
t = std::string(STR_WARNING) + "\n" + title;
|
||||
#else
|
||||
t = title + "\n" + STR_WARNING;
|
||||
#endif
|
||||
} else if (!title.empty()) {
|
||||
t = title;
|
||||
}
|
||||
new StaticText(this,
|
||||
rect_t{ALERT_TITLE_LEFT, ALERT_TITLE_TOP, LCD_W - ALERT_TITLE_LEFT - PAGE_PADDING, LCD_H - ALERT_TITLE_TOP - PAGE_PADDING},
|
||||
t.c_str(), 0, COLOR_THEME_WARNING | FONT(XL));
|
||||
|
||||
if (!action.empty()) {
|
||||
auto btn = new TextButton(this, { (LCD_W - 280) / 2, LCD_H - 48, 280, 40 }, action.c_str(),
|
||||
messageLabel = new StaticText(this,
|
||||
rect_t{ALERT_MESSAGE_LEFT, ALERT_MESSAGE_TOP, LCD_W - ALERT_MESSAGE_LEFT - PAGE_PADDING, LCD_H - ALERT_MESSAGE_TOP - PAGE_PADDING},
|
||||
message.c_str(), 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
|
||||
if (!action.empty()) {
|
||||
auto btn = new TextButton(this, { (LCD_W - 280) / 2, LCD_H - 48, 280, 40 }, action.c_str(),
|
||||
[=]() {
|
||||
closeDialog();
|
||||
return 0;
|
||||
}, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
lv_obj_set_style_bg_color(btn->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||
lv_obj_set_style_bg_opa(btn->getLvObj(), LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(btn->getLvObj(), makeLvColor(COLOR_THEME_PRIMARY1), 0);
|
||||
} else {
|
||||
if (type == WARNING_TYPE_CONFIRM) {
|
||||
auto btn = new TextButton(this, { LCD_W / 3 - 50, LCD_H - 48, 100, 40 }, STR_EXIT,
|
||||
[=]() {
|
||||
deleteLater();
|
||||
return 0;
|
||||
}, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
lv_obj_set_style_bg_color(btn->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||
lv_obj_set_style_bg_opa(btn->getLvObj(), LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(btn->getLvObj(), makeLvColor(COLOR_THEME_PRIMARY1), 0);
|
||||
btn = new TextButton(this, { LCD_W * 2 / 3 - 50, LCD_H - 48, 100, 40 }, STR_OK,
|
||||
[=]() {
|
||||
closeDialog();
|
||||
return 0;
|
||||
@@ -86,25 +113,6 @@ void FullScreenDialog::init()
|
||||
lv_obj_set_style_bg_color(btn->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||
lv_obj_set_style_bg_opa(btn->getLvObj(), LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(btn->getLvObj(), makeLvColor(COLOR_THEME_PRIMARY1), 0);
|
||||
} else {
|
||||
if (type == WARNING_TYPE_CONFIRM) {
|
||||
auto btn = new TextButton(this, { LCD_W / 3 - 50, LCD_H - 48, 100, 40 }, STR_EXIT,
|
||||
[=]() {
|
||||
deleteLater();
|
||||
return 0;
|
||||
}, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
lv_obj_set_style_bg_color(btn->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||
lv_obj_set_style_bg_opa(btn->getLvObj(), LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(btn->getLvObj(), makeLvColor(COLOR_THEME_PRIMARY1), 0);
|
||||
btn = new TextButton(this, { LCD_W * 2 / 3 - 50, LCD_H - 48, 100, 40 }, STR_OK,
|
||||
[=]() {
|
||||
closeDialog();
|
||||
return 0;
|
||||
}, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
lv_obj_set_style_bg_color(btn->getLvObj(), makeLvColor(COLOR_THEME_SECONDARY3), 0);
|
||||
lv_obj_set_style_bg_opa(btn->getLvObj(), LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_color(btn->getLvObj(), makeLvColor(COLOR_THEME_PRIMARY1), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,11 @@ class FullScreenDialog : public Window
|
||||
bool loaded = false;
|
||||
StaticText* messageLabel;
|
||||
|
||||
virtual void init();
|
||||
virtual void delayedInit() {}
|
||||
void build();
|
||||
|
||||
static void long_pressed(lv_event_t* e);
|
||||
static void on_draw(lv_event_t* e);
|
||||
};
|
||||
|
||||
#endif // _FULLSCREEN_DIALOG_H_
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#if defined(SPLASH)
|
||||
#include "opentx.h"
|
||||
#include "inactivity_timer.h"
|
||||
#include "stamp.h"
|
||||
|
||||
extern void checkSpeakerVolume();
|
||||
|
||||
#include "opentx.h"
|
||||
#include "stamp.h"
|
||||
@@ -125,4 +129,49 @@ void drawSplash()
|
||||
|
||||
MainWindow::instance()->setActiveScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
static tmr10ms_t splashStartTime = 0;
|
||||
|
||||
void startSplash()
|
||||
{
|
||||
if (!UNEXPECTED_SHUTDOWN()) {
|
||||
splashStartTime = get_tmr10ms();
|
||||
drawSplash();
|
||||
}
|
||||
}
|
||||
|
||||
void waitSplash()
|
||||
{
|
||||
// Handle color splash screen
|
||||
if (splashStartTime) {
|
||||
|
||||
#if defined(SIMU)
|
||||
// Simulator - inputsMoved() returns true immediately without this!
|
||||
RTOS_WAIT_TICKS(30);
|
||||
#endif // defined(SIMU)
|
||||
|
||||
splashStartTime += SPLASH_TIMEOUT;
|
||||
while (splashStartTime > get_tmr10ms()) {
|
||||
WDG_RESET();
|
||||
checkSpeakerVolume();
|
||||
checkBacklight();
|
||||
RTOS_WAIT_TICKS(10);
|
||||
auto evt = getEvent();
|
||||
if (evt || inactivityCheckInputs()) {
|
||||
if (evt)
|
||||
killEvents(evt);
|
||||
break;
|
||||
}
|
||||
#if defined(SIMU)
|
||||
// Allow simulator to exit if closed while splash showing
|
||||
uint32_t pwr_check = pwrCheck();
|
||||
if (pwr_check == e_power_off) {
|
||||
break;
|
||||
}
|
||||
#endif // defined(SIMU)
|
||||
}
|
||||
|
||||
// Reset timer so special/global functions set to !1x don't get triggered
|
||||
START_SILENCE_PERIOD();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,33 +26,30 @@ SwitchWarnDialog::SwitchWarnDialog() :
|
||||
FullScreenDialog(WARNING_TYPE_ALERT, STR_SWITCHWARN, "", STR_PRESS_ANY_KEY_TO_SKIP)
|
||||
{
|
||||
last_bad_switches = 0xff;
|
||||
bad_pots = 0;
|
||||
last_bad_pots = 0x0;
|
||||
setCloseCondition(std::bind(&SwitchWarnDialog::warningInactive, this));
|
||||
}
|
||||
|
||||
void SwitchWarnDialog::init()
|
||||
void SwitchWarnDialog::delayedInit()
|
||||
{
|
||||
if (!loaded) {
|
||||
FullScreenDialog::init();
|
||||
lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_DOT);
|
||||
}
|
||||
lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_DOT);
|
||||
AUDIO_ERROR_MESSAGE(AU_SWITCH_ALERT);
|
||||
}
|
||||
|
||||
bool SwitchWarnDialog::warningInactive()
|
||||
{
|
||||
uint16_t bad_pots;
|
||||
|
||||
if (!isSwitchWarningRequired(bad_pots))
|
||||
return true;
|
||||
|
||||
if (last_bad_switches != switches_states || last_bad_pots != bad_pots) {
|
||||
// Redraw to update list of switches that need attention
|
||||
invalidate();
|
||||
if (last_bad_switches == 0xff || last_bad_pots & 0x7ff) {
|
||||
AUDIO_ERROR_MESSAGE(AU_SWITCH_ALERT);
|
||||
}
|
||||
}
|
||||
|
||||
last_bad_pots = bad_pots;
|
||||
last_bad_switches = switches_states;
|
||||
last_bad_pots = bad_pots;
|
||||
last_bad_switches = switches_states;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -61,14 +58,6 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc)
|
||||
{
|
||||
if (!running) return;
|
||||
FullScreenDialog::paint(dc);
|
||||
}
|
||||
|
||||
void SwitchWarnDialog::checkEvents()
|
||||
{
|
||||
if (!running) return;
|
||||
|
||||
FullScreenDialog::checkEvents();
|
||||
if (deleted()) return;
|
||||
|
||||
std::string warn_txt;
|
||||
swarnstate_t states = g_model.switchWarningState;
|
||||
@@ -98,3 +87,21 @@ void SwitchWarnDialog::checkEvents()
|
||||
|
||||
messageLabel->setText(warn_txt);
|
||||
}
|
||||
|
||||
ThrottleWarnDialog::ThrottleWarnDialog(const char* msg) :
|
||||
FullScreenDialog(WARNING_TYPE_ALERT, TR_THROTTLE_UPPERCASE, msg, STR_PRESS_ANY_KEY_TO_SKIP)
|
||||
{
|
||||
setCloseCondition(std::bind(&ThrottleWarnDialog::warningInactive, this));
|
||||
}
|
||||
|
||||
void ThrottleWarnDialog::delayedInit()
|
||||
{
|
||||
lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_DOT);
|
||||
AUDIO_ERROR_MESSAGE(AU_THROTTLE_ALERT);
|
||||
}
|
||||
|
||||
bool ThrottleWarnDialog::warningInactive()
|
||||
{
|
||||
extern bool isThrottleWarningAlertNeeded();
|
||||
return !isThrottleWarningAlertNeeded();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _SWITCH_WARN_DIALOG_H_
|
||||
#define _SWITCH_WARN_DIALOG_H_
|
||||
#pragma once
|
||||
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -35,18 +34,28 @@ class SwitchWarnDialog : public FullScreenDialog
|
||||
std::string getName() const override { return "SwitchWarnDialog"; }
|
||||
#endif
|
||||
|
||||
void checkEvents() override;
|
||||
void paint(BitmapBuffer* dc) override;
|
||||
|
||||
protected:
|
||||
swarnstate_t last_bad_switches;
|
||||
uint16_t bad_pots;
|
||||
uint16_t last_bad_pots;
|
||||
StaticText* warn_label;
|
||||
|
||||
bool warningInactive();
|
||||
|
||||
void init() override;
|
||||
void delayedInit() override;
|
||||
};
|
||||
|
||||
class ThrottleWarnDialog : public FullScreenDialog
|
||||
{
|
||||
public:
|
||||
ThrottleWarnDialog(const char* msg);
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "ThrottleWarnDialog"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool warningInactive();
|
||||
|
||||
void delayedInit() override;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ set(GUI_SRC
|
||||
../common/stdlcd/radio_trainer.cpp
|
||||
../common/stdlcd/view_telemetry.cpp
|
||||
../common/stdlcd/calibration.cpp
|
||||
../common/stdlcd/splash.cpp
|
||||
model_curve_edit.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Macros for B&W menus
|
||||
|
||||
#if defined(VARIO)
|
||||
#define CASE_VARIO(x) x,
|
||||
#else
|
||||
#define CASE_VARIO(x)
|
||||
#endif
|
||||
|
||||
#if defined(IMU)
|
||||
#define CASE_IMU(x) x,
|
||||
#else
|
||||
#define CASE_IMU(x)
|
||||
#endif
|
||||
|
||||
#if defined(BACKLIGHT_GPIO)
|
||||
#define CASE_BACKLIGHT(x) x,
|
||||
#else
|
||||
#define CASE_BACKLIGHT(x)
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
#define CASE_RTCLOCK(x) x,
|
||||
#else
|
||||
#define CASE_RTCLOCK(x)
|
||||
#endif
|
||||
|
||||
#if defined(BUZZER)
|
||||
#define CASE_BUZZER(x) x,
|
||||
#else
|
||||
#define CASE_BUZZER(x)
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO)
|
||||
#define CASE_AUDIO(x) x,
|
||||
#else
|
||||
#define CASE_AUDIO(x)
|
||||
#endif
|
||||
|
||||
#if defined(PWM_BACKLIGHT)
|
||||
#define CASE_PWM_BACKLIGHT(x) x,
|
||||
#else
|
||||
#define CASE_PWM_BACKLIGHT(x)
|
||||
#endif
|
||||
|
||||
#if defined(GPS)
|
||||
#define CASE_GPS(x) x,
|
||||
#else
|
||||
#define CASE_GPS(x)
|
||||
#endif
|
||||
|
||||
#if defined(HAPTIC)
|
||||
#define CASE_HAPTIC(x) x,
|
||||
#else
|
||||
#define CASE_HAPTIC(x)
|
||||
#endif
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
#define CASE_PWR_BUTTON_PRESS(x) x,
|
||||
#else
|
||||
#define CASE_PWR_BUTTON_PRESS(x)
|
||||
#endif
|
||||
|
||||
#if defined(PXX1)
|
||||
#define CASE_PXX1(x) x,
|
||||
#else
|
||||
#define CASE_PXX1(x)
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
#define CASE_PXX2(x) x,
|
||||
#else
|
||||
#define CASE_PXX2(x)
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#define CASE_BLUETOOTH(x) x,
|
||||
#else
|
||||
#define CASE_BLUETOOTH(x)
|
||||
#endif
|
||||
|
||||
#if defined(HELI)
|
||||
#define CASE_HELI(x) x,
|
||||
#else
|
||||
#define CASE_HELI(x)
|
||||
#endif
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
#define CASE_FLIGHT_MODES(x) x,
|
||||
#else
|
||||
#define CASE_FLIGHT_MODES(x)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#define CASE_GVARS(x) x,
|
||||
#else
|
||||
#define CASE_GVARS(x)
|
||||
#endif
|
||||
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
#define CASE_LUA_MODEL_SCRIPTS(x) x,
|
||||
#else
|
||||
#define CASE_LUA_MODEL_SCRIPTS(x)
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9DP) || defined(PCBX9E)
|
||||
#define CASE_PCBX9E_PCBX9DP(x) x,
|
||||
#else
|
||||
#define CASE_PCBX9E_PCBX9DP(x)
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
#define CASE_SDCARD(x) x,
|
||||
#else
|
||||
#define CASE_SDCARD(x)
|
||||
#endif
|
||||
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "inactivity_timer.h"
|
||||
|
||||
void startSplash()
|
||||
{
|
||||
}
|
||||
|
||||
void waitSplash()
|
||||
{
|
||||
// Handle B&W splash screen
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
bool refresh = false;
|
||||
#endif
|
||||
|
||||
if (SPLASH_NEEDED()) {
|
||||
resetBacklightTimeout();
|
||||
drawSplash();
|
||||
|
||||
getADC(); // init ADC array
|
||||
|
||||
inactivityCheckInputs();
|
||||
|
||||
tmr10ms_t tgtime = get_tmr10ms() + SPLASH_TIMEOUT;
|
||||
|
||||
while (tgtime > get_tmr10ms()) {
|
||||
RTOS_WAIT_TICKS(1);
|
||||
|
||||
getADC();
|
||||
|
||||
if (getEvent() || inactivityCheckInputs())
|
||||
return;
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
uint32_t pwr_check = pwrCheck();
|
||||
if (pwr_check == e_power_off) {
|
||||
break;
|
||||
}
|
||||
else if (pwr_check == e_power_press) {
|
||||
refresh = true;
|
||||
}
|
||||
else if (pwr_check == e_power_on && refresh) {
|
||||
drawSplash();
|
||||
refresh = false;
|
||||
}
|
||||
#else
|
||||
if (pwrCheck() == e_power_off) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
checkBacklight();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user