Scrolling from view to view works now
And quite some bugs & crashes fixed.
This commit is contained in:
@@ -21,6 +21,10 @@
|
||||
#include "opentx.h"
|
||||
#include <math.h>
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
extern RTOS_MUTEX_HANDLE audioMutex;
|
||||
|
||||
const int16_t sineValues[] =
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
int8_t * curveEnd[MAX_CURVES];
|
||||
|
||||
void loadCurves()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "curveedit.h"
|
||||
#include "keyboard_curve.h"
|
||||
#include "opentx.h" // TODO for applyCustomCurve
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "fullscreen_dialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string message, std::string action, const std::function<void(void)> & confirmHandler):
|
||||
FormGroup(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define _GVAR_NUMBEREDIT_H_
|
||||
|
||||
#include "form.h"
|
||||
#include "choice.h"
|
||||
#include "numberedit.h"
|
||||
#include "gvars.h"
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
#include "layouts/trims.h"
|
||||
#include "layouts/sliders.h"
|
||||
|
||||
constexpr uint32_t LAYOUT_REFRESH = 1000 / 2; // 2 Hz
|
||||
|
||||
Layout * customScreens[MAX_CUSTOM_SCREENS] = {};
|
||||
|
||||
std::list<const LayoutFactory *> & getRegisteredLayouts()
|
||||
{
|
||||
static std::list<const LayoutFactory *> layouts;
|
||||
@@ -100,15 +104,24 @@ void loadDefaultLayout()
|
||||
//
|
||||
void loadCustomScreens()
|
||||
{
|
||||
for (unsigned int i = 0; i < MAX_CUSTOM_SCREENS; i++) {
|
||||
unsigned i = 0;
|
||||
while (i < MAX_CUSTOM_SCREENS) {
|
||||
|
||||
auto& screen = customScreens[i];
|
||||
screen = loadLayout(g_model.screenData[i].LayoutId,
|
||||
&g_model.screenData[i].layoutData);
|
||||
|
||||
if (screen) {
|
||||
screen->attach(ViewMain::instance());
|
||||
if (!screen) {
|
||||
// no more layouts
|
||||
break;
|
||||
}
|
||||
|
||||
// layout is ok, let's add it
|
||||
auto viewMain = ViewMain::instance();
|
||||
screen->attach(viewMain);
|
||||
viewMain->setMainViewsCount(i + 1);
|
||||
screen->setLeft(viewMain->getMainViewLeftPos(i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,6 +172,39 @@ void disposeCustomScreen(unsigned idx)
|
||||
memset(dst, 0, len);
|
||||
}
|
||||
|
||||
void Layout::create()
|
||||
{
|
||||
memset(persistentData, 0, sizeof(PersistentData));
|
||||
|
||||
getOptionValue(OPTION_TOPBAR)->boolValue = true;
|
||||
getOptionValue(OPTION_FM)->boolValue = true;
|
||||
getOptionValue(OPTION_SLIDERS)->boolValue = true;
|
||||
getOptionValue(OPTION_TRIMS)->boolValue = true;
|
||||
getOptionValue(OPTION_MIRRORED)->boolValue = false;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
void Layout::paint(BitmapBuffer * dc)
|
||||
{
|
||||
TRACE("### painting -> %s", getWindowDebugString().c_str());
|
||||
//rect_t zone = getMainZone();
|
||||
//dc->drawSolidFilledRect( zone.x, zone.y + rect.y, zone.w, zone.h, DEFAULT_BGCOLOR);
|
||||
LayoutBase::paint(dc);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Layout::checkEvents()
|
||||
{
|
||||
LayoutBase::checkEvents();
|
||||
decorate();
|
||||
|
||||
// uint32_t now = RTOS_GET_MS();
|
||||
// if (now - lastRefresh >= LAYOUT_REFRESH) {
|
||||
// lastRefresh = now;
|
||||
// invalidate();
|
||||
// }
|
||||
}
|
||||
|
||||
void Layout::decorate()
|
||||
{
|
||||
// Check if deco setting are still up-to-date
|
||||
|
||||
@@ -74,28 +74,18 @@ class Layout: public LayoutBase
|
||||
{
|
||||
return "Layout";
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
#endif
|
||||
|
||||
void create() override
|
||||
{
|
||||
setOptionValue(OPTION_TOPBAR, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_FM, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_SLIDERS, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_TRIMS, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_MIRRORED, OPTION_VALUE_BOOL(false));
|
||||
decorate();
|
||||
}
|
||||
void create() override;
|
||||
|
||||
inline const LayoutFactory * getFactory() const
|
||||
{
|
||||
return factory;
|
||||
}
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
LayoutBase::checkEvents();
|
||||
decorate();
|
||||
}
|
||||
void checkEvents() override;
|
||||
|
||||
bool hasTopbar() const {
|
||||
return getOptionValue(OPTION_TOPBAR)->boolValue;
|
||||
@@ -123,6 +113,9 @@ class Layout: public LayoutBase
|
||||
// Decoration settings bitmask to detect updates
|
||||
uint8_t decorationSettings = 0;
|
||||
|
||||
// Last time we refreshed the window
|
||||
uint32_t lastRefresh = 0;
|
||||
|
||||
// Updates settings for trims, sliders, pots, etc...
|
||||
void decorate();
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ class Layout2x4: public Layout
|
||||
void create() override
|
||||
{
|
||||
Layout::create();
|
||||
setOptionValue(OPTION_PANEL1_BACKGROUND, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_PANEL1_COLOR, OPTION_VALUE_UNSIGNED( RGB(77,112,203)));
|
||||
setOptionValue(OPTION_PANEL2_BACKGROUND, OPTION_VALUE_BOOL(true));
|
||||
setOptionValue(OPTION_PANEL2_COLOR, OPTION_VALUE_UNSIGNED( RGB(77,112,203)));
|
||||
getOptionValue(OPTION_PANEL1_BACKGROUND)->boolValue = true;
|
||||
getOptionValue(OPTION_PANEL1_COLOR)->unsignedValue = RGB(77,112,203);
|
||||
getOptionValue(OPTION_PANEL2_BACKGROUND)->boolValue = true;
|
||||
getOptionValue(OPTION_PANEL2_COLOR)->unsignedValue = RGB(77,112,203);
|
||||
}
|
||||
|
||||
unsigned int getZonesCount() const override
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "model_flightmodes.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "model_inputs.h"
|
||||
#include "opentx.h"
|
||||
#include "gvar_numberedit.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -527,4 +528,4 @@ void insertExpo(uint8_t idx, uint8_t input)
|
||||
expo->weight = 100;
|
||||
resumeMixerCalculations();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "model_select.h"
|
||||
#include "opentx.h"
|
||||
#include "storage/modelslist.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define CATEGORIES_WIDTH 120
|
||||
#define MODELS_LEFT 123
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "radio_diaganas.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
constexpr coord_t ANA_OFFSET = 150;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "radio_diagkeys.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#if defined(KEYS_GPIO_PIN_PGUP)
|
||||
constexpr uint8_t KEY_START = 0;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "radio_ghost_module_config.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
class GhostModuleConfigWindow: public Window
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "radio_diagkeys.h"
|
||||
#include "radio_diaganas.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "radio_setup.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "radio_spectrum_analyser.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "radio_trainer.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "opentx.h"
|
||||
#include "view_main.h"
|
||||
#include "widget_settings.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -172,6 +173,7 @@ class SetupWidgetsPage: public FormWindow
|
||||
auto screen = customScreens[customScreenIdx];
|
||||
if (screen) {
|
||||
screen->attach(this);
|
||||
screen->setLeft(0);
|
||||
setRect(screen->getRect());
|
||||
}
|
||||
|
||||
@@ -200,7 +202,9 @@ class SetupWidgetsPage: public FormWindow
|
||||
#endif
|
||||
auto screen = customScreens[customScreenIdx];
|
||||
if (screen) {
|
||||
screen->attach(ViewMain::instance());
|
||||
auto viewMain = ViewMain::instance();
|
||||
screen->setLeft(viewMain->getMainViewLeftPos(customScreenIdx));
|
||||
screen->attach(viewMain);
|
||||
}
|
||||
FormWindow::deleteLater(detach, trash);
|
||||
|
||||
@@ -277,33 +281,44 @@ void ScreenAddPage::build(FormWindow * window)
|
||||
|
||||
// First page is "User interface", subtract it
|
||||
auto newIdx = pageIndex - 1;
|
||||
|
||||
TRACE("ScreenAddPage: add screen: newIdx = %d", newIdx);
|
||||
|
||||
auto& screen = customScreens[newIdx];
|
||||
auto& screenData = g_model.screenData[newIdx];
|
||||
|
||||
TRACE("ScreenAddPage: add screen: screen = %p", screen);
|
||||
|
||||
const LayoutFactory * factory = defaultLayout;
|
||||
screen = factory->create(&screenData.layoutData);
|
||||
strncpy(screenData.LayoutId, factory->getId(), sizeof(screenData.LayoutId));
|
||||
if (factory) {
|
||||
TRACE("ScreenAddPage: add screen: factory = %p", factory);
|
||||
screen = factory->create(&screenData.layoutData);
|
||||
|
||||
auto tab = new ScreenSetupPage(menu, pageIndex, newIdx);
|
||||
std::string title(STR_MAIN_VIEW_X);
|
||||
title.back() = newIdx + '1';
|
||||
tab->setTitle(title);
|
||||
tab->setIcon(ICON_THEME_VIEW1 + newIdx);
|
||||
strncpy(screenData.LayoutId, factory->getId(), sizeof(screenData.LayoutId));
|
||||
TRACE("ScreenAddPage: add screen: LayoutId = %s", screenData.LayoutId);
|
||||
|
||||
// remove current tab first
|
||||
menu->setCurrentTab(0);
|
||||
menu->removeTab(pageIndex);
|
||||
auto tab = new ScreenSetupPage(menu, pageIndex, newIdx);
|
||||
std::string title(STR_MAIN_VIEW_X);
|
||||
title.back() = newIdx + '1';
|
||||
tab->setTitle(title);
|
||||
tab->setIcon(ICON_THEME_VIEW1 + newIdx);
|
||||
|
||||
// add the new one
|
||||
menu->addTab(tab);
|
||||
menu->setCurrentTab(pageIndex);
|
||||
// remove current tab first
|
||||
menu->setCurrentTab(0);
|
||||
menu->removeTab(pageIndex);
|
||||
|
||||
if (menu->getTabs() < MAX_CUSTOM_SCREENS) {
|
||||
menu->addTab(new ScreenAddPage(menu, menu->getTabs()));
|
||||
// add the new one
|
||||
menu->addTab(tab);
|
||||
menu->setCurrentTab(pageIndex);
|
||||
|
||||
if (menu->getTabs() < MAX_CUSTOM_SCREENS) {
|
||||
menu->addTab(new ScreenAddPage(menu, menu->getTabs()));
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
TRACE("Add main view: factory is NULL");
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "special_functions.h"
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(functions == g_model.customFn ? EE_MODEL : EE_GENERAL)
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
//#include "checkbox.h"
|
||||
//#include "modal_window.h"
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ class Theme480: public OpenTxTheme
|
||||
void drawBackground(BitmapBuffer * dc) const override
|
||||
{
|
||||
if (backgroundBitmap) {
|
||||
dc->drawBitmap(0, 0, backgroundBitmap);
|
||||
dc->drawBitmap(0 - dc->getOffsetX(), 0 - dc->getOffsetY(), backgroundBitmap);
|
||||
}
|
||||
else {
|
||||
lcdSetColor(g_eeGeneral.themeData.options[0].value.unsignedValue);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
constexpr uint32_t TOPBAR_REFRESH = 1000 / 2; // 2 Hz
|
||||
|
||||
TopBar::TopBar(Window * parent) :
|
||||
WidgetsContainer<MAX_TOPBAR_ZONES, MAX_TOPBAR_OPTIONS>({0, 0, LCD_W, MENU_HEADER_HEIGHT}, &g_model.topbarData)
|
||||
{
|
||||
@@ -160,3 +162,12 @@ void TopBar::paint(BitmapBuffer * dc)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TopBar::checkEvents()
|
||||
{
|
||||
// uint32_t now = RTOS_GET_MS();
|
||||
// if (now - lastRefresh >= TOPBAR_REFRESH) {
|
||||
// lastRefresh = now;
|
||||
// invalidate();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ class TopBar: public WidgetsContainer<MAX_TOPBAR_ZONES, MAX_TOPBAR_OPTIONS>
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
invalidate();
|
||||
}
|
||||
void checkEvents() override;
|
||||
|
||||
protected:
|
||||
uint32_t lastRefresh = 0;
|
||||
};
|
||||
|
||||
#endif // _TOPBAR_H_
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "view_logical_switches.h"
|
||||
#include "gridlayout.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "opentx.h"
|
||||
#include "tabsgroup.h"
|
||||
|
||||
constexpr coord_t CSW_1ST_COLUMN = 50;
|
||||
constexpr coord_t CSW_2ND_COLUMN = 120;
|
||||
|
||||
@@ -31,22 +31,10 @@
|
||||
#include "view_main_decoration.h"
|
||||
#include "opentx.h"
|
||||
|
||||
Layout * customScreens[MAX_CUSTOM_SCREENS] = {};
|
||||
|
||||
int getMainViewsCount()
|
||||
{
|
||||
for (int index=1; index<MAX_CUSTOM_SCREENS; index++) {
|
||||
if (!customScreens[index]) {
|
||||
return index + 1;
|
||||
}
|
||||
}
|
||||
return MAX_CUSTOM_SCREENS;
|
||||
}
|
||||
|
||||
ViewMain * ViewMain::_instance = nullptr;
|
||||
|
||||
ViewMain::ViewMain():
|
||||
FormWindow(MainWindow::instance(), { 0, 0, LCD_W, LCD_H })
|
||||
FormWindow(MainWindow::instance(), MainWindow::instance()->getRect())
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH) && !defined(HARDWARE_KEYS)
|
||||
new FabButton(this, 50, 100, ICON_MODEL,
|
||||
@@ -73,7 +61,10 @@ ViewMain::ViewMain():
|
||||
return 0;
|
||||
}, NO_FOCUS);
|
||||
#endif
|
||||
|
||||
createDecoration();
|
||||
setPageWidth(getParent()->width());
|
||||
|
||||
focusWindow = this;
|
||||
}
|
||||
|
||||
@@ -109,6 +100,26 @@ void ViewMain::adjustDecoration()
|
||||
decoration->adjustDecoration();
|
||||
}
|
||||
|
||||
unsigned ViewMain::getMainViewsCount() const
|
||||
{
|
||||
return views;
|
||||
}
|
||||
|
||||
void ViewMain::setMainViewsCount(unsigned views)
|
||||
{
|
||||
if (views > MAX_CUSTOM_SCREENS)
|
||||
views = MAX_CUSTOM_SCREENS;
|
||||
|
||||
this->views = views;
|
||||
setInnerWidth(getParent()->width() * views);
|
||||
//setWidth(getParent()->width() * views);
|
||||
}
|
||||
|
||||
coord_t ViewMain::getMainViewLeftPos(unsigned view) const
|
||||
{
|
||||
return getParent()->width() * view;
|
||||
}
|
||||
|
||||
rect_t ViewMain::getMainZone() const
|
||||
{
|
||||
rect_t zone = decoration->getMainZone();
|
||||
@@ -141,6 +152,33 @@ void ViewMain::onEvent(event_t event)
|
||||
killEvents(event);
|
||||
openMenu();
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_PGDN):
|
||||
killEvents(event);
|
||||
g_model.view++;
|
||||
if (g_model.view >= getMainViewsCount())
|
||||
g_model.view = 0;
|
||||
setScrollPositionX(g_model.view * pageWidth);
|
||||
//customScreens[g_model.view]->setFocus();
|
||||
TRACE("### switched to view #%i", g_model.view);
|
||||
break;
|
||||
|
||||
//TODO: these need to go away!
|
||||
// -> board code should map the keys as required
|
||||
#if defined(KEYS_GPIO_REG_UP)
|
||||
case EVT_KEY_BREAK(KEY_PGUP):
|
||||
#else
|
||||
case EVT_KEY_LONG(KEY_PGDN):
|
||||
#endif
|
||||
killEvents(event);
|
||||
if (!g_model.view)
|
||||
g_model.view = getMainViewsCount() - 1;
|
||||
else
|
||||
g_model.view--;
|
||||
setScrollPositionX(g_model.view * pageWidth);
|
||||
//customScreens[g_model.view]->setFocus();
|
||||
TRACE("### switched to view #%i", g_model.view);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -187,6 +225,9 @@ void ViewMain::openMenu()
|
||||
|
||||
void ViewMain::paint(BitmapBuffer * dc)
|
||||
{
|
||||
TRACE("### ViewMain::paint(offset_x=%d;offset_y=%d) ###",
|
||||
dc->getOffsetX(), dc->getOffsetY());
|
||||
|
||||
OpenTxTheme::instance()->drawBackground(dc);
|
||||
|
||||
if (g_model.view >= getMainViewsCount()) {
|
||||
@@ -206,3 +247,28 @@ void ViewMain::createTopbar()
|
||||
topbar->load();
|
||||
}
|
||||
|
||||
#if 0
|
||||
FormGroup * setMultiPageForm(uint8_t pages, bool focus = true)
|
||||
{
|
||||
if (mainForm)
|
||||
mainForm->deleteLater();
|
||||
|
||||
coord_t height =
|
||||
bottomToolbarIcon >= 0 ?
|
||||
MULTI_PAGE_FORM_HEIGHT
|
||||
: MULTI_PAGE_FORM_WITHOUT_TOOLBAR_HEIGHT;
|
||||
|
||||
mainForm = new FormWindow(this,
|
||||
{0, MULTI_PAGE_FORM_TOP, LCD_W, height},
|
||||
FRSKY_PAGE_FORM_FLAGS);
|
||||
|
||||
mainForm->setPageWidth(LCD_W);
|
||||
mainForm->setInnerWidth(pages * LCD_W);
|
||||
|
||||
if (focus) {
|
||||
mainForm->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
return mainForm;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -63,12 +63,18 @@ class ViewMain: public FormWindow
|
||||
// Get the available space in the middle of the screen
|
||||
// (without decoration)
|
||||
rect_t getMainZone() const;
|
||||
|
||||
unsigned getMainViewsCount() const;
|
||||
void setMainViewsCount(unsigned views);
|
||||
|
||||
coord_t getMainViewLeftPos(unsigned view) const;
|
||||
|
||||
protected:
|
||||
static ViewMain * _instance;
|
||||
|
||||
TopBar* topbar;
|
||||
ViewMainDecoration* decoration;
|
||||
unsigned views = 0;
|
||||
TopBar* topbar = nullptr;
|
||||
ViewMainDecoration* decoration = nullptr;
|
||||
|
||||
friend class SetupWidgetsPage;
|
||||
|
||||
@@ -81,6 +87,8 @@ class ViewMain: public FormWindow
|
||||
|
||||
void createDecoration();
|
||||
void createTopbar();
|
||||
|
||||
void nextView();
|
||||
};
|
||||
|
||||
#endif // _VIEW_MAIN_H_
|
||||
|
||||
@@ -266,8 +266,8 @@ void ViewMainDecoration::createTrims()
|
||||
VERTICAL_SLIDERS_HEIGHT
|
||||
};
|
||||
|
||||
trims[TRIMS_LV] = new MainViewVerticalTrim(this, r, 1);
|
||||
trims[TRIMS_RV] = new MainViewVerticalTrim(this, r, 2);
|
||||
trims[TRIMS_LV] = new MainViewVerticalTrim(this, r, 2);
|
||||
trims[TRIMS_RV] = new MainViewVerticalTrim(this, r, 1);
|
||||
}
|
||||
|
||||
void ViewMainDecoration::createFlightMode()
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "opentx.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "static.h"
|
||||
#include "window.h"
|
||||
#include "font.h"
|
||||
|
||||
template <class T>
|
||||
class DebugInfoNumber : public Window
|
||||
@@ -34,7 +36,7 @@ class DebugInfoNumber : public Window
|
||||
prefix(prefix),
|
||||
suffix(suffix)
|
||||
{
|
||||
coord_t prefixSize = getTextWidth(prefix, 0,HEADER_COLOR | FONT(XS));
|
||||
coord_t prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS));
|
||||
new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS));
|
||||
new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, [] {
|
||||
return menusStack.available();
|
||||
|
||||
@@ -71,10 +71,13 @@ class Widget : public FormField
|
||||
return &persistentData->options[index].value;
|
||||
}
|
||||
|
||||
inline void setOptionValue(unsigned int index, const ZoneOptionValue& value)
|
||||
{
|
||||
persistentData->options[index].value = value;
|
||||
}
|
||||
//
|
||||
// TODO: for some reason, this one crashes on the radio...
|
||||
//
|
||||
// inline void setOptionValue(unsigned int index, const ZoneOptionValue& value)
|
||||
// {
|
||||
// persistentData->options[index].value = value;
|
||||
// }
|
||||
|
||||
inline PersistentData * getPersistentData()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#include "widget_settings.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
static const rect_t widgetSettingsDialogRect = {
|
||||
LCD_W / 10, // x
|
||||
@@ -51,30 +53,30 @@ WidgetSettings::WidgetSettings(Window * parent, Widget * widget) :
|
||||
case ZoneOption::Integer:
|
||||
new NumberEdit(form, grid.getFieldSlot(), option.min.signedValue, option.max.signedValue,
|
||||
[=]() -> int {
|
||||
return widget->getOptionValue(optIdx)->signedValue;
|
||||
return widget->getOptionValue(optIdx)->signedValue;
|
||||
},
|
||||
[=](int32_t newValue) {
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_SIGNED(newValue));
|
||||
widget->getOptionValue(optIdx)->signedValue = newValue;
|
||||
});
|
||||
break;
|
||||
|
||||
case ZoneOption::Source:
|
||||
new SourceChoice(form, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM,
|
||||
[=]() -> int16_t {
|
||||
return (int16_t) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
return (int16_t) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
},
|
||||
[=](int16_t newValue) {
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_UNSIGNED((uint32_t) newValue));
|
||||
widget->getOptionValue(optIdx)->unsignedValue = (uint32_t)newValue;
|
||||
});
|
||||
break;
|
||||
|
||||
case ZoneOption::Bool:
|
||||
new CheckBox(form, grid.getFieldSlot(),
|
||||
[=]() -> uint8_t {
|
||||
return (uint8_t) widget->getOptionValue(optIdx)->boolValue;
|
||||
return (uint8_t) widget->getOptionValue(optIdx)->boolValue;
|
||||
},
|
||||
[=](int8_t newValue) {
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_BOOL((uint32_t) newValue));
|
||||
widget->getOptionValue(optIdx)->boolValue = newValue;
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -91,10 +93,10 @@ WidgetSettings::WidgetSettings(Window * parent, Widget * widget) :
|
||||
{
|
||||
auto tmChoice = new Choice(form, grid.getFieldSlot(), 0, TIMERS - 1,
|
||||
[=]() -> int { // getValue
|
||||
return (int) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
return (int) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
},
|
||||
[=](int newValue) { // setValue
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_UNSIGNED((uint32_t) newValue));
|
||||
widget->getOptionValue(optIdx)->unsignedValue = (uint32_t) newValue;
|
||||
});
|
||||
|
||||
tmChoice->setTextHandler([](int value) {
|
||||
@@ -108,19 +110,20 @@ WidgetSettings::WidgetSettings(Window * parent, Widget * widget) :
|
||||
option.min.unsignedValue, // min
|
||||
option.max.unsignedValue, // max
|
||||
[=]() -> int16_t { // getValue
|
||||
return (uint8_t) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
return (uint8_t) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
},
|
||||
[=](int16_t newValue) { // setValue
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_UNSIGNED((uint32_t) newValue));
|
||||
widget->getOptionValue(optIdx)->unsignedValue = (uint32_t) newValue;
|
||||
});
|
||||
break;
|
||||
|
||||
case ZoneOption::Color:
|
||||
new ColorEdit(form, grid.getFieldSlot(), [=]() -> int { // getValue
|
||||
return (int) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
new ColorEdit(form, grid.getFieldSlot(),
|
||||
[=]() -> int { // getValue
|
||||
return (int) widget->getOptionValue(optIdx)->unsignedValue;
|
||||
},
|
||||
[=](int newValue) { // setValue
|
||||
widget->setOptionValue(optIdx, OPTION_VALUE_UNSIGNED((uint32_t) newValue));
|
||||
widget->getOptionValue(optIdx)->unsignedValue = (uint32_t) newValue;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
#define VIEW_CHANNELS_LIMIT_PCT (g_model.extendedLimits ? LIMIT_EXT_PERCENT : 100)
|
||||
|
||||
constexpr uint32_t OUTPUTS_REFRESH = 1000 / 5; // 5 Hz
|
||||
|
||||
|
||||
class OutputsWidget: public Widget
|
||||
{
|
||||
public:
|
||||
@@ -100,11 +103,23 @@ class OutputsWidget: public Widget
|
||||
void checkEvents() override
|
||||
{
|
||||
Widget::checkEvents();
|
||||
|
||||
// Last time we refreshed the window
|
||||
uint32_t now = RTOS_GET_MS();
|
||||
if (now - lastRefresh >= OUTPUTS_REFRESH) {
|
||||
lastRefresh = now;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
static const ZoneOption options[];
|
||||
|
||||
protected:
|
||||
// Last time we refreshed the window
|
||||
uint32_t lastRefresh = 0;
|
||||
};
|
||||
|
||||
const ZoneOption OutputsWidget::options[] = {
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
#define OPTION_VALUE_BOOL(x) { bool(x) }
|
||||
#define OPTION_VALUE_STRING(...) { *(ZoneOptionValue *)(const char *) #__VA_ARGS__ }
|
||||
#else
|
||||
#define OPTION_VALUE_UNSIGNED(x) { .unsignedValue = (x) }
|
||||
#define OPTION_VALUE_SIGNED(x) { .signedValue = (x) }
|
||||
#define OPTION_VALUE_BOOL(x) { .boolValue = (x) }
|
||||
#define OPTION_VALUE_STRING(...) { .stringValue = { __VA_ARGS__ } }
|
||||
#define OPTION_VALUE_UNSIGNED(x) ZoneOptionValue{ .unsignedValue = (x) }
|
||||
#define OPTION_VALUE_SIGNED(x) ZoneOptionValue{ .signedValue = (x) }
|
||||
#define OPTION_VALUE_BOOL(x) ZoneOptionValue{ .boolValue = (x) }
|
||||
#define OPTION_VALUE_STRING(...) ZoneOptionValue{ .stringValue = { __VA_ARGS__ } }
|
||||
#endif
|
||||
|
||||
union ZoneOptionValue
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "bootloader_flash.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
bool isBootloader(const char * filename)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "frsky_firmware_update.h"
|
||||
#include "libopenui/src/libopenui_file.h"
|
||||
|
||||
#include "libopenui.h"
|
||||
|
||||
#define PRIM_REQ_POWERUP 0
|
||||
#define PRIM_REQ_VERSION 1
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "multi_firmware_update.h"
|
||||
#include "stk500.h"
|
||||
#include "debug.h"
|
||||
#include "libopenui.h"
|
||||
|
||||
#define UPDATE_MULTI_EXT_BIN ".bin"
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#include "opentx.h"
|
||||
#include "ff.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
FIL g_oLogFile __DMA;
|
||||
const char * g_logError = nullptr;
|
||||
uint8_t logDelay;
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "telemetry/frsky.h"
|
||||
#include "telemetry/multi.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#include "lua/lua_exports_x12s.inc" // this line must be after lua headers
|
||||
#elif defined(RADIO_FAMILY_T16)
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
#include "bin_allocator.h"
|
||||
#include "lua_api.h"
|
||||
#include "sdcard.h"
|
||||
#include "libopenui/src/libopenui_file.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <lundump.h>
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "mainwindow.h"
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
uint8_t currentSpeakerVolume = 255;
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
#include <io/frsky_firmware_update.h>
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
// #include "shutdown_animation.h"
|
||||
#include "radio_calibration.h"
|
||||
#include "view_main.h"
|
||||
#include "libopenui.h"
|
||||
// #include "shutdown_animation.h"
|
||||
#include "radio_calibration.h"
|
||||
#include "view_main.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
#include "opentx_helpers.h"
|
||||
#include "touch.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#include "targets/simu/simpgmspace.h"
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
#include <stdint.h>
|
||||
#include "opentx.h"
|
||||
#include "diskio.h"
|
||||
#include "libopenui/src/libopenui_file.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
bool sdCardFormat()
|
||||
{
|
||||
|
||||
+1
-1
@@ -383,7 +383,7 @@ void OpenTxSim::updateKeysAndSwitches(bool start)
|
||||
static FXuint trimKeys[] = { KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12 };
|
||||
#endif
|
||||
|
||||
for (unsigned i=0; i<NUM_TRIMS_KEYS; i++) {
|
||||
for (unsigned i=0; i<sizeof(trimKeys)/(2*sizeof(FXuint)); i++) {
|
||||
simuSetTrim(i, getApp()->getKeyState(trimKeys[i]));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
typedef uint16_t pixel_t;
|
||||
|
||||
constexpr bool WRAP_FORM_FIELDS_WITHIN_PAGE = true;
|
||||
constexpr uint32_t SLIDE_SPEED_REDUCTION = 5;
|
||||
constexpr short SLIDE_SPEED_REDUCTION = 5;
|
||||
|
||||
constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 33;
|
||||
constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = 47;
|
||||
|
||||
@@ -83,8 +83,8 @@ else()
|
||||
# struct packing breaks on MinGW w/out -mno-ms-bitfields: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 & http://stackoverflow.com/questions/24015852/struct-packing-and-alignment-with-mingw
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -fsanitize=address")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -fsanitize=address")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
|
||||
@@ -98,6 +98,7 @@ if(FOX_FOUND)
|
||||
endif()
|
||||
add_executable(simu WIN32 ${SIMU_SRC} ${RADIO_SRC_DIR}/simu.cpp)
|
||||
add_dependencies(simu ${RADIO_DEPENDENCIES})
|
||||
|
||||
target_include_directories(simu PUBLIC ${FOX_INCLUDE_DIR} )
|
||||
target_link_libraries(simu ${FOX_LIBRARY} pthread ${SDL_LIBRARY})
|
||||
target_compile_definitions(simu PUBLIC -DSIMU)
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
void processGetHardwareInfoFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_GET_HARDWARE_INFO) {
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
#include "pulses/afhds3.h"
|
||||
#include "mixer_scheduler.h"
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
uint8_t telemetryStreaming = 0;
|
||||
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
||||
uint8_t telemetryRxBufferCount = 0;
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
#include "libopenui.h"
|
||||
#endif
|
||||
|
||||
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||
uint8_t allowNewSensors;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user