1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00

Cosmetics

This commit is contained in:
Bertrand Songis 2016-08-21 12:41:12 +02:00
parent cd2b6b3864
commit b657ca1862
28 changed files with 122 additions and 97 deletions

View file

@ -143,7 +143,7 @@ else()
add_definitions(-DEEPROM) add_definitions(-DEEPROM)
endif() endif()
if(NOT ${EEPROM} STREQUAL SDCARD AND ARCH STREQUAL ARM) if(ARCH STREQUAL ARM AND NOT PCB STREQUAL HORUS AND NOT PCB STREQUAL FLAMENCO)
set(SRC ${SRC} storage/eeprom_conversions.cpp) set(SRC ${SRC} storage/eeprom_conversions.cpp)
endif() endif()

View file

@ -511,7 +511,10 @@ int cliDisplay(const char ** argv)
for (int i=MIXSRC_FIRST_SWITCH; i<=MIXSRC_LAST_SWITCH; i++) { for (int i=MIXSRC_FIRST_SWITCH; i<=MIXSRC_LAST_SWITCH; i++) {
mixsrc_t sw = i - MIXSRC_FIRST_SWITCH; mixsrc_t sw = i - MIXSRC_FIRST_SWITCH;
if (SWITCH_EXISTS(sw)) { if (SWITCH_EXISTS(sw)) {
serialPrint("[S%c] = %s", 'A'+sw, (switchState(3*sw) ? "down" : (switchState(3*sw+1) ? "mid" : "up"))); char swName[LEN_SWITCH_NAME + 1];
strAppend(swName, STR_VSWITCHES+1+sw*STR_VSWITCHES[0], STR_VSWITCHES[0]);
static const char * const SWITCH_POSITIONS[] = { "down", "mid", "up" };
serialPrint("[%s] = %s", swName, SWITCH_POSITIONS[1 + getValue(i) / 1024]);
} }
} }
} }

View file

@ -458,7 +458,6 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
#define IS_OTHER_VIEW_DISPLAYED() false #define IS_OTHER_VIEW_DISPLAYED() false
#if defined(CPUARM) #if defined(CPUARM)
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags);
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags);
#endif #endif

View file

@ -162,7 +162,7 @@ void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s); void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s) #define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
#if defined(CPUARM) #if defined(CPUARM)
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
@ -200,14 +200,7 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att); void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
void putsVBat(coord_t x, coord_t y, LcdFlags att); void putsVBat(coord_t x, coord_t y, LcdFlags att);
#if !defined(BOOT) #if !defined(CPUARM)
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, lcdint_t val, LcdFlags att=0);
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags att=0);
#endif
#if defined(CPUARM)
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t channel, lcdint_t value, LcdFlags att);
#else
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0); void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
#endif #endif

View file

@ -1100,7 +1100,7 @@ void menuModelFailsafe(uint8_t event)
const uint8_t SLIDER_W = 90; const uint8_t SLIDER_W = 90;
ch = 8 * (menuVerticalPosition / 8); ch = 8 * (menuVerticalPosition / 8);
lcd_putsCenter(0*FH, FAILSAFESET); lcdDrawTextAlignedCenter(0*FH, FAILSAFESET);
lcdInvertLine(0); lcdInvertLine(0);
uint8_t col = 0; uint8_t col = 0;

View file

@ -127,7 +127,7 @@ void menuFirstCalib(uint8_t event)
chainMenu(menuMainView); chainMenu(menuMainView);
} }
else { else {
lcd_putsCenter(0*FH, MENUCALIBRATION); lcdDrawTextAlignedCenter(0*FH, MENUCALIBRATION);
lcdInvertLine(0); lcdInvertLine(0);
menuCommonCalib(event); menuCommonCalib(event);
} }

View file

@ -53,10 +53,10 @@ void menuChannelsView(uint8_t event)
#ifdef MIXERS_MONITOR #ifdef MIXERS_MONITOR
if (mixersView) if (mixersView)
lcd_putsCenter(0*FH, MIXERS_MONITOR); lcdDrawTextAlignedCenter(0*FH, MIXERS_MONITOR);
else else
#endif #endif
lcd_putsCenter(0*FH, CHANNELS_MONITOR); lcdDrawTextAlignedCenter(0*FH, CHANNELS_MONITOR);
lcdInvertLine(0); lcdInvertLine(0);

