diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index f2c588182..9734656e0 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -476,7 +476,7 @@ PACK(struct ModuleData { uint8_t spare2:1; int8_t refreshRate; // definition as framelength for ppm (* 5 + 225 = time in 1/10 ms) } sbus); - NOBACKUP(struct { + NOBACKUP(PACK(struct { uint8_t power:2; // 0=10 mW, 1=100 mW, 2=500 mW, 3=1W uint8_t external_antenna:1; // false = internal antenna, true = external antenna #if defined(PCBHORUS) @@ -497,7 +497,7 @@ PACK(struct ModuleData { NOBACKUP(inline void clearReceiverSlot(uint8_t receiver) { setReceiverSlot(receiver, 0); }) - } pxx2); + }) pxx2); }; // Helper functions to set both of the rfProto protocol at the same time @@ -916,7 +916,12 @@ static inline void check_struct() CHKSIZE(LogicalSwitchData, 9); CHKSIZE(TelemetrySensor, 13); - CHKSIZE(ModuleData, 12); + +#if defined(PCBHORUS) + CHKSIZE(ModuleData, 9); +#else + CHKSIZE(ModuleData, 6); +#endif CHKSIZE(GVarData, 7); @@ -943,7 +948,7 @@ static inline void check_struct() CHKSIZE(ModelData, 5188); #elif defined(PCBHORUS) CHKSIZE(RadioData, 855); - CHKSIZE(ModelData, 9777); + CHKSIZE(ModelData, 9771); #endif #undef CHKSIZE diff --git a/radio/src/gui/128x64/menus.h b/radio/src/gui/128x64/menus.h index 22b0fc206..3c3308b06 100644 --- a/radio/src/gui/128x64/menus.h +++ b/radio/src/gui/128x64/menus.h @@ -73,7 +73,6 @@ inline MenuHandlerFunc lastPopMenu() } void onMainViewMenu(const char * result); - void menuFirstCalib(event_t event); void menuMainView(event_t event); void menuViewTelemetryFrsky(event_t event); @@ -83,11 +82,9 @@ enum MenuRadioIndexes { MENU_RADIO_SETUP, CASE_SDCARD(MENU_RADIO_SD_MANAGER) + MENU_RADIO_TOOLS, MENU_RADIO_SPECIAL_FUNCTIONS, MENU_RADIO_TRAINER, -#if defined(RADIO_SPECTRUM) - MENU_RADIO_SPECTRUM, -#endif MENU_RADIO_HARDWARE, MENU_RADIO_VERSION, MENU_RADIO_PAGES_COUNT @@ -101,17 +98,16 @@ void menuRadioVersion(event_t event); void menuRadioDiagKeys(event_t event); void menuRadioDiagAnalogs(event_t event); void menuRadioHardware(event_t event); +void menuRadioTools(event_t event); void menuRadioSpectrum(event_t event); void menuRadioCalibration(event_t event); static const MenuHandlerFunc menuTabGeneral[] = { menuRadioSetup, CASE_SDCARD(menuRadioSdManager) + menuRadioTools, menuRadioSpecialFunctions, menuRadioTrainer, -#if defined(RADIO_SPECTRUM) - menuRadioSpectrum, -#endif menuRadioHardware, menuRadioVersion }; diff --git a/radio/src/gui/128x64/radio_spectrum.cpp b/radio/src/gui/128x64/radio_spectrum.cpp index 47a099b46..2fab450da 100644 --- a/radio/src/gui/128x64/radio_spectrum.cpp +++ b/radio/src/gui/128x64/radio_spectrum.cpp @@ -22,7 +22,7 @@ void menuRadioSpectrum(event_t event) { - SIMPLE_MENU("SPECTRUM ANALYSER", menuTabGeneral, MENU_RADIO_SPECTRUM, 1); + SIMPLE_SUBMENU("SPECTRUM ANALYSER", 1); if (menuEvent) { INTERNAL_MODULE_OFF(); diff --git a/radio/src/gui/128x64/radio_tools.cpp b/radio/src/gui/128x64/radio_tools.cpp new file mode 100644 index 000000000..55e772237 --- /dev/null +++ b/radio/src/gui/128x64/radio_tools.cpp @@ -0,0 +1,42 @@ +/* + * 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 addRadioTool(uint8_t index, const char * label, void (* tool)(event_t event), event_t event) +{ + int8_t sub = menuVerticalPosition - HEADER_LINE; + LcdFlags attr = (sub == index ? INVERS : 0); + coord_t y = MENU_HEADER_HEIGHT + 1 + index * FH; + lcdDrawNumber(3, y, index + 1, LEADING0|LEFT, 2); + lcdDrawText(3*FW, y, label, (sub == index ? INVERS : 0)); + if (attr && s_editMode > 0) { + s_editMode = 0; + pushMenu(tool); + } +} + +void menuRadioTools(event_t event) +{ + SIMPLE_MENU("TOOLS", menuTabGeneral, MENU_RADIO_TOOLS, HEADER_LINE + 1); + + addRadioTool(0, "Spectrum Analyser", menuRadioSpectrum, event); + +} \ No newline at end of file diff --git a/radio/src/gui/480x272/bitmapbuffer.cpp b/radio/src/gui/480x272/bitmapbuffer.cpp index 67fb457e4..ae38a8500 100644 --- a/radio/src/gui/480x272/bitmapbuffer.cpp +++ b/radio/src/gui/480x272/bitmapbuffer.cpp @@ -387,7 +387,7 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l #if defined(BOOT) unsigned char c = *s; #else - unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s; + unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s; #endif if (setpos) { pos = c; diff --git a/radio/src/gui/480x272/lcd.cpp b/radio/src/gui/480x272/lcd.cpp index 3d5fae358..a9f9075ab 100644 --- a/radio/src/gui/480x272/lcd.cpp +++ b/radio/src/gui/480x272/lcd.cpp @@ -130,7 +130,7 @@ int getTextWidth(const char * s, int len, LcdFlags flags) for (int i=0; len==0 || i +#include #include "opentx.h" #include "storage/modelslist.h" @@ -141,15 +142,18 @@ void onSdManagerMenu(const char * result) } else if (result == STR_FLASH_INTERNAL_MODULE) { getSelectionFullPath(lfn); - sportFlashDevice(INTERNAL_MODULE, lfn); + DeviceFirmwareUpdate device(INTERNAL_MODULE); + device.flashFile(lfn); } else if (result == STR_FLASH_EXTERNAL_MODULE) { getSelectionFullPath(lfn); - sportFlashDevice(EXTERNAL_MODULE, lfn); + DeviceFirmwareUpdate device(EXTERNAL_MODULE); + device.flashFile(lfn); } else if (result == STR_FLASH_EXTERNAL_DEVICE) { getSelectionFullPath(lfn); - sportFlashDevice(FLASHING_MODULE, lfn); + DeviceFirmwareUpdate device(FLASHING_MODULE); + device.flashFile(lfn); } #if defined(LUA) else if (result == STR_EXECUTE_FILE) { diff --git a/radio/src/io/frsky_sport.h b/radio/src/io/frsky_sport.h index e00e11784..d7d58c8b2 100644 --- a/radio/src/io/frsky_sport.h +++ b/radio/src/io/frsky_sport.h @@ -37,7 +37,6 @@ PACK(union SportTelemetryPacket bool isSportOutputBufferAvailable(); void sportOutputPushPacket(SportTelemetryPacket * packet); -void sportFlashDevice(ModuleIndex module, const char * filename); #endif #if defined(STM32) diff --git a/radio/src/storage/conversions/CMakeLists.txt b/radio/src/storage/conversions/CMakeLists.txt index 288eee42d..70e8dfccc 100644 --- a/radio/src/storage/conversions/CMakeLists.txt +++ b/radio/src/storage/conversions/CMakeLists.txt @@ -2,10 +2,14 @@ if(PCB STREQUAL X9D OR PCB STREQUAL X9DP OR PCB STREQUAL SKY9X) set(EEPROM_CONVERSIONS 216) endif() -if(PCB STREQUAL X12S OR PCB STREQUAL X10 OR PCB STREQUAL X7 OR PCB STREQUAL XLITE) +if(PCB STREQUAL X7 OR PCB STREQUAL XLITE) set(EEPROM_CONVERSIONS 218) endif() +if(PCB STREQUAL X12S OR PCB STREQUAL X10) + # TODO set(EEPROM_CONVERSIONS 218) +endif() + if(EEPROM_CONVERSIONS) add_definitions(-DEEPROM_CONVERSIONS=${EEPROM_CONVERSIONS}) set(SRC diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 8fbe1be35..54531aaff 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -139,6 +139,16 @@ void delay_ms(uint32_t ms); #define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() (!IS_HORUS_PROD()) #endif +// Hardware options +PACK(typedef struct { +#if NUM_PWMSTICKS > 0 + uint8_t sticksPwmDisabled:1; +#endif + uint8_t pxx2Enabled:1; +}) HardwareOptions; + +extern HardwareOptions hardwareOptions; + // SD driver #define BLOCK_SIZE 512 /* Block Size in Bytes */ #if !defined(SIMU) || defined(SIMU_DISKIO) @@ -196,15 +206,6 @@ void SDRAM_Init(void); #define IS_INTERNAL_MODULE_ON() (GPIO_ReadInputDataBit(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN) == Bit_SET) #define IS_EXTERNAL_MODULE_ON() (GPIO_ReadInputDataBit(EXTMODULE_PWR_GPIO, EXTMODULE_PWR_GPIO_PIN) == Bit_SET) -PACK(typedef struct { -#if NUM_PWMSTICKS > 0 - uint8_t sticksPwmDisabled:1; -#endif - uint8_t pxx2Enabled:1; -}) HardwareOptions; - -extern HardwareOptions hardwareOptions; - #if !defined(PXX2) #define IS_PXX2_INTERNAL_ENABLED() (false) #define IS_PXX1_INTERNAL_ENABLED() (true) @@ -218,7 +219,6 @@ extern HardwareOptions hardwareOptions; #define IS_PXX1_INTERNAL_ENABLED() (true) #endif - void init_ppm(uint8_t module); void disable_ppm(uint8_t module); void init_pxx1_pulses(uint8_t module); @@ -228,6 +228,8 @@ void disable_pxx2(uint8_t module); void init_serial(uint8_t module, uint32_t baudrate, uint32_t period_half_us); void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable); void disable_serial(uint8_t module); +void intmoduleStop(); +void intmoduleSendBuffer(const uint8_t * data, uint8_t size); void intmoduleSendNextFrame(); void extmoduleSendNextFrame(); diff --git a/radio/src/targets/taranis/CMakeLists.txt b/radio/src/targets/taranis/CMakeLists.txt index 6058e3271..c55b87974 100644 --- a/radio/src/targets/taranis/CMakeLists.txt +++ b/radio/src/targets/taranis/CMakeLists.txt @@ -211,7 +211,7 @@ set(GUI_SRC radio_diagkeys.cpp radio_diaganas.cpp radio_hardware.cpp - + radio_tools.cpp view_channels.cpp view_telemetry.cpp view_about.cpp