diff --git a/companion/src/firmwares/er9x/simulator/er9xsimulator.cpp b/companion/src/firmwares/er9x/simulator/er9xsimulator.cpp index 76c01074b..84f8bb6c2 100644 --- a/companion/src/firmwares/er9x/simulator/er9xsimulator.cpp +++ b/companion/src/firmwares/er9x/simulator/er9xsimulator.cpp @@ -172,8 +172,7 @@ bool Er9xSimulator::timer10ms() uint8_t * Er9xSimulator::getLcd() { -#define GETLCD_IMPORT -#include "simulatorimport.h" + return (::uint8_t *)simuLcdBuf; } bool Er9xSimulator::lcdChanged(bool & lightEnable) diff --git a/companion/src/firmwares/ersky9x/simulator/ersky9xsimulator.cpp b/companion/src/firmwares/ersky9x/simulator/ersky9xsimulator.cpp index 71842d91e..d9103710b 100644 --- a/companion/src/firmwares/ersky9x/simulator/ersky9xsimulator.cpp +++ b/companion/src/firmwares/ersky9x/simulator/ersky9xsimulator.cpp @@ -194,8 +194,7 @@ bool Ersky9xSimulator::timer10ms() uint8_t * Ersky9xSimulator::getLcd() { -#define GETLCD_IMPORT -#include "simulatorimport.h" + return (::uint8_t *)simuLcdBuf; } bool Ersky9xSimulator::lcdChanged(bool & lightEnable) diff --git a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp index 44b83b27c..96c35f879 100644 --- a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp @@ -485,8 +485,7 @@ bool OpenTxSimulator::timer10ms() ::uint8_t * OpenTxSimulator::getLcd() { -#define GETLCD_IMPORT -#include "simulatorimport.h" + return (::uint8_t *)simuLcdBuf; } bool OpenTxSimulator::lcdChanged(bool & lightEnable) diff --git a/companion/src/firmwares/th9x/simulator/th9xsimulator.cpp b/companion/src/firmwares/th9x/simulator/th9xsimulator.cpp index 7628a575a..35d332a57 100644 --- a/companion/src/firmwares/th9x/simulator/th9xsimulator.cpp +++ b/companion/src/firmwares/th9x/simulator/th9xsimulator.cpp @@ -175,8 +175,7 @@ bool Th9xSimulator::timer10ms() uint8_t * Th9xSimulator::getLcd() { -#define GETLCD_IMPORT -#include "simulatorimport.h" + return (::uint8_t *)simuLcdBuf; } bool Th9xSimulator::lcdChanged(bool & lightEnable) diff --git a/companion/src/simulation/simulatorimport.h b/companion/src/simulation/simulatorimport.h index 01b86bd96..fc5298cbe 100644 --- a/companion/src/simulation/simulatorimport.h +++ b/companion/src/simulation/simulatorimport.h @@ -96,11 +96,6 @@ per10ms(); return true; #endif -#ifdef GETLCD_IMPORT -#undef GETLCD_IMPORT -return (::uint8_t *)simuLcdBuf; -#endif - #ifdef GETERROR_IMPORT #undef GETERROR_IMPORT return main_thread_error; diff --git a/radio/src/Makefile b/radio/src/Makefile index 0c251b6ae..fda5b34d0 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -1090,7 +1090,7 @@ ifeq ($(PCB), FLAMENCO) TRGT = arm-none-eabi- MCU = cortex-m4 OPT = 2 - CPPDEFS += -DHSE_VALUE=12000000 -DCOLORLCD -DSTM32F40_41xxx + CPPDEFS += -DHSE_VALUE=12000000 -DCOLORLCD -DSTM32F40_41xxx -DPPM_PIN_HW_SERIAL BITMAPS += $(patsubst %.png,%.lbm,$(wildcard bitmaps/Flamenco/*.png)) FONTS = fonts/Flamenco/font_stdsize.lbm fonts/Flamenco/font_tinsize.lbm fonts/Flamenco/font_smlsize.lbm fonts/Flamenco/font_midsize.lbm fonts/Flamenco/font_dblsize.lbm fonts/Flamenco/font_xxlsize.lbm SDCARD = YES @@ -1887,7 +1887,7 @@ else FONTNAME = Roboto TINSIZE = 5 SMLSIZE = 7 - STDSIZE = 8 + STDSIZE = 11 MIDSIZE = 11 DBLSIZE = 14 DBLBOLD = False diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index 76dbc244f..272a5de06 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -226,6 +226,27 @@ const MemArea memAreas[] = { { NULL, NULL, 0 }, }; +int cliSet(const char ** argv) +{ + if (!strcmp(argv[1], "rtc")) { + struct gtm t; + int year, month, day, hour, minute, second; + if (toInt(argv, 2, &year) > 0 && toInt(argv, 3, &month) > 0 && toInt(argv, 4, &day) > 0 && toInt(argv, 5, &hour) > 0 && toInt(argv, 6, &minute) > 0 && toInt(argv, 7, &second) > 0) { + t.tm_year = year-1900; + t.tm_mon = month-1; + t.tm_mday = day; + t.tm_hour = hour; + t.tm_min = minute; + t.tm_sec = second; + rtcSetTime(&t); + } + else { + serialPrint("%s: Invalid arguments \"%s\" \"%s\"", argv[0], argv[1], argv[2]); + } + } + return 0; +} + int cliDisplay(const char ** argv) { long long int address = 0; @@ -246,7 +267,7 @@ int cliDisplay(const char ** argv) serialPrint("[%s] = %s", name, switchState(EnumKeys(i)) ? "on" : "off"); } #if defined(ROTARY_ENCODER_NAVIGATION) || defined(REV9E) || defined(PCBHORUS) || defined(PCBFLAMENCO) - serialPrint("[Enc.] = %d", rotencValue / 2); + serialPrint("[Enc.] = %d", rotencValue / 2); #endif for (int i=TRM_BASE; i<=TRM_LAST; i++) { serialPrint("[Trim%d] = %s", i-TRM_BASE, switchState(EnumKeys(i)) ? "on" : "off"); @@ -268,10 +289,10 @@ int cliDisplay(const char ** argv) serialPrint("outputs[%d] = %04X", i, channelOutputs[i]); } } - else if (!strcmp(argv[1], "time")) { + else if (!strcmp(argv[1], "rtc")) { struct gtm utm; gettime(&utm); - serialPrint("time = %4d-%02d-%02d %02d:%02d:%02d.%02d0", utm.tm_year+1900, utm.tm_mon+1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec, g_ms100); + serialPrint("rtc = %4d-%02d-%02d %02d:%02d:%02d.%02d0", utm.tm_year+1900, utm.tm_mon+1, utm.tm_mday, utm.tm_hour, utm.tm_min, utm.tm_sec, g_ms100); } #if defined(PCBFLAMENCO) else if (!strcmp(argv[1], "bq24195")) { @@ -358,6 +379,7 @@ const CliCommand cliCommands[] = { { "ls", cliLs, "" }, { "play", cliPlay, "" }, { "print", cliDisplay, "
[] | " }, + { "set", cliSet, " " }, { "stackinfo", cliStackInfo, "" }, { "trace", cliTrace, "on | off" }, { "volume", cliVolume, "" }, diff --git a/radio/src/gui/Horus/menu_model_limits.cpp b/radio/src/gui/Horus/menu_model_limits.cpp index d7bd919b3..e0102d19a 100644 --- a/radio/src/gui/Horus/menu_model_limits.cpp +++ b/radio/src/gui/Horus/menu_model_limits.cpp @@ -155,7 +155,7 @@ bool menuModelLimits(evt_t event) // last line available - add the "copy trim menu" line uint8_t attr = (sub==NUM_CHNOUT) ? INVERS : 0; // TODO CENTER attribute - lcdDrawText(100, y, STR_TRIMS2OFFSETS, noHighlightCounter ? 0 : attr); + lcdDrawText(100, y, STR_TRIMS2OFFSETS, NO_HIGHLIGHT() ? 0 : attr); if (attr) { s_editMode = 0; if (event==EVT_KEY_LONG(KEY_ENTER)) { diff --git a/radio/src/gui/Horus/menu_model_setup.cpp b/radio/src/gui/Horus/menu_model_setup.cpp index 33bf5fb41..6eb118305 100644 --- a/radio/src/gui/Horus/menu_model_setup.cpp +++ b/radio/src/gui/Horus/menu_model_setup.cpp @@ -323,7 +323,7 @@ bool menuModelSetup(evt_t event) case ITEM_MODEL_EXTENDED_TRIMS: lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ETRIMS); g_model.extendedTrims = onoffMenuItem(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0); - lcdDrawText(MODEL_SETUP_2ND_COLUMN+18, y, STR_RESET_BTN, menuHorizontalPosition>0 && !noHighlightCounter ? attr : 0); + lcdDrawText(MODEL_SETUP_2ND_COLUMN+18, y, STR_RESET_BTN, menuHorizontalPosition>0 && !NO_HIGHLIGHT() ? attr : 0); if (attr && menuHorizontalPosition>0) { s_editMode = 0; if (event==EVT_KEY_LONG(KEY_ENTER)) { @@ -746,7 +746,7 @@ bool menuModelFailsafe(evt_t event) // Value LcdFlags flags = TINSIZE; - if (menuVerticalPosition == ch && !noHighlightCounter) { + if (menuVerticalPosition == ch && !NO_HIGHLIGHT()) { flags |= INVERS; if (s_editMode) flags |= BLINK; diff --git a/radio/src/keys.h b/radio/src/keys.h index 559f06003..d3322fa39 100644 --- a/radio/src/keys.h +++ b/radio/src/keys.h @@ -46,7 +46,14 @@ enum EnumKeys { KEY_DOWN, KEY_RIGHT, KEY_LEFT, -#elif defined(PCBTARANIS) || defined(PCBFLAMENCO) +#elif defined(PCBFLAMENCO) + KEY_MENU, + KEY_EXIT, + KEY_ENTER, + KEY_PAGE, + KEY_PLUS, // TODO remove + KEY_MINUS, // TODO remove +#elif defined(PCBTARANIS) KEY_MENU, KEY_EXIT, KEY_ENTER, @@ -259,7 +266,7 @@ class Key extern Key keys[NUM_KEYS]; -#if defined(PCBHORUS) +#if defined(COLORLCD) typedef uint16_t evt_t; #else typedef uint8_t evt_t; diff --git a/radio/src/main_arm.cpp b/radio/src/main_arm.cpp index b47b5247a..8d42dda25 100644 --- a/radio/src/main_arm.cpp +++ b/radio/src/main_arm.cpp @@ -165,7 +165,7 @@ void guiMain(evt_t evt) TIME_MEASURE_STOP(storebackup); } if (popupDisplayed == false || evt) { - lcdRestoreBackupBuffer(); + popupDisplayed = lcdRestoreBackupBuffer(); if (warn) DISPLAY_WARNING(evt); if (menu) { const char * result = displayPopupMenu(evt); @@ -176,7 +176,6 @@ void guiMain(evt_t evt) } } refreshNeeded = true; - popupDisplayed = true; } } else { diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 3cde4bdff..d779409ba 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -2015,6 +2015,7 @@ enum MixSources { MIXSRC_SC, LUA_EXPORT("sc", "Switch C") MIXSRC_SE, LUA_EXPORT("se", "Switch E") MIXSRC_SF, LUA_EXPORT("sf", "Switch F") + MIXSRC_LAST_SWITCH = MIXSRC_SF, #elif defined(PCBTARANIS) || defined(PCBHORUS) MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A") MIXSRC_SB, LUA_EXPORT("sb", "Switch B") diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 26f57ea7b..63d448448 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -470,17 +470,7 @@ #define MAX_TRAINER_CHANNELS() (8) #endif -#if defined(PCBFLAMENCO) - #define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM)) - #define IS_MODULE_XJT(idx) ((g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF)) - #if defined(DSM2) - #define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_DSM2) - #else - #define IS_MODULE_DSM2(idx) (false) - #endif - #define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[1].rfProtocol] : maxChannelsModules[g_model.externalModule]) - #define MAX_CHANNELS(idx) (idx==EXTERNAL_MODULE ? MAX_EXTERNAL_MODULE_CHANNELS() : MAX_TRAINER_CHANNELS()) -#elif defined(PCBTARANIS) +#if defined(PCBTARANIS) #if defined(TARANIS_INTERNAL_PPM) #define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==INTERNAL_MODULE && g_model.moduleData[INTERNAL_MODULE].type==MODULE_TYPE_PPM)|| (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM)) #define IS_MODULE_XJT(idx) (((idx==INTERNAL_MODULE && g_model.moduleData[INTERNAL_MODULE].type==MODULE_TYPE_XJT)|| (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT)) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF)) diff --git a/radio/src/pulses/dsm2_arm.cpp b/radio/src/pulses/dsm2_arm.cpp index 774a5caf8..92ae05c48 100644 --- a/radio/src/pulses/dsm2_arm.cpp +++ b/radio/src/pulses/dsm2_arm.cpp @@ -162,6 +162,7 @@ void setupPulsesDSM2(unsigned int port) else if (moduleFlag[port] == MODULE_RANGECHECK) dsmDat[0] |= DSM2_SEND_RANGECHECK; #else +#if defined(PCBSKY9X) // TODO needed? if (dsm2BindTimer > 0) { dsm2BindTimer--; if (switchState(SW_DSM2_BIND)) { @@ -169,7 +170,9 @@ void setupPulsesDSM2(unsigned int port) dsmDat[0] |= DSM2_SEND_BIND; } } - else if (moduleFlag[port] == MODULE_RANGECHECK) { + else +#endif + if (moduleFlag[port] == MODULE_RANGECHECK) { dsmDat[0] |= DSM2_SEND_RANGECHECK; } else { diff --git a/radio/src/pulses/ppm_arm.cpp b/radio/src/pulses/ppm_arm.cpp index 44dc5cb04..f08dda699 100644 --- a/radio/src/pulses/ppm_arm.cpp +++ b/radio/src/pulses/ppm_arm.cpp @@ -61,11 +61,7 @@ void setupPulsesPPM(unsigned int port) // Don't enable interru PpmPulsesData * ppmPulsesData = (port == TRAINER_MODULE ? &trainerPulsesData.ppm : &modulePulsesData[port].ppm); uint16_t * ptr = ppmPulsesData->pulses; -#if defined(PPM_PIN_HW_SERIAL) - ppmPulsesData->index = 0; -#else ppmPulsesData->ptr = ptr; -#endif int32_t rest = 22500u * 2; rest += (int32_t(g_model.moduleData[port].ppmFrameLength)) * 1000; diff --git a/radio/src/pulses/pulses_arm.h b/radio/src/pulses/pulses_arm.h index 118b45db2..1484c0f0d 100644 --- a/radio/src/pulses/pulses_arm.h +++ b/radio/src/pulses/pulses_arm.h @@ -47,11 +47,12 @@ extern uint8_t s_current_protocol[NUM_MODULES]; extern uint8_t s_pulses_paused; extern uint16_t failsafeCounter[NUM_MODULES]; -#if defined(PPM_PIN_HW_SERIAL) PACK(struct PpmPulsesData { uint16_t pulses[20]; - uint32_t index; + uint16_t * ptr; }); + +#if defined(PPM_PIN_HW_SERIAL) PACK(struct PxxPulsesData { uint8_t pulses[64]; uint8_t *ptr; @@ -68,10 +69,6 @@ PACK(struct Dsm2PulsesData { uint8_t serialBitCount; }); #else -PACK(struct PpmPulsesData { - uint16_t pulses[20]; - uint16_t *ptr; -}); PACK(struct PxxPulsesData { uint16_t pulses[400]; uint16_t *ptr; diff --git a/radio/src/targets/Horus/board_horus.h b/radio/src/targets/Horus/board_horus.h index 867b293a9..080721782 100644 --- a/radio/src/targets/Horus/board_horus.h +++ b/radio/src/targets/Horus/board_horus.h @@ -250,7 +250,7 @@ void lcdRefresh(void); void lcdDrawSolidFilledRectDMA(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color); void lcdDrawBitmapDMA(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const uint8_t * bitmap); void lcdStoreBackupBuffer(void); -void lcdRestoreBackupBuffer(void); +bool lcdRestoreBackupBuffer(void); // Backlight driver #define setBacklight(xx) diff --git a/radio/src/targets/Horus/lcd_driver.cpp b/radio/src/targets/Horus/lcd_driver.cpp index 3137f008e..ea1646a13 100644 --- a/radio/src/targets/Horus/lcd_driver.cpp +++ b/radio/src/targets/Horus/lcd_driver.cpp @@ -519,10 +519,11 @@ void lcdStoreBackupBuffer() DMAcopy(src, dest, DISPLAY_BUFFER_SIZE); } -void lcdRestoreBackupBuffer() +bool lcdRestoreBackupBuffer() { uint16_t * dest = (uint16_t *)CurrentFrameBuffer, * src = (uint16_t *)LCD_BACKUP_FRAME_BUFFER; DMAcopy(src, dest, DISPLAY_BUFFER_SIZE); + return true; } void lcdRefresh() diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 03ebf0092..c01ef7524 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -1277,16 +1277,19 @@ void lcdRefresh() simuLcdRefresh = true; } +#if !defined(PCBFLAMENCO) display_t simuLcdBackupBuf[DISPLAY_BUFFER_SIZE]; void lcdStoreBackupBuffer() { memcpy(simuLcdBackupBuf, displayBuf, sizeof(simuLcdBackupBuf)); } -void lcdRestoreBackupBuffer() +bool lcdRestoreBackupBuffer() { memcpy(displayBuf, simuLcdBackupBuf, sizeof(displayBuf)); + return true; } +#endif #if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS) void pwrInit() { } diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 587d85620..821ff0ea7 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -448,6 +448,9 @@ #if defined(PCBHORUS) #define LEN_VKEYS "\006" #define TR_VKEYS "Menu\0 ""Exit\0 ""Enter\0""Up\0 ""Down\0 ""Right\0""Left" +#elif defined(PCBFLAMENCO) +#define LEN_VKEYS "\005" +#define TR_VKEYS "Menu\0""Exit\0""Enter""Page\0""Plus\0""Minus" #elif defined(PCBTARANIS) #define LEN_VKEYS "\005" #define TR_VKEYS "Menu\0""Exit\0""Enter""Page\0""Plus\0""Minus" diff --git a/radio/util/font2png.py b/radio/util/font2png.py index ef24ac825..a07a02a05 100755 --- a/radio/util/font2png.py +++ b/radio/util/font2png.py @@ -49,8 +49,10 @@ def createFontBitmap(filename, fontname, fontsize, fontbold, foreground, backgro width = getFontWidth(fontsize, metrics) top, bottom = getFontTopBottom(fontsize, metrics) - extraImage = QtGui.QImage("fonts/extra_%dpx.png" % fontsize) + extraFilename = "fonts/extra_%dpx.png" % fontsize + extraImage = QtGui.QImage(extraFilename) if extraImage.isNull(): + print "No extra font file", extraFilename extraWidth = 0 else: extraWidth = extraImage.size().width()