Merge branch 'main' of https://github.com/eshifri/edgetx into eshifri/delayIcons
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "layout.h"
|
||||
#include "layout_factory_impl.h"
|
||||
|
||||
const uint8_t LBM_LAYOUT_1P2[] = {
|
||||
#include "mask_layout1+2.lbm"
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_1P2[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
LAYOUT_OPTIONS_END
|
||||
};
|
||||
|
||||
class Layout1P2: public Layout
|
||||
{
|
||||
public:
|
||||
Layout1P2(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||
Layout(factory, persistentData)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
rect_t zone = getMainZone();
|
||||
|
||||
if (index == 0) {
|
||||
return {zone.x, zone.y, zone.w, zone.h / 2};
|
||||
}
|
||||
else if (index == 1) {
|
||||
return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4};
|
||||
}
|
||||
else
|
||||
{
|
||||
return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4};
|
||||
}
|
||||
|
||||
return zone;
|
||||
}
|
||||
};
|
||||
|
||||
BaseLayoutFactory<Layout1P2> Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2);
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "layout.h"
|
||||
#include "layout_factory_impl.h"
|
||||
|
||||
const uint8_t LBM_LAYOUT_1x2[] = {
|
||||
#include "mask_layout1x2.lbm"
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_1x2[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
LAYOUT_OPTIONS_END
|
||||
};
|
||||
|
||||
class Layout1x2: public Layout
|
||||
{
|
||||
public:
|
||||
Layout1x2(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||
Layout(factory, persistentData)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
rect_t zone = getMainZone();
|
||||
|
||||
if (index == 0) {
|
||||
return {zone.x, zone.y, zone.w, zone.h / 2};
|
||||
}
|
||||
else {
|
||||
return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 2};
|
||||
}
|
||||
|
||||
return zone;
|
||||
}
|
||||
};
|
||||
|
||||
BaseLayoutFactory<Layout1x2> Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2, OPTIONS_LAYOUT_1x2);
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "layout.h"
|
||||
#include "layout_factory_impl.h"
|
||||
|
||||
const uint8_t LBM_LAYOUT_1x4[] = {
|
||||
#include "mask_layout1x4.lbm"
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_1x4[] = {
|
||||
LAYOUT_COMMON_OPTIONS,
|
||||
LAYOUT_OPTIONS_END
|
||||
};
|
||||
|
||||
class Layout1x4: public Layout
|
||||
{
|
||||
public:
|
||||
Layout1x4(const LayoutFactory * factory, Layout::PersistentData * persistentData):
|
||||
Layout(factory, persistentData)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
rect_t zone = getMainZone();
|
||||
|
||||
if (index > 3)
|
||||
{
|
||||
index = 3;
|
||||
}
|
||||
return {zone.x, zone.y + zone.h / 4 * index, zone.w, zone.h / 4};
|
||||
|
||||
return zone;
|
||||
}
|
||||
};
|
||||
|
||||
BaseLayoutFactory<Layout1x4> Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4, OPTIONS_LAYOUT_1x4);
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -83,37 +83,39 @@ void TopbarImpl::paint(BitmapBuffer * dc)
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%d-%d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
const char * const STR_MONTHS[] = TR_MONTHS;
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
#endif
|
||||
//dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, MENU_COLOR);
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS) | CENTERED| FOCUS_COLOR);
|
||||
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED);
|
||||
getTimerString(str, getValue(MIXSRC_TX_TIME));
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | FOCUS_COLOR);
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED);
|
||||
|
||||
#if defined(INTERNAL_GPS)
|
||||
if (gpsData.fix) {
|
||||
char s[10];
|
||||
sprintf(s, "%d", gpsData.numSat);
|
||||
dc->drawText(LCD_W-148, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR);
|
||||
dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR);
|
||||
}
|
||||
dc->drawBitmapPattern(LCD_W - 158, 22, LBM_TOPMENU_GPS,
|
||||
dc->drawBitmapPattern(GPS_X - 10, 22, LBM_TOPMENU_GPS,
|
||||
(gpsData.fix) ? FOCUS_COLOR : MENU_TITLE_DISABLE_COLOR);
|
||||
#endif
|
||||
|
||||
// USB icon
|
||||
if (usbPlugged()) {
|
||||
|
||||
LcdFlags flags = FOCUS_COLOR;
|
||||
if (getSelectedUsbMode() == USB_UNSELECTED_MODE) {
|
||||
flags = MENU_TITLE_DISABLE_COLOR;
|
||||
}
|
||||
|
||||
dc->drawBitmapPattern(LCD_W - 98, 8, LBM_TOPMENU_USB, flags);
|
||||
dc->drawBitmapPattern(USB_X, 8, LBM_TOPMENU_USB, flags);
|
||||
}
|
||||
// Logs
|
||||
else if (isFunctionActive(FUNCTION_LOGS) && BLINK_ON_PHASE) {
|
||||
dc->drawBitmapPattern(LCD_W - 98, 6, LBM_DOT, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(LOG_X, 6, LBM_DOT, FOCUS_COLOR);
|
||||
}
|
||||
|
||||
// RSSI
|
||||
@@ -121,7 +123,7 @@ void TopbarImpl::paint(BitmapBuffer * dc)
|
||||
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
|
||||
for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) {
|
||||
uint8_t height = rssiBarsHeight[i];
|
||||
dc->drawSolidFilledRect(LCD_W - 90 + i * 6, 38 - height, 4, height,
|
||||
dc->drawSolidFilledRect(RSSI_X + i * 6, 38 - height, 4, height,
|
||||
TELEMETRY_RSSI() >= rssiBarsValue[i]
|
||||
? FOCUS_COLOR
|
||||
: MENU_TITLE_DISABLE_COLOR);
|
||||
@@ -129,37 +131,37 @@ void TopbarImpl::paint(BitmapBuffer * dc)
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
|
||||
dc->drawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(RSSI_X - 4, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio volume */
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
|
||||
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR);
|
||||
else if (requiredSpeakerVolume < 7)
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR);
|
||||
else if (requiredSpeakerVolume < 13)
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR);
|
||||
else if (requiredSpeakerVolume < 19)
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR);
|
||||
else
|
||||
dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR);
|
||||
|
||||
/* Tx battery */
|
||||
uint8_t bars = GET_TXBATT_BARS(5);
|
||||
#if defined(USB_CHARGER)
|
||||
if (usbChargerLed()) {
|
||||
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR);
|
||||
}
|
||||
else {
|
||||
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
|
||||
}
|
||||
#else
|
||||
dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
|
||||
dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR);
|
||||
#endif
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
dc->drawSolidFilledRect(LCD_W - 128 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR);
|
||||
dc->drawSolidFilledRect(AUDIO_X - 2 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -567,6 +567,7 @@ class ModuleWindow : public FormGroup {
|
||||
channelStart->setMax(MAX_OUTPUT_CHANNELS - sentModuleChannels(moduleIdx) + 1);
|
||||
});
|
||||
channelEnd->enable(minModuleChannels(moduleIdx) < maxModuleChannels(moduleIdx));
|
||||
if (channelEnd->getValue() > channelEnd->getMax()) channelEnd->setValue(channelEnd->getMax());
|
||||
}
|
||||
|
||||
void update()
|
||||
@@ -640,10 +641,12 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Multi type (CUSTOM, brand A, brand B,...)
|
||||
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
|
||||
// Grid count for narrow/wide screen
|
||||
int count = LCD_W < LCD_H ? 1 : (g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2);
|
||||
rfChoice = new Choice(
|
||||
this,
|
||||
grid.getFieldSlot(
|
||||
g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2, 0),
|
||||
grid.getFieldSlot(count, 0),
|
||||
STR_MULTI_PROTOCOLS, MODULE_SUBTYPE_MULTI_FIRST,
|
||||
MODULE_SUBTYPE_MULTI_LAST, GET_DEFAULT(multiRfProto),
|
||||
[=](int32_t newValue) {
|
||||
@@ -658,11 +661,20 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
if (MULTIMODULE_HAS_SUBTYPE(moduleIdx)) {
|
||||
// Subtype (D16, DSMX,...)
|
||||
|
||||
// Grid count for narrow/wide screen
|
||||
count = LCD_W < LCD_H ? 1 : 2;
|
||||
int index = 1;
|
||||
if (count == 1)
|
||||
{
|
||||
grid.nextLine();
|
||||
index = 0;
|
||||
}
|
||||
const mm_protocol_definition *pdef = getMultiProtocolDefinition(
|
||||
g_model.moduleData[moduleIdx].getMultiProtocol());
|
||||
if (pdef->maxSubtype > 0) {
|
||||
mmSubProtocol = new Choice(
|
||||
this, grid.getFieldSlot(2, 1), pdef->subTypeString, 0,
|
||||
this, grid.getFieldSlot(count, index), pdef->subTypeString, 0,
|
||||
pdef->maxSubtype,
|
||||
[=]() { return g_model.moduleData[moduleIdx].subType; },
|
||||
[=](int16_t newValue) {
|
||||
|
||||
@@ -40,8 +40,13 @@ class RadioAnalogsDiagsWindow: public Window {
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
|
||||
coord_t y = 1 + (i / 2) * FH;
|
||||
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
|
||||
#if LCD_W > LCD_H
|
||||
coord_t y = 1 + (i / 2) * FH;
|
||||
uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10;
|
||||
#else
|
||||
coord_t y = 1 + i * FH;
|
||||
uint8_t x = 10;
|
||||
#endif
|
||||
dc->drawNumber(x, y, i + 1, LEADING0 | LEFT, 2);
|
||||
dc->drawText(x + 2 * 15 - 2, y, ":");
|
||||
drawHexNumber(dc, x + 3 * 15 - 1, y, anaIn(i));
|
||||
|
||||
@@ -424,8 +424,8 @@ class Theme480: public OpenTxTheme
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday);
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%d-%d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
const char * const STR_MONTHS[] = TR_MONTHS;
|
||||
sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]);
|
||||
|
||||
@@ -416,7 +416,7 @@ class FlyskyTheme: public OpenTxTheme
|
||||
gettime(&t);
|
||||
char str[10];
|
||||
|
||||
#if defined(TRANSLATIONS_CN)
|
||||
#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW)
|
||||
sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday);
|
||||
#else
|
||||
const char * const STR_MONTHS[] = TR_MONTHS;
|
||||
|
||||