View file

@ -88,7 +88,6 @@ void updateProgressBar(int num, int den);
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max); void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max);
void drawColumnHeader(const char * const * headers, uint8_t index); void drawColumnHeader(const char * const * headers, uint8_t index);
void drawStick(coord_t centrex, int16_t xval, int16_t yval); void drawStick(coord_t centrex, int16_t xval, int16_t yval);
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags att);
void drawAlertBox(const char * title, const char * text, const char * action); void drawAlertBox(const char * title, const char * text, const char * action);
#define ALERT_SOUND_ARG , uint8_t sound #define ALERT_SOUND_ARG , uint8_t sound

View file

@ -117,7 +117,7 @@ void lcdDrawText(coord_t x, coord_t y, const pm_char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len); void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s); void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s) #define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
@ -139,12 +139,6 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att); void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
void putsVBat(coord_t x, coord_t y, LcdFlags att); void putsVBat(coord_t x, coord_t y, LcdFlags att);
#if !defined(BOOT)
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags att=0);
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t source, int32_t val, LcdFlags att=0);
#endif
#define putstime_t int32_t #define putstime_t int32_t
void drawRtcTime(coord_t x, coord_t y, LcdFlags att); void drawRtcTime(coord_t x, coord_t y, LcdFlags att);

View file

@ -1068,7 +1068,7 @@ void menuModelFailsafe(uint8_t event)
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH); lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
} }
lcd_putsCenter(0*FH, FAILSAFESET); lcdDrawTextAlignedCenter(0*FH, FAILSAFESET);
lcdInvertLine(0); lcdInvertLine(0);
unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2; unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2;

View file

@ -212,7 +212,7 @@ void menuFirstCalib(uint8_t event)
chainMenu(menuMainView); chainMenu(menuMainView);
} }
else { else {
lcd_putsCenter(0*FH, MENUCALIBRATION); lcdDrawTextAlignedCenter(0*FH, MENUCALIBRATION);
lcdInvertLine(0); lcdInvertLine(0);
menuCommonCalib(event); menuCommonCalib(event);
} }

View file

@ -53,10 +53,10 @@ void menuChannelsView(uint8_t event)
#ifdef MIXERS_MONITOR #ifdef MIXERS_MONITOR
if (mixersView) if (mixersView)
lcd_putsCenter(0*FH, MIXERS_MONITOR); lcdDrawTextAlignedCenter(0*FH, MIXERS_MONITOR);
else else
#endif #endif
lcd_putsCenter(0*FH, CHANNELS_MONITOR); lcdDrawTextAlignedCenter(0*FH, CHANNELS_MONITOR);
lcdInvertLine(0); lcdInvertLine(0);

View file

@ -94,7 +94,7 @@ extern Layout * customScreens[MAX_CUSTOM_SCREENS];
extern Topbar * topbar; extern Topbar * topbar;
void drawAlertBox(const char * title, const char * text, const char * action); void drawAlertBox(const char * title, const char * text, const char * action);
void showAlertBox(const pm_char * title, const pm_char * text, const char * action, uint8_t sound); void showAlertBox(const char * title, const char * text, const char * action, uint8_t sound);
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView #define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() false #define IS_TELEMETRY_VIEW_DISPLAYED() false

View file

