feat(color): delay load the built in widgets to improve responsiveness (#6480)
This commit is contained in:
@@ -28,10 +28,6 @@
|
||||
#include "strhelpers.h"
|
||||
#include "switches.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#include "model_audio.h"
|
||||
#include "hal/audio_driver.h"
|
||||
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
#include "os/sleep.h"
|
||||
#include "trainer.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
|
||||
#if defined(LOG_BLUETOOTH)
|
||||
extern FIL g_bluetoothFile;
|
||||
#endif
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
|
||||
#include "edgetx.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
extern int32_t getSourceNumFieldValue(int16_t val, int16_t min, int16_t max);
|
||||
|
||||
constexpr int DEFAULT_POINTS = 5;
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#include "radio_calibration.h"
|
||||
#include "view_main.h"
|
||||
#include "view_text.h"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
#include "view_main.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
LvglWrapper* LvglWrapper::_instance = nullptr;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "bitmaps.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "lz4/lz4.h"
|
||||
#include "edgetx_helpers.h"
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "progress.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "static.h"
|
||||
|
||||
class FilePreview : public StaticBitmap
|
||||
{
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool loaded = false;
|
||||
int fileCount = 0;
|
||||
int selectedIdx = -1;
|
||||
Menu* menu = nullptr;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "fullscreen_dialog.h"
|
||||
|
||||
#include "LvglWrapper.h"
|
||||
#include "libopenui.h"
|
||||
#include "mainwindow.h"
|
||||
#include "edgetx.h"
|
||||
#include "etx_lv_theme.h"
|
||||
@@ -52,19 +51,7 @@ FullScreenDialog::FullScreenDialog(
|
||||
|
||||
build();
|
||||
|
||||
lv_obj_add_event_cb(lvobj, FullScreenDialog::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
}
|
||||
|
||||
void FullScreenDialog::on_draw(lv_event_t* e)
|
||||
{
|
||||
auto dlg = (FullScreenDialog*)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (dlg) {
|
||||
if (!dlg->loaded) {
|
||||
dlg->loaded = true;
|
||||
dlg->delayedInit();
|
||||
}
|
||||
}
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void FullScreenDialog::build()
|
||||
|
||||
@@ -83,11 +83,7 @@ class FullScreenDialog : public Window
|
||||
bool running = false;
|
||||
std::function<bool(void)> closeCondition;
|
||||
std::function<void(void)> confirmHandler;
|
||||
bool loaded = false;
|
||||
StaticText* messageLabel;
|
||||
|
||||
virtual void delayedInit() {}
|
||||
void build();
|
||||
|
||||
static void on_draw(lv_event_t* e);
|
||||
};
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
#if !defined(BOOT)
|
||||
#include "libopenui_defines.h"
|
||||
#include "lib_file.h"
|
||||
#include "myeeprom.h"
|
||||
#include "fonts.h"
|
||||
#include "window.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -34,9 +32,6 @@
|
||||
#include "numberedit.h"
|
||||
#include "choice.h"
|
||||
#include "textedit.h"
|
||||
#include "slider.h"
|
||||
#include "keyboard_text.h"
|
||||
#include "keyboard_number.h"
|
||||
#include "menu.h"
|
||||
#include "dialog.h"
|
||||
#include "getset_helpers.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "listbox.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
ListBox::ListBox(Window* parent, const rect_t& rect,
|
||||
const std::vector<std::string>& names, uint8_t lineHeight) :
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "edgetx.h"
|
||||
#include "table.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "theme_manager.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_main.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
PageHeader::PageHeader(Window* parent, EdgeTxIcon icon) :
|
||||
Window(parent, {0, 0, LCD_W, EdgeTxStyles::MENU_HEADER_HEIGHT})
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "popups.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "lvgl/src/hal/lv_hal_tick.h"
|
||||
#include "os/sleep.h"
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "edgetx_types.h"
|
||||
#include "hal.h"
|
||||
|
||||
enum WarningType
|
||||
{
|
||||
|
||||
@@ -170,8 +170,7 @@ Slider::Slider(Window* parent, coord_t width, int32_t vmin, int32_t vmax,
|
||||
lv_obj_add_event_cb(slider, SliderBase::slider_changed_cb, LV_EVENT_VALUE_CHANGED, this);
|
||||
lv_slider_set_range(slider, vmin, vmax);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, Slider::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
@@ -187,24 +186,14 @@ Slider::Slider(Window* parent, coord_t width, int32_t vmin, int32_t vmax,
|
||||
update();
|
||||
}
|
||||
|
||||
void Slider::on_draw(lv_event_t* e)
|
||||
{
|
||||
auto dlg = (Slider*)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (dlg) dlg->delayedInit();
|
||||
}
|
||||
|
||||
void Slider::delayedInit()
|
||||
{
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
|
||||
coord_t w = lv_obj_get_width(lvobj) - PAD_LARGE * 2;
|
||||
coord_t x = -1;
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
for (int n = 1; n < range; n += 1) {
|
||||
lv_obj_set_pos(tickPts[n - 1], x + (w * n) / range, 1);
|
||||
}
|
||||
coord_t w = lv_obj_get_width(lvobj) - PAD_LARGE * 2;
|
||||
coord_t x = -1;
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
for (int n = 1; n < range; n += 1) {
|
||||
lv_obj_set_pos(tickPts[n - 1], x + (w * n) / range, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,8 +266,7 @@ VerticalSlider::VerticalSlider(Window* parent, coord_t height, int32_t vmin, int
|
||||
lv_obj_add_event_cb(slider, SliderBase::slider_changed_cb, LV_EVENT_VALUE_CHANGED, this);
|
||||
lv_slider_set_range(slider, vmin, vmax);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, VerticalSlider::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
@@ -294,24 +282,14 @@ VerticalSlider::VerticalSlider(Window* parent, coord_t height, int32_t vmin, int
|
||||
update();
|
||||
}
|
||||
|
||||
void VerticalSlider::on_draw(lv_event_t* e)
|
||||
{
|
||||
auto dlg = (VerticalSlider*)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (dlg) dlg->delayedInit();
|
||||
}
|
||||
|
||||
void VerticalSlider::delayedInit()
|
||||
{
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
|
||||
coord_t h = lv_obj_get_height(lvobj) - PAD_LARGE * 2;
|
||||
coord_t y = -1;
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
for (int n = 1; n < range; n += 1) {
|
||||
lv_obj_set_pos(tickPts[n - 1], 1, y + (h * n) / range);
|
||||
}
|
||||
coord_t h = lv_obj_get_height(lvobj) - PAD_LARGE * 2;
|
||||
coord_t y = -1;
|
||||
int range = vmax - vmin;
|
||||
if (range < 10) {
|
||||
for (int n = 1; n < range; n += 1) {
|
||||
lv_obj_set_pos(tickPts[n - 1], 1, y + (h * n) / range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ class SliderBase : public Window
|
||||
int vmax;
|
||||
lv_obj_t* slider;
|
||||
lv_obj_t** tickPts = nullptr;
|
||||
bool loaded = false;
|
||||
|
||||
std::function<int()> _getValue;
|
||||
std::function<void(int)> _setValue;
|
||||
@@ -60,8 +59,7 @@ class Slider : public SliderBase
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static void on_draw(lv_event_t* e);
|
||||
void delayedInit();
|
||||
void delayedInit() override;
|
||||
};
|
||||
|
||||
class VerticalSlider : public SliderBase
|
||||
@@ -75,6 +73,5 @@ class VerticalSlider : public SliderBase
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static void on_draw(lv_event_t* e);
|
||||
void delayedInit();
|
||||
void delayedInit() override;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "sdcard.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
// Used on startup to block until checlist is closed.
|
||||
static bool checkListOpen = false;
|
||||
@@ -75,17 +76,12 @@ ViewTextWindow::ViewTextWindow(const std::string path, const std::string name,
|
||||
|
||||
header->setTitle(this->name);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, ViewTextWindow::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
};
|
||||
|
||||
void ViewTextWindow::on_draw(lv_event_t* e)
|
||||
void ViewTextWindow::delayedInit()
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto view = (ViewTextWindow*)lv_obj_get_user_data(target);
|
||||
if (view) {
|
||||
if (view->buffer == nullptr) view->buildBody(view->body);
|
||||
}
|
||||
if (buffer == nullptr) buildBody(body);
|
||||
}
|
||||
|
||||
void ViewTextWindow::onCancel()
|
||||
|
||||
@@ -67,7 +67,7 @@ class ViewTextWindow : public Page
|
||||
|
||||
void onEvent(event_t event) override;
|
||||
|
||||
static void on_draw(lv_event_t * e);
|
||||
void delayedInit() override;
|
||||
};
|
||||
|
||||
void readModelNotes(bool fromMenu = false);
|
||||
|
||||
@@ -154,6 +154,20 @@ Window::~Window()
|
||||
}
|
||||
}
|
||||
|
||||
void Window::delayLoader(lv_event_t* e)
|
||||
{
|
||||
auto w = (Window*)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (w && !w->loaded) {
|
||||
w->loaded = true;
|
||||
w->delayedInit();
|
||||
}
|
||||
}
|
||||
|
||||
void Window::delayLoad()
|
||||
{
|
||||
lv_obj_add_event_cb(lvobj, Window::delayLoader, LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string Window::getName() const { return "Window"; }
|
||||
|
||||
|
||||
@@ -204,6 +204,8 @@ class Window
|
||||
bool _deleted = false;
|
||||
static bool _longPressed;
|
||||
|
||||
bool loaded = false;
|
||||
|
||||
CloseHandler closeHandler;
|
||||
FocusHandler focusHandler;
|
||||
std::function<void(coord_t, coord_t)> scrollHandler;
|
||||
@@ -215,6 +217,10 @@ class Window
|
||||
|
||||
void eventHandler(lv_event_t *e);
|
||||
static void window_event_cb(lv_event_t *e);
|
||||
|
||||
static void delayLoader(lv_event_t* e);
|
||||
void delayLoad();
|
||||
virtual void delayedInit() {}
|
||||
};
|
||||
|
||||
class NavWindow : public Window
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "color_picker.h"
|
||||
#include "layout_factory_impl.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "topbar.h"
|
||||
#include "view_main.h"
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "dataconstants.h"
|
||||
#include "window.h"
|
||||
|
||||
class SliderIcon : public Window
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "static.h"
|
||||
|
||||
class TrimIcon;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "dialog.h"
|
||||
|
||||
class AboutUs : public BaseDialog
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "view_channels.h"
|
||||
|
||||
#include "channel_bar.h"
|
||||
#include "libopenui.h"
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include "widget_settings.h"
|
||||
|
||||
#include "color_picker.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "sourcechoice.h"
|
||||
#include "switchchoice.h"
|
||||
#include "view_main.h"
|
||||
#include "filechoice.h"
|
||||
#include "slider.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "curveedit.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h" // TODO for applyCustomCurve
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "model_curves.h"
|
||||
|
||||
#include "curveedit.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "model_flightmodes.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
@@ -208,24 +207,11 @@ class FlightModeBtn : public ListLineButton
|
||||
padColumn(PAD_ZERO);
|
||||
setHeight(BTN_H);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, FlightModeBtn::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (FlightModeBtn*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
check(isActive());
|
||||
@@ -280,7 +266,7 @@ class FlightModeBtn : public ListLineButton
|
||||
void checkEvents() override
|
||||
{
|
||||
ListLineButton::checkEvents();
|
||||
if (!refreshing && init) {
|
||||
if (!refreshing && loaded) {
|
||||
refreshing = true;
|
||||
for (int t = 0; t < keysGetMaxTrims() && t < MAX_FMTRIMS; t += 1) {
|
||||
if (lastTrim[t] != g_model.flightModeData[index].trim[t].value) {
|
||||
@@ -293,7 +279,7 @@ class FlightModeBtn : public ListLineButton
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
const auto& fm = g_model.flightModeData[index];
|
||||
|
||||
@@ -345,7 +331,6 @@ class FlightModeBtn : public ListLineButton
|
||||
static constexpr coord_t FADE_X = ListLineButton::GRP_W - PAD_BORDER * 2 - FADE_W * 2 - PAD_TINY * 2;
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
bool refreshing = false;
|
||||
|
||||
lv_obj_t* fmID = nullptr;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "model_gvars.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "numberedit.h"
|
||||
#include "edgetx.h"
|
||||
@@ -55,15 +54,7 @@ class GVarButton : public ListLineButton
|
||||
setHeight(BTN_H);
|
||||
if (!modelFMEnabled()) padLeft(PAD_LARGE);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, GVarButton::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (GVarButton*)lv_obj_get_user_data(target);
|
||||
if (line) line->build();
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static LAYOUT_VAL_SCALED(GVAR_NAME_SIZE, 44)
|
||||
@@ -84,7 +75,6 @@ class GVarButton : public ListLineButton
|
||||
static const lv_obj_class_t gv_value_class;
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
uint8_t currentFlightMode = 0; // used for checking updates
|
||||
lv_obj_t* valueTexts[MAX_FLIGHT_MODES];
|
||||
gvar_t values[MAX_FLIGHT_MODES];
|
||||
@@ -94,7 +84,7 @@ class GVarButton : public ListLineButton
|
||||
void checkEvents() override
|
||||
{
|
||||
ListLineButton::checkEvents();
|
||||
if (init) {
|
||||
if (loaded) {
|
||||
if (modelFMEnabled()) {
|
||||
uint8_t newFM = getFlightMode();
|
||||
if (currentFlightMode != newFM) {
|
||||
@@ -114,12 +104,8 @@ class GVarButton : public ListLineButton
|
||||
}
|
||||
}
|
||||
|
||||
void build()
|
||||
void delayedInit() override
|
||||
{
|
||||
if (init) return;
|
||||
|
||||
init =true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
currentFlightMode = getFlightMode();
|
||||
@@ -239,21 +225,12 @@ class GVarHeader : public Window
|
||||
padAll(PAD_ZERO);
|
||||
etx_solid_bg(lvobj, COLOR_THEME_SECONDARY3_INDEX);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, GVarHeader::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (GVarHeader*)lv_obj_get_user_data(target);
|
||||
if (line) line->build();
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static LAYOUT_SIZE(HDR_H, EdgeTxStyles::STD_FONT_HEIGHT + PAD_TINY, EdgeTxStyles::STD_FONT_HEIGHT * 2)
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
uint8_t currentFlightMode = 0; // used for checking updates
|
||||
lv_obj_t* labelTexts[MAX_FLIGHT_MODES];
|
||||
|
||||
@@ -262,7 +239,7 @@ class GVarHeader : public Window
|
||||
void checkEvents() override
|
||||
{
|
||||
Window::checkEvents();
|
||||
if (init) {
|
||||
if (loaded) {
|
||||
uint8_t newFM = getFlightMode();
|
||||
if (currentFlightMode != newFM) {
|
||||
lv_obj_add_state(labelTexts[newFM], LV_STATE_CHECKED);
|
||||
@@ -273,12 +250,8 @@ class GVarHeader : public Window
|
||||
}
|
||||
}
|
||||
|
||||
void build()
|
||||
void delayedInit() override
|
||||
{
|
||||
if (init) return;
|
||||
|
||||
init =true;
|
||||
|
||||
currentFlightMode = getFlightMode();
|
||||
|
||||
char label[16] = {};
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "model_heli.h"
|
||||
#include "edgetx.h"
|
||||
#include "libopenui.h"
|
||||
#include "sourcechoice.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "model_logical_switches.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
@@ -312,24 +311,11 @@ class LogicalSwitchButton : public ListLineButton
|
||||
|
||||
check(isActive());
|
||||
|
||||
lv_obj_add_event_cb(lvobj, LogicalSwitchButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (LogicalSwitchButton*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
lsName = lv_label_create(lvobj);
|
||||
@@ -387,7 +373,7 @@ class LogicalSwitchButton : public ListLineButton
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
ListLineButton::checkEvents();
|
||||
check(isActive());
|
||||
@@ -418,7 +404,7 @@ class LogicalSwitchButton : public ListLineButton
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
char s[20];
|
||||
|
||||
@@ -527,8 +513,6 @@ class LogicalSwitchButton : public ListLineButton
|
||||
static constexpr coord_t DEL_Y = AND_Y;
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
|
||||
lv_obj_t* lsName = nullptr;
|
||||
lv_obj_t* lsFunc = nullptr;
|
||||
lv_obj_t* lsV1 = nullptr;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "dataconstants.h"
|
||||
#include "filechoice.h"
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "lua/lua_api.h"
|
||||
#include "menus.h"
|
||||
@@ -186,26 +185,12 @@ class ScriptLineButton : public ListLineButton
|
||||
lv_obj_set_style_pad_column(lvobj, PAD_SMALL, 0);
|
||||
|
||||
lv_obj_update_layout(parent->getLvObj());
|
||||
if (lv_obj_is_visible(lvobj)) delayed_init();
|
||||
|
||||
lv_obj_add_event_cb(lvobj, ScriptLineButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (ScriptLineButton*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
auto lbl = lv_label_create(lvobj);
|
||||
etx_obj_add_style(lbl, styles->text_align_left, LV_PART_MAIN);
|
||||
lv_obj_set_grid_cell(lbl, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER,
|
||||
@@ -263,7 +248,6 @@ class ScriptLineButton : public ListLineButton
|
||||
void refresh() override {}
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
const ScriptData& scriptData;
|
||||
const ScriptInternalData* runtimeData;
|
||||
};
|
||||
|
||||
@@ -78,8 +78,7 @@ class MixLineButton : public InputMixButtonBase
|
||||
{
|
||||
mplex = new MPlexIcon(parent, index);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, MixLineButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void deleteLater(bool detach = true, bool trash = true) override
|
||||
@@ -88,14 +87,9 @@ class MixLineButton : public InputMixButtonBase
|
||||
ListLineButton::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit()
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (MixLineButton*)lv_obj_get_user_data(target);
|
||||
if (line && !line->init) {
|
||||
line->init = true;
|
||||
line->refresh();
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
@@ -168,7 +162,6 @@ class MixLineButton : public InputMixButtonBase
|
||||
static LAYOUT_VAL_SCALED(MPLEX_XO, 28)
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
MPlexIcon* mplex = nullptr;
|
||||
|
||||
bool isActive() const override { return isMixActive(index); }
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
|
||||
class OutputLineButton : public ListLineButton
|
||||
{
|
||||
bool init = false;
|
||||
|
||||
lv_obj_t* source = nullptr;
|
||||
lv_obj_t* revert = nullptr;
|
||||
lv_obj_t* min = nullptr;
|
||||
@@ -44,20 +42,8 @@ class OutputLineButton : public ListLineButton
|
||||
lv_obj_t* center = nullptr;
|
||||
StaticIcon* curve = nullptr;
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (OutputLineButton*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
source = lv_label_create(lvobj);
|
||||
@@ -119,13 +105,12 @@ class OutputLineButton : public ListLineButton
|
||||
setHeight(CH_LINE_H);
|
||||
padAll(PAD_ZERO);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, OutputLineButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
const LimitData* output = limitAddress(index);
|
||||
if (g_model.limitData[index].name[0] != '\0') {
|
||||
@@ -200,7 +185,7 @@ class OutputLineButton : public ListLineButton
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
ListLineButton::checkEvents();
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "model_select.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
@@ -68,8 +67,7 @@ class ModelButton : public Button
|
||||
|
||||
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICK_FOCUSABLE);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, ModelButton::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void addDetails()
|
||||
@@ -104,15 +102,9 @@ class ModelButton : public Button
|
||||
lv_obj_update_layout(lvobj);
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t *e)
|
||||
void delayedInit() override
|
||||
{
|
||||
auto btn = (ModelButton *)lv_obj_get_user_data(lv_event_get_target(e));
|
||||
if (btn) {
|
||||
if (!btn->loaded) {
|
||||
btn->loaded = true;
|
||||
btn->addDetails();
|
||||
}
|
||||
}
|
||||
addDetails();
|
||||
}
|
||||
|
||||
const char *modelFilename() { return modelCell->modelFilename; }
|
||||
@@ -157,7 +149,6 @@ class ModelButton : public Button
|
||||
bool isModel(ModelCell* cell) { return cell == modelCell; }
|
||||
|
||||
protected:
|
||||
bool loaded = false;
|
||||
bool imgLoaded = false;
|
||||
uint8_t layout;
|
||||
ModelCell *modelCell;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "button_matrix.h"
|
||||
#include "filechoice.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
#include "storage/modelslist.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "model_telemetry.h"
|
||||
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
@@ -214,12 +213,10 @@ class SensorButton : public ListLineButton
|
||||
|
||||
check(isActive());
|
||||
|
||||
lv_obj_add_event_cb(lvobj, SensorButton::on_draw, LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
bool showId = false;
|
||||
lv_obj_t* numLabel = nullptr;
|
||||
lv_obj_t* idLabel = nullptr;
|
||||
@@ -228,16 +225,6 @@ class SensorButton : public ListLineButton
|
||||
uint32_t lastRefresh = 0;
|
||||
std::string valString;
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (SensorButton*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
bool isActive() const override { return telemetryItems[index].isAvailable(); }
|
||||
|
||||
void setNumIdState()
|
||||
@@ -260,12 +247,10 @@ class SensorButton : public ListLineButton
|
||||
refresh();
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
void delayedInit() override
|
||||
{
|
||||
char s[20];
|
||||
|
||||
init = true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
numLabel = tsStyle.newNum(lvobj, index);
|
||||
@@ -302,7 +287,7 @@ class SensorButton : public ListLineButton
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
if (showId != g_model.showInstanceIds) setNumIdState();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "standalone_lua.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
#define ETX_STATE_NO_INFO_COLOR LV_STATE_USER_1
|
||||
|
||||
|
||||
@@ -375,24 +375,11 @@ class USBChannelLineButton : public ListLineButton
|
||||
lv_obj_set_style_pad_row(lvobj, 0, 0);
|
||||
lv_obj_set_style_pad_column(lvobj, PAD_SMALL, 0);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, USBChannelLineButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
static void on_draw(lv_event_t* e)
|
||||
void delayedInit()
|
||||
{
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
auto line = (USBChannelLineButton*)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
m_chn = lv_label_create(lvobj);
|
||||
lv_obj_set_grid_cell(m_chn, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER,
|
||||
0, USBCH_CHN_ROWS);
|
||||
@@ -432,7 +419,7 @@ class USBChannelLineButton : public ListLineButton
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
USBJoystickChData* cch = usbJChAddress(index);
|
||||
|
||||
@@ -493,8 +480,6 @@ class USBChannelLineButton : public ListLineButton
|
||||
static LAYOUT_SIZE(USBCH_BTN_MODE_ROW, 0, 1)
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
|
||||
lv_obj_t* m_chn;
|
||||
lv_obj_t* m_mode;
|
||||
lv_obj_t* m_param;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "filechoice.h"
|
||||
#include "hal/adc_driver.h"
|
||||
#include "libopenui.h"
|
||||
#include "page.h"
|
||||
#include "sourcechoice.h"
|
||||
#include "switchchoice.h"
|
||||
@@ -84,24 +83,11 @@ FunctionLineButton::FunctionLineButton(Window *parent, const rect_t &rect,
|
||||
setHeight(FunctionsPage::SF_BUTTON_H);
|
||||
padAll(PAD_ZERO);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, FunctionLineButton::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void FunctionLineButton::on_draw(lv_event_t *e)
|
||||
void FunctionLineButton::delayedInit()
|
||||
{
|
||||
lv_obj_t *target = lv_event_get_target(e);
|
||||
auto line = (FunctionLineButton *)lv_obj_get_user_data(target);
|
||||
if (line) {
|
||||
if (!line->init)
|
||||
line->delayed_init();
|
||||
}
|
||||
}
|
||||
|
||||
void FunctionLineButton::delayed_init()
|
||||
{
|
||||
init = true;
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
sfName = lv_label_create(lvobj);
|
||||
@@ -135,7 +121,7 @@ void FunctionLineButton::delayed_init()
|
||||
|
||||
void FunctionLineButton::refresh()
|
||||
{
|
||||
if (!init) return;
|
||||
if (!loaded) return;
|
||||
|
||||
check(isActive());
|
||||
|
||||
@@ -307,23 +293,12 @@ FunctionEditPage::FunctionEditPage(uint8_t index, EdgeTxIcon icon,
|
||||
{
|
||||
buildHeader(header, title, prefix);
|
||||
|
||||
lv_obj_add_event_cb(lvobj, FunctionEditPage::on_draw,
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, nullptr);
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void FunctionEditPage::on_draw(lv_event_t *e)
|
||||
void FunctionEditPage::delayedInit()
|
||||
{
|
||||
lv_obj_t *target = lv_event_get_target(e);
|
||||
auto page = (FunctionEditPage *)lv_obj_get_user_data(target);
|
||||
if (page) page->delayed_init();
|
||||
}
|
||||
|
||||
void FunctionEditPage::delayed_init()
|
||||
{
|
||||
if (!init) {
|
||||
init = true;
|
||||
buildBody(body);
|
||||
}
|
||||
buildBody(body);
|
||||
}
|
||||
|
||||
void FunctionEditPage::checkEvents()
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "list_line_button.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
@@ -44,9 +43,7 @@ class FunctionLineButton : public ListLineButton
|
||||
std::string getName() const override { return "FunctionButton"; }
|
||||
#endif
|
||||
|
||||
static void on_draw(lv_event_t *e);
|
||||
|
||||
void delayed_init();
|
||||
void delayedInit() override;
|
||||
|
||||
void refresh() override;
|
||||
|
||||
@@ -67,7 +64,6 @@ class FunctionLineButton : public ListLineButton
|
||||
static constexpr coord_t EN_Y = NM_Y + PAD_TINY;
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
const CustomFunctionData *cfn;
|
||||
const char *prefix;
|
||||
|
||||
@@ -88,12 +84,9 @@ class FunctionEditPage : public Page
|
||||
FunctionEditPage(uint8_t index, EdgeTxIcon icon, const char *title,
|
||||
const char *prefix);
|
||||
|
||||
static void on_draw(lv_event_t *e);
|
||||
|
||||
void delayed_init();
|
||||
void delayedInit() override;
|
||||
|
||||
protected:
|
||||
bool init = false;
|
||||
uint8_t index;
|
||||
Window *specialFunctionOneWindow = nullptr;
|
||||
StaticText *headerSF = nullptr;
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "dialog.h"
|
||||
#include "pulses/modules_constants.h"
|
||||
#include "myeeprom.h"
|
||||
|
||||
class MultiRfProtocols;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "preview_window.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "sliders.h"
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "radio_diaganas.h"
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "hal/rgbleds.h"
|
||||
#include "board.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
|
||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "radio_diagkeys.h"
|
||||
|
||||
#include "hal/rotary_encoder.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
|
||||
#if defined(RADIO_PL18U)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "radio_ghost_module_config.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "telemetry/ghost.h"
|
||||
#include "telemetry/ghost_menu.h"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "hw_inputs.h"
|
||||
#include "hw_intmodule.h"
|
||||
#include "hw_serial.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "radio_calibration.h"
|
||||
#include "radio_diaganas.h"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "radio_sdmanager.h"
|
||||
#include "edgetx.h"
|
||||
#include "libopenui.h"
|
||||
#include "LvglWrapper.h"
|
||||
#include "io/frsky_firmware_update.h"
|
||||
#include "io/multi_firmware_update.h"
|
||||
@@ -35,6 +34,7 @@
|
||||
#include "progress.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
constexpr int WARN_FILE_LENGTH = 40 * 1024;
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
#include "hal/audio_driver.h"
|
||||
|
||||
#include "input_mapping.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
#include "storage/modelslist.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
#include "slider.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "radio_spectrum_analyser.h"
|
||||
|
||||
#include "edgetx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "file_carosell.h"
|
||||
#include "color_editor.h"
|
||||
#include "color_list.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
#include "preview_window.h"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "hal/module_port.h"
|
||||
#include "libopenui.h"
|
||||
#include "lua/lua_api.h"
|
||||
#include "edgetx.h"
|
||||
#include "radio_ghost_module_config.h"
|
||||
@@ -32,6 +31,7 @@
|
||||
#include "radio_gps_tool.h"
|
||||
#include "standalone_lua.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
#include "input_mapping.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "strhelpers.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "fw_version.h"
|
||||
#include "hal/module_port.h"
|
||||
#include "libopenui.h"
|
||||
#include "edgetx.h"
|
||||
#include "options.h"
|
||||
#include "etx_lv_theme.h"
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(LUA)
|
||||
#include "libopenui.h"
|
||||
#include "mainwindow.h"
|
||||
#include "keyboard_base.h"
|
||||
#include "lua/lua_api.h"
|
||||
#include "lua/lua_widget.h"
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "topbar_impl.h"
|
||||
#include "view_main.h"
|
||||
#include "storage/sdcard_yaml.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@ class GaugeWidget : public Widget
|
||||
GaugeWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
|
||||
Widget::PersistentData* persistentData) :
|
||||
Widget(factory, parent, rect, persistentData)
|
||||
{
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
// Gauge label
|
||||
sourceText = new StaticText(this, {0, 0, LV_SIZE_CONTENT, 16}, "",
|
||||
@@ -73,6 +78,8 @@ class GaugeWidget : public Widget
|
||||
|
||||
void update() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
mixsrc_t index = persistentData->options[0].value.unsignedValue;
|
||||
sourceText->setText(getSourceString(index));
|
||||
|
||||
@@ -94,6 +101,8 @@ class GaugeWidget : public Widget
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
Widget::checkEvents();
|
||||
|
||||
auto newValue = getGuageValue();
|
||||
|
||||
@@ -38,6 +38,11 @@ class ModelBitmapWidget : public Widget
|
||||
etx_obj_add_style(lvobj, styles->bg_opacity_cover,
|
||||
LV_PART_MAIN | ETX_STATE_BG_FILL);
|
||||
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
label = new StaticText(this, rect_t{}, "");
|
||||
label->hide();
|
||||
|
||||
@@ -49,6 +54,8 @@ class ModelBitmapWidget : public Widget
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
Widget::checkEvents();
|
||||
|
||||
if (getHash() != deps_hash) {
|
||||
@@ -62,6 +69,8 @@ class ModelBitmapWidget : public Widget
|
||||
|
||||
void update() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
isLarge = rect.h >= LARGE_H && rect.w >= LARGE_W;
|
||||
|
||||
// get font size from options[1]
|
||||
|
||||
@@ -27,11 +27,6 @@ constexpr int16_t OUTPUT_INVALID_VALUE = INT16_MIN;
|
||||
|
||||
#define ETX_STATE_BG_FILL LV_STATE_USER_1
|
||||
|
||||
#define ROW_HEIGHT 16
|
||||
|
||||
#define VIEW_CHANNELS_LIMIT_PCT \
|
||||
(g_model.extendedLimits ? LIMIT_EXT_PERCENT : 100)
|
||||
|
||||
class ChannelValue : public Window
|
||||
{
|
||||
public:
|
||||
@@ -39,12 +34,17 @@ class ChannelValue : public Window
|
||||
uint8_t channel, LcdFlags txtColor, LcdFlags barColor) :
|
||||
Window(parent,
|
||||
{col * colWidth, row * ROW_HEIGHT, colWidth - 1 + (colWidth & 1), (ROW_HEIGHT + 1)}),
|
||||
channel(channel)
|
||||
channel(channel), txtColor(txtColor), barColor(barColor)
|
||||
{
|
||||
setWindowFlag(NO_FOCUS);
|
||||
|
||||
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
etx_obj_add_style(lvobj, styles->border_thin, LV_PART_MAIN);
|
||||
etx_obj_add_style(lvobj, styles->border_color[COLOR_BLACK_INDEX], LV_PART_MAIN);
|
||||
|
||||
@@ -100,6 +100,8 @@ class ChannelValue : public Window
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
int16_t value = channelOutputs[channel];
|
||||
|
||||
if (value != lastValue) {
|
||||
@@ -142,8 +144,12 @@ class ChannelValue : public Window
|
||||
Window::checkEvents();
|
||||
}
|
||||
|
||||
static LAYOUT_VAL_SCALED(ROW_HEIGHT, 16)
|
||||
|
||||
protected:
|
||||
uint8_t channel;
|
||||
LcdFlags txtColor;
|
||||
LcdFlags barColor;
|
||||
int16_t lastValue = OUTPUT_INVALID_VALUE;
|
||||
int16_t lastScaledValue = OUTPUT_INVALID_VALUE;
|
||||
std::string lastText;
|
||||
@@ -185,21 +191,29 @@ class OutputsWidget : public Widget
|
||||
else
|
||||
lv_obj_clear_state(lvobj, ETX_STATE_BG_FILL);
|
||||
|
||||
if (height() <= SHOW_MIN_H || width() <= SHOW_MIN_W)
|
||||
return;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
// Colors
|
||||
txtColor = persistentData->options[3].value.unsignedValue;
|
||||
barColor = persistentData->options[4].value.unsignedValue;
|
||||
LcdFlags f = persistentData->options[3].value.unsignedValue;
|
||||
if (f != txtColor) { txtColor = f; changed = true; }
|
||||
f = persistentData->options[4].value.unsignedValue;
|
||||
if (f != barColor) { barColor = f; changed = true; }
|
||||
|
||||
// Setup channels
|
||||
firstChan = persistentData->options[0].value.unsignedValue;
|
||||
uint8_t chan = persistentData->options[0].value.unsignedValue;
|
||||
if (chan != firstChan) { firstChan= chan; changed = true; }
|
||||
|
||||
clear();
|
||||
// Get size
|
||||
uint8_t n = height() / ChannelValue::ROW_HEIGHT;
|
||||
if (n != rows) { rows = n; changed = true; }
|
||||
n = (width() > COLS_MIN_W) ? 2 : 1;
|
||||
if (n != cols) { cols = n; changed = true; }
|
||||
|
||||
cols = 0;
|
||||
rows = 0;
|
||||
|
||||
if (height() > SHOW_MIN_H && width() > SHOW_MIN_W) {
|
||||
rows = height() / ROW_HEIGHT;
|
||||
cols = (width() > COLS_MIN_W) ? 2 : 1;
|
||||
if (changed) {
|
||||
clear();
|
||||
coord_t colWidth = width() / cols;
|
||||
uint8_t chan = firstChan;
|
||||
for (uint8_t c = 0; c < cols && chan <= MAX_OUTPUT_CHANNELS; c += 1) {
|
||||
@@ -216,7 +230,7 @@ class OutputsWidget : public Widget
|
||||
protected:
|
||||
// Last time we refreshed the window
|
||||
uint32_t lastRefresh = 0;
|
||||
uint8_t firstChan = 0;
|
||||
uint8_t firstChan = 255;
|
||||
uint8_t cols = 0;
|
||||
uint8_t rows = 0;
|
||||
LcdFlags txtColor = 0;
|
||||
|
||||
@@ -31,6 +31,11 @@ class TextWidget : public Widget
|
||||
TextWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
|
||||
Widget::PersistentData* persistentData) :
|
||||
Widget(factory, parent, rect, persistentData)
|
||||
{
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_style_init(&style);
|
||||
lv_style_set_width(&style, lv_pct(100));
|
||||
@@ -56,6 +61,8 @@ class TextWidget : public Widget
|
||||
|
||||
void update() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
// Set text value from options
|
||||
lv_label_set_text(shadow, persistentData->options[0].value.stringValue);
|
||||
lv_label_set_text(label, persistentData->options[0].value.stringValue);
|
||||
|
||||
@@ -35,6 +35,11 @@ class TimerWidget : public Widget
|
||||
TimerWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
|
||||
Widget::PersistentData* persistentData) :
|
||||
Widget(factory, parent, rect, persistentData)
|
||||
{
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
etx_solid_bg(lvobj, COLOR_THEME_WARNING_INDEX,
|
||||
LV_PART_MAIN | ETX_STATE_BG_WARNING);
|
||||
@@ -101,6 +106,8 @@ class TimerWidget : public Widget
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
Widget::checkEvents();
|
||||
|
||||
uint32_t index = persistentData->options[0].value.unsignedValue;
|
||||
@@ -228,6 +235,8 @@ class TimerWidget : public Widget
|
||||
|
||||
void update() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
// Set up widget from options.
|
||||
char s[16];
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ class ValueWidget : public Widget
|
||||
ValueWidget(const WidgetFactory* factory, Window* parent, const rect_t& rect,
|
||||
Widget::PersistentData* persistentData) :
|
||||
Widget(factory, parent, rect, persistentData)
|
||||
{
|
||||
delayLoad();
|
||||
}
|
||||
|
||||
void delayedInit() override
|
||||
{
|
||||
lv_style_init(&labelStyle);
|
||||
lv_style_set_width(&labelStyle, lv_pct(100));
|
||||
@@ -73,6 +78,8 @@ class ValueWidget : public Widget
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
Widget::checkEvents();
|
||||
|
||||
bool changed = false;
|
||||
@@ -181,6 +188,8 @@ class ValueWidget : public Widget
|
||||
|
||||
void update() override
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
||||
// get source from options[0]
|
||||
mixsrc_t field = persistentData->options[0].value.unsignedValue;
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include "hal/watchdog_driver.h"
|
||||
#include "os/sleep.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#if !defined(LIBOPENUI)
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,12 +26,7 @@
|
||||
#include "os/sleep.h"
|
||||
#include "timers_driver.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
#include "lib_file.h"
|
||||
|
||||
#include "hal/module_port.h"
|
||||
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#if !defined(LIBOPENUI)
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,10 +31,6 @@
|
||||
#include "os/timer.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
FIL g_oLogFile __DMA;
|
||||
uint8_t logDelay100ms;
|
||||
static tmr10ms_t lastLogTime = 0;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "edgetx.h"
|
||||
#include "libopenui.h"
|
||||
#include "widget.h"
|
||||
|
||||
#include "lua_api.h"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#define LUA_LIB
|
||||
|
||||
#include "libopenui.h"
|
||||
#include "lua_api.h"
|
||||
#include "lua_widget.h"
|
||||
#include "edgetx.h"
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
#include "hal/rgbleds.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#include "api_colorlcd.h"
|
||||
#include "standalone_lua.h"
|
||||
#endif
|
||||
|
||||
@@ -34,17 +34,12 @@
|
||||
#include "sdcard.h"
|
||||
#include "api_filesystem.h"
|
||||
#include "switches.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#include "standalone_lua.h"
|
||||
#endif
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <lundump.h>
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "switchchoice.h"
|
||||
#include "toggleswitch.h"
|
||||
#include "filechoice.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "lua/lua_states.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#include "LvglWrapper.h"
|
||||
#include "view_main.h"
|
||||
#include "startup_shutdown.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "io/frsky_firmware_update.h"
|
||||
#include "os/sleep.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
#include "lib_file.h"
|
||||
|
||||
#include "pxx2_ota.h"
|
||||
#include "pxx2_transport.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "pxx2.h"
|
||||
#include "popups.h"
|
||||
#include "ffconf.h"
|
||||
|
||||
class OtaUpdateInformation: public BindInformation {
|
||||
public:
|
||||
|
||||
@@ -26,12 +26,7 @@
|
||||
#include "hal/storage.h"
|
||||
|
||||
#include "edgetx.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#else
|
||||
#include "lib_file.h"
|
||||
#endif
|
||||
#include "lib_file.h"
|
||||
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
#error "Variable sector size is not supported"
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
|
||||
#if defined(PXX2)
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#include "pulses/pxx2.h"
|
||||
#include "pulses/pxx2_transport.h"
|
||||
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#include "io/multi_protolist.h"
|
||||
#include "hal/module_port.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
#include <FreeRTOS/include/FreeRTOS.h>
|
||||
#include <FreeRTOS/include/timers.h>
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#include "spektrum.h"
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
|
||||
Reference in New Issue
Block a user