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