@ -64,7 +64,7 @@ void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_
lcdNextPos = x + width; lcdNextPos = x + width;
} }
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags) void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
{ {
uint32_t fontindex = FONTINDEX(flags); uint32_t fontindex = FONTINDEX(flags);
const pm_uchar * font = fontsTable[fontindex]; const pm_uchar * font = fontsTable[fontindex];
@ -210,51 +210,16 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
} }
#endif #endif
void drawRtcTime(coord_t x, coord_t y, LcdFlags att) void drawRtcTime(coord_t x, coord_t y, LcdFlags flags)
{ {
drawTimer(x, y, getValue(MIXSRC_TX_TIME), att); drawTimer(x, y, getValue(MIXSRC_TX_TIME), flags);
} }
void getTimerString(char * str, putstime_t tme, LcdFlags att) void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags flags)
{ {
div_t qr; char str[LEN_TIMER_STRING];
getTimerString(str, tme, flags & TIMEHOUR);
if (tme < 0) { lcdDrawText(x, y, str, flags);
// TODO lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
tme = -tme;
*str++ = '-';
}
qr = div(tme, 60);
if (att & TIMEHOUR) {
div_t qr2 = div(qr.quot, 60);
*str++ = '0' + (qr2.quot/10);
*str++ = '0' + (qr2.quot%10);
*str++ = ':';
qr.quot = qr2.rem;
}
*str++ = '0' + (qr.quot/10);
*str++ = '0' + (qr.quot%10);
*str++ = ':';
*str++ = '0' + (qr.rem/10);
*str++ = '0' + (qr.rem%10);
*str = '\0';
}
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att)
{
char str[LEN_TIMER_STRING]; // "-00:00:00"
getTimerString(str, tme, att);
lcdDrawText(x, y, str, att);
}
void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, int idx, LcdFlags att, const char * prefix)
{
char s[64];
strAppendUnsigned(strAppend(strAppend(s, prefix), str), abs(idx));
lcdDrawText(x, y, s, att);
} }
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att) void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
@ -355,6 +320,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att) void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
{ {
// TODO
if (att & DBLSIZE) { if (att & DBLSIZE) {
x -= 42; x -= 42;
att &= ~0x0F00; // TODO constant att &= ~0x0F00; // TODO constant

View file

@ -107,9 +107,9 @@ extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
extern coord_t lcdNextPos; extern coord_t lcdNextPos;
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=0); void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags=0);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=0); void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags flags=0);
inline void lcdClear() inline void lcdClear()
{ {
@ -141,14 +141,8 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
#define putsChn(x, y, idx, att) drawSource(x, y, MIXSRC_CH1+idx-1, att) #define putsChn(x, y, idx, att) drawSource(x, y, MIXSRC_CH1+idx-1, att)
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr); void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags att=0);
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags att=0);
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t channel, int32_t val, LcdFlags att=0);
#define putstime_t int32_t #define putstime_t int32_t
#define LEN_TIMER_STRING 10
void getTimerString(char * str, putstime_t tme, LcdFlags att=0);
void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0); void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0);
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0); void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);

View file

@ -159,6 +159,7 @@ enum ExposFields {
EXPO_FIELD_INPUT_NAME, EXPO_FIELD_INPUT_NAME,
EXPO_FIELD_NAME, EXPO_FIELD_NAME,
EXPO_FIELD_SOURCE, EXPO_FIELD_SOURCE,
EXPO_FIELD_SCALE,
EXPO_FIELD_WEIGHT, EXPO_FIELD_WEIGHT,
EXPO_FIELD_OFFSET, EXPO_FIELD_OFFSET,
CASE_CURVES(EXPO_FIELD_CURVE) CASE_CURVES(EXPO_FIELD_CURVE)
@ -175,7 +176,7 @@ bool menuModelExpoOne(event_t event)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/}); SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)0 : (uint8_t)HIDDEN_ROW), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR); lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR); lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@ -244,6 +245,12 @@ bool menuModelExpoOne(event_t event)
} }
break; break;
case EXPO_FIELD_SCALE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SCALE);
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr);
if (attr) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
break;
case EXPO_FIELD_WEIGHT: case EXPO_FIELD_WEIGHT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WEIGHT); lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WEIGHT);
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, LEFT|attr, 0, event); ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, MIN_EXPO_WEIGHT, 100, LEFT|attr, 0, event);

View file

@ -45,7 +45,7 @@ void runPopupWarningBox()
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_WARNING); // lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_WARNING);
} }
void displayMessageBox() void drawMessageBox()
{ {
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_INFO); // theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_INFO);
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR); // lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
@ -69,7 +69,7 @@ void showAlertBox(const char * title, const char * text, const char * action, ui
void showMessageBox(const char * title) void showMessageBox(const char * title)
{ {
// displayMessageBox(); // drawMessageBox();
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR); lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR);
lcdRefresh(); lcdRefresh();
} }

View file

@ -33,7 +33,7 @@ bool menuRadioTrainer(event_t event)
MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ }); MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) { if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR); // TODO lcdDrawTextAlignedCenter(5*FH, STR_SLAVE, TEXT_COLOR);
return true; return true;
} }

View file

