Skip to content

Commit

Permalink
backport of EdgeTX#4393 to 2.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mha1 committed Dec 13, 2023
1 parent 8faf131 commit 7ab6a81
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/model_outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class OutputLineButton : public ListLineButton

void checkEvents() override
{
Window::checkEvents();
ListLineButton::checkEvents();
if (!init) return;

int newValue = channelOutputs[index];
Expand Down
7 changes: 7 additions & 0 deletions radio/src/gui/colorlcd/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "mainwindow.h"
#include "keyboard_base.h"
#include "opentx.h"
#include "view_main.h"

PageHeader::PageHeader(Page * parent, uint8_t icon):
FormGroup(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
Expand Down Expand Up @@ -89,6 +90,12 @@ void Page::onCancel()
deleteLater();
}

void Page::checkEvents()
{
ViewMain::instance()->runBackground();
//NavWindow::checkEvents();
}

void Page::onClicked()
{
Keyboard::hide();
Expand Down
2 changes: 2 additions & 0 deletions radio/src/gui/colorlcd/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class Page : public Window
PageHeader header;
FormWindow body;

void checkEvents() override;

void onEvent(event_t event) override;
};

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/radio_theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ThemeEditPage : public Page
started = true;
_themeName->setText(_theme.getName());
}
Window::checkEvents();
Page::checkEvents();
}

void editColorPage()
Expand Down
1 change: 1 addition & 0 deletions radio/src/gui/colorlcd/tabsgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ void TabsGroup::checkEvents()
if (currentTab) {
currentTab->checkEvents();
}
ViewMain::instance()->runBackground();

static uint32_t lastRefresh = 0;
uint32_t now = RTOS_GET_MS();
Expand Down
9 changes: 9 additions & 0 deletions radio/src/gui/colorlcd/view_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,12 @@ void ViewMain::long_pressed(lv_event_t* e)
lv_indev_wait_release(lv_indev_get_act());
}
}

void ViewMain::runBackground()
{
topbar->runBackground();
for (int i = 0; i < MAX_CUSTOM_SCREENS; i += 1) {
if (customScreens[i])
customScreens[i]->runBackground();
}
}
2 changes: 2 additions & 0 deletions radio/src/gui/colorlcd/view_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class ViewMain: public Window
void onClicked() override;
void onCancel() override;

void runBackground();

protected:
static ViewMain * _instance;

Expand Down
9 changes: 9 additions & 0 deletions radio/src/gui/colorlcd/widgets/widgets_container_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ class WidgetsContainerImpl : public WidgetsContainer

void adjustLayout() override {}
void updateFromTheme() override {};

void runBackground() override
{
for (int i = 0; i < N; i++) {
if (widgets[i]) {
widgets[i]->background();
}
}
}

protected:
PersistentData* persistentData;
Expand Down
1 change: 1 addition & 0 deletions radio/src/gui/colorlcd/widgets_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class WidgetsContainer: public Window
virtual void adjustLayout() = 0;
virtual void updateZones() = 0;
virtual void updateFromTheme() = 0;
virtual void runBackground() = 0;
};


Expand Down

1 comment on commit 7ab6a81

@Kevltan
Copy link

@Kevltan Kevltan commented on 7ab6a81 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine on my X12S on 2.9.2 firmware.

Please sign in to comment.