@ -37,7 +37,7 @@ bool menuRadioVersion(event_t event)
DEBUG_TIMER_STOP(debugTimerDrawText); DEBUG_TIMER_STOP(debugTimerDrawText);
// TODO EEPROM erase + backup // TODO EEPROM erase + backup
// lcd_putsCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP); // lcdDrawTextAlignedCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// if (event == EVT_KEY_LONG(KEY_ENTER)) { // if (event == EVT_KEY_LONG(KEY_ENTER)) {
// eepromBackup(); // eepromBackup();
// } // }

View file

@ -130,7 +130,7 @@ bool menuTextView(event_t event)
#if defined(SIMU) #if defined(SIMU)
if (!strncmp(title, "./", 2)) title += 2; if (!strncmp(title, "./", 2)) title += 2;
#endif #endif
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR); lcdDrawTextAlignedCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
#endif #endif
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES); drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES);

View file

@ -40,3 +40,10 @@ if(ARCH STREQUAL ARM)
gui/common/arm/widgets.cpp gui/common/arm/widgets.cpp
) )
endif() endif()
if(PCB STREQUAL FLAMENCO OR PCB STREQUAL HORUS)
set(SRC
${SRC}
gui/common/colorlcd/widgets.cpp
)
endif()

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* 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 "opentx.h"
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags, const char * prefix)
{
char s[64];
strAppendUnsigned(strAppend(strAppend(s, prefix), str), abs(idx));
lcdDrawText(x, y, s, flags);
}

View file

@ -79,10 +79,13 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
#if defined(CPUARM) #if defined(CPUARM)
#include "telemetry/telemetry_sensors.h" #include "telemetry/telemetry_sensors.h"
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags att=0); void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att); void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags); void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags=0);
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags); void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags flags=0);
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
#endif #endif
void drawCurve(coord_t offset=0); void drawCurve(coord_t offset=0);

View file

@ -482,7 +482,7 @@ bool isSourceAvailableInResetSpecialFunction(int index)
bool isModuleAvailable(int module) bool isModuleAvailable(int module)
{ {
#if defined(CROSSFIRE) #if defined(CROSSFIRE) && !defined(PCBFLAMENCO)
if (module == MODULE_TYPE_CROSSFIRE && g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF) { if (module == MODULE_TYPE_CROSSFIRE && g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF) {
return false; return false;
} }

View file

@ -160,6 +160,36 @@ char * getStringWithIndex(char * dest, const char * s, int idx)
return dest; return dest;
} }
char * getTimerString(char * dest, putstime_t tme, uint8_t hours)
{
char * s = dest;
div_t qr;
if (tme < 0) {
tme = -tme;
*s++ = '-';
}
qr = div(tme, 60);
if (hours) {
div_t qr2 = div(qr.quot, 60);
*s++ = '0' + (qr2.quot / 10);
*s++ = '0' + (qr2.quot % 10);
*s++ = ':';
qr.quot = qr2.rem;
}
*s++ = '0' + (qr.quot / 10);
*s++ = '0' + (qr.quot % 10);
*s++ = ':';
*s++ = '0' + (qr.rem / 10);
*s++ = '0' + (qr.rem % 10);
*s = '\0';
return dest;
}
char * getCurveString(char * dest, int idx) char * getCurveString(char * dest, int idx)
{ {
if (idx == 0) { if (idx == 0) {

View file

@ -31,6 +31,8 @@ char * strAppendFilename(char * dest, const char * filename, const int size);
#if defined(CPUARM) && !defined(BOOT) #if defined(CPUARM) && !defined(BOOT)
char * getStringAtIndex(char * dest, const char * s, int idx); char * getStringAtIndex(char * dest, const char * s, int idx);
char * getStringWithIndex(char * dest, const char * s, int idx); char * getStringWithIndex(char * dest, const char * s, int idx);
#define LEN_TIMER_STRING 10 // "-00:00:00"
char * getTimerString(char * dest, int32_t tme, uint8_t hours=0);
char * getCurveString(char * dest, int idx); char * getCurveString(char * dest, int idx);
char * getSwitchString(char * dest, swsrc_t idx); char * getSwitchString(char * dest, swsrc_t idx);
char * getSourceString(char * dest, mixsrc_t idx); char * getSourceString(char * dest, mixsrc_t idx);