From 6f774eb61ab5bed4b14bb17cd1f2f268befc331f Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 24 Oct 2015 16:08:29 +0200 Subject: [PATCH] [Horus] Companion simulator --- companion/src/constants.h | 4 +- .../src/firmwares/opentx/opentxinterface.cpp | 16 + .../firmwares/opentx/simulator/CMakeLists.txt | 25 +- .../opentx/simulator/opentxsimulator.cpp | 114 +- .../opentx/simulator/opentxsimulator.h | 10 +- companion/src/helpers.cpp | 8 +- companion/src/simulation/CMakeLists.txt | 2 + companion/src/simulation/lcdwidget.h | 29 +- .../src/simulation/simulatordialog-9x.ui | 4 +- .../simulation/simulatordialog-flamenco.ui | 1663 +++++++++++++++++ .../src/simulation/simulatordialog-horus.ui | 1663 +++++++++++++++++ .../src/simulation/simulatordialog-taranis.ui | 4 +- companion/src/simulation/simulatordialog.cpp | 4 + companion/src/simulation/simulatordialog.h | 52 +- .../simulation/simulatordialogflamenco.cpp | 166 ++ .../src/simulation/simulatordialoghorus.cpp | 166 ++ companion/src/simulation/simulatorimport.h | 2 +- companion/src/simulator.cpp | 6 +- radio/src/gui/Horus/menu_model_select.cpp | 50 - radio/src/gui/Horus/menus.h | 1 + .../inc/stm32f4xx_dma2d.h | 2 +- .../inc/stm32f4xx_fmc.h | 2 +- .../inc/stm32f4xx_ltdc.h | 2 +- .../inc/stm32f4xx_tim.h | 2 +- 24 files changed, 3916 insertions(+), 81 deletions(-) create mode 100644 companion/src/simulation/simulatordialog-flamenco.ui create mode 100644 companion/src/simulation/simulatordialog-horus.ui create mode 100644 companion/src/simulation/simulatordialogflamenco.cpp create mode 100644 companion/src/simulation/simulatordialoghorus.cpp diff --git a/companion/src/constants.h b/companion/src/constants.h index 958134e07..b1f85fba2 100644 --- a/companion/src/constants.h +++ b/companion/src/constants.h @@ -11,7 +11,9 @@ enum BoardEnum { BOARD_AR9X, BOARD_TARANIS, BOARD_TARANIS_PLUS, - BOARD_TARANIS_X9E + BOARD_TARANIS_X9E, + BOARD_FLAMENCO, + BOARD_HORUS }; #define C9X_MAX_MODELS 60 diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 16b5d6f78..c598d8d63 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -75,6 +75,10 @@ const char * OpenTxEepromInterface::getName() return "OpenTX for 9XR-PRO"; case BOARD_AR9X: return "OpenTX for ar9x board / 9X"; + case BOARD_FLAMENCO: + return "OpenTX for Flamenco experimental"; + case BOARD_HORUS: + return "OpenTX for FrSky Horus"; default: return "OpenTX for an unknown board"; } @@ -98,6 +102,8 @@ const int OpenTxEepromInterface::getEEpromSize() case BOARD_TARANIS: case BOARD_TARANIS_PLUS: case BOARD_TARANIS_X9E: + case BOARD_FLAMENCO: + case BOARD_HORUS: return EESIZE_TARANIS; default: return 0; @@ -403,6 +409,8 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t case BOARD_SKY9X: case BOARD_AR9X: case BOARD_9XRPRO: + case BOARD_FLAMENCO: + case BOARD_HORUS: version = 218; break; case BOARD_GRUVIN9X: @@ -1432,6 +1440,14 @@ void registerOpenTxFirmwares() addOpenTxCommonOptions(firmware); firmwares.push_back(firmware); + /* Horus board */ + firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS); + firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); + firmware->addOption("nogvars", QObject::tr("Disable Global variables")); + firmware->addOption("lua", QObject::tr("Support for Lua model scripts")); + addOpenTxCommonOptions(firmware); + firmwares.push_back(firmware); + default_firmware_variant = GetFirmware("opentx-taranisplus-en"); current_firmware_variant = default_firmware_variant; } diff --git a/companion/src/firmwares/opentx/simulator/CMakeLists.txt b/companion/src/firmwares/opentx/simulator/CMakeLists.txt index 3a35e6ef7..f0ebe02cb 100644 --- a/companion/src/firmwares/opentx/simulator/CMakeLists.txt +++ b/companion/src/firmwares/opentx/simulator/CMakeLists.txt @@ -13,6 +13,16 @@ add_custom_target(about_lbm_taranis WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} ) +add_custom_target(about_lbm_flamenco + make lbm PCB=FLAMENCO + WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} +) + +add_custom_target(about_lbm_horus + make lbm PCB=HORUS + WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} +) + add_custom_target(commondeps make stamp_header tra WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} @@ -20,8 +30,11 @@ add_custom_target(commondeps set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${RADIO_SRC_DIRECTORY}/stamp-opentx.h) -add_custom_target(lua_exports - make PCB=TARANIS lua_exports_taranis.inc +add_custom_target(lua_exports + COMMAND make PCB=TARANIS lua_exports_taranis.inc + COMMAND make PCB=FLAMENCO lua_exports_flamenco.inc + COMMAND make PCB=HORUS lua_exports_horus.inc + DEPENDS ${RADIO_SRC_DIRECTORY}/myeeprom.h WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} ) @@ -84,6 +97,7 @@ add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) +add_library(opentx-horus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_dependencies(opentx-9x${SUFFIX}-simulator about_lbm_9x commondeps) add_dependencies(opentx-9xr${SUFFIX}-simulator about_lbm_9x commondeps) @@ -97,6 +111,7 @@ add_dependencies(opentx-ar9x${SUFFIX}-simulator about_lbm_9x commondeps) add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) +add_dependencies(opentx-horus${SUFFIX}-simulator about_lbm_horus commondeps lua_exports) set(OPENTX_LIBRARIES opentx-9x${SUFFIX}-simulator @@ -111,6 +126,7 @@ set(OPENTX_LIBRARIES opentx-taranis${SUFFIX}-simulator opentx-taranisplus${SUFFIX}-simulator opentx-taranisx9e${SUFFIX}-simulator + opentx-horus${SUFFIX}-simulator ) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -177,6 +193,11 @@ target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_ target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) +# Horus +target_include_directories(opentx-horus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Horus) +target_compile_definitions(opentx-horus${SUFFIX}-simulator PRIVATE PCBHORUS CPUARM CPUSTM32 STM32F40_41xxx COLORLCD VOICE SDCARD ${COMMON_DEFINITIONS}) +target_link_libraries(opentx-horus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) + add_custom_target(opentx-simulators DEPENDS ${OPENTX_LIBRARIES} ) diff --git a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp index 861e0535b..4d452c312 100644 --- a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp @@ -40,7 +40,11 @@ #define AUTOSWITCH #define GRAPHICS #define CURVES -#if defined(PCBTARANIS) +#if defined(PCBFLAMENCO) || defined(PCBHORUS) +#define RTCLOCK +#define XCURVES +#define VIRTUALINPUTS +#elif defined(PCBTARANIS) #define RTCLOCK #define XCURVES #define VIRTUALINPUTS @@ -97,6 +101,7 @@ namespace NAMESPACE { #include "radio/src/pulses/pulses_avr.cpp" #endif +#include "radio/src/storage/storage_common.cpp" #if defined(EEPROM_RLC) #include "radio/src/storage/eeprom_common.cpp" #include "radio/src/storage/eeprom_rlc.cpp" @@ -127,7 +132,79 @@ namespace NAMESPACE { #include "radio/src/vario.cpp" #include "radio/src/trainer_input.cpp" -#if defined(PCBTARANIS) +#if defined(PCBHORUS) +#include "radio/src/gui/Horus/bitmaps.cpp" +#include "radio/src/gui/Horus/fonts.cpp" +#include "radio/src/gui/Horus/widgets.cpp" +#include "radio/src/gui/Horus/navigation.cpp" +#include "radio/src/gui/Horus/popups.cpp" +#include "radio/src/gui/Horus/helpers.cpp" +#include "radio/src/gui/Horus/menus.cpp" +#include "radio/src/gui/Horus/menu_model.cpp" +#include "radio/src/gui/Horus/menu_model_select.cpp" +#include "radio/src/gui/Horus/menu_model_setup.cpp" +#include "radio/src/gui/Horus/menu_model_heli.cpp" +#include "radio/src/gui/Horus/menu_model_flightmodes.cpp" +#include "radio/src/gui/Horus/menu_model_inputs_mixes.cpp" +#include "radio/src/gui/Horus/menu_model_curves.cpp" +#include "radio/src/gui/Horus/menu_model_logical_switches.cpp" +#include "radio/src/gui/Horus/menu_model_custom_functions.cpp" +// #include "radio/src/gui/Horus/menu_model_custom_scripts.cpp" +#include "radio/src/gui/Horus/menu_model_gvars.cpp" +#include "radio/src/gui/Horus/menu_model_limits.cpp" +#include "radio/src/gui/Horus/menu_model_telemetry.cpp" +#include "radio/src/gui/Horus/menu_general.cpp" +#include "radio/src/gui/Horus/menu_general_setup.cpp" +#include "radio/src/gui/Horus/menu_general_sdmanager.cpp" +#include "radio/src/gui/Horus/menu_general_trainer.cpp" +#include "radio/src/gui/Horus/menu_general_version.cpp" +// #include "radio/src/gui/Horus/menu_general_hardware.cpp" +#include "radio/src/gui/Horus/menu_general_calib.cpp" +#include "radio/src/gui/Horus/view_main.cpp" +#include "radio/src/gui/Horus/view_statistics.cpp" +#include "radio/src/gui/Horus/view_channels.cpp" +#include "radio/src/gui/Horus/view_telemetry.cpp" +#include "radio/src/gui/Horus/view_text.cpp" +#include "radio/src/gui/Horus/view_about.cpp" +#include "radio/src/gui/Horus/lcd.cpp" +#include "radio/src/gui/Horus/splash.cpp" +#elif defined(PCBFLAMENCO) +#include "radio/src/gui/Flamenco/fonts.cpp" +#include "radio/src/gui/Flamenco/widgets.cpp" +#include "radio/src/gui/Flamenco/navigation.cpp" +#include "radio/src/gui/Flamenco/popups.cpp" +#include "radio/src/gui/Flamenco/helpers.cpp" +#include "radio/src/gui/Flamenco/menus.cpp" +#include "radio/src/gui/Flamenco/menu_model.cpp" +#include "radio/src/gui/Flamenco/menu_model_select.cpp" +#include "radio/src/gui/Flamenco/menu_model_setup.cpp" +#include "radio/src/gui/Flamenco/menu_model_heli.cpp" +#include "radio/src/gui/Flamenco/menu_model_flightmodes.cpp" +#include "radio/src/gui/Flamenco/menu_model_inputs_mixes.cpp" +#include "radio/src/gui/Flamenco/menu_model_curves.cpp" +#include "radio/src/gui/Flamenco/menu_model_logical_switches.cpp" +#include "radio/src/gui/Flamenco/menu_model_custom_functions.cpp" +// #include "radio/src/gui/Flamenco/menu_model_custom_scripts.cpp" +#include "radio/src/gui/Flamenco/menu_model_gvars.cpp" +#include "radio/src/gui/Flamenco/menu_model_limits.cpp" +#include "radio/src/gui/Flamenco/menu_model_telemetry.cpp" +#include "radio/src/gui/Flamenco/menu_general.cpp" +#include "radio/src/gui/Flamenco/menu_general_setup.cpp" +#include "radio/src/gui/Flamenco/menu_general_sdmanager.cpp" +#include "radio/src/gui/Flamenco/menu_general_trainer.cpp" +#include "radio/src/gui/Flamenco/menu_general_version.cpp" +// #include "radio/src/gui/Flamenco/menu_general_hardware.cpp" +#include "radio/src/gui/Flamenco/menu_general_calib.cpp" +#include "radio/src/gui/Flamenco/view_main.cpp" +#include "radio/src/gui/Flamenco/view_statistics.cpp" +#include "radio/src/gui/Flamenco/view_channels.cpp" +#include "radio/src/gui/Flamenco/view_telemetry.cpp" +#include "radio/src/gui/Flamenco/view_text.cpp" +#include "radio/src/gui/Flamenco/view_about.cpp" +#include "radio/src/gui/Flamenco/lcd.cpp" +#include "radio/src/gui/Flamenco/splash.cpp" +#include "radio/src/targets/Flamenco/tw8823_driver.cpp" +#elif defined(PCBTARANIS) #include "radio/src/bmp.cpp" #include "radio/src/gui/Taranis/fonts.cpp" #include "radio/src/gui/Taranis/widgets.cpp" @@ -224,7 +301,26 @@ namespace NAMESPACE { #include "radio/src/buzzer.cpp" #endif -#if defined(PCBTARANIS) +#if defined(PCBHORUS) +#include "radio/src/targets/Horus/board_horus.cpp" +#include "radio/src/targets/Horus/keys_driver.cpp" +#include "radio/src/targets/Horus/audio_driver.cpp" +#include "radio/src/targets/Horus/telemetry_driver.cpp" +// #include "radio/src/targets/Horus/haptic_driver.cpp" +#include "radio/src/targets/Horus/pulses_driver.cpp" +// #include "radio/src/targets/Horus/rtc_driver.cpp" +#include "radio/src/targets/Horus/trainer_driver.cpp" +#elif defined(PCBFLAMENCO) +#include "radio/src/targets/Flamenco/board_flamenco.cpp" +#include "radio/src/targets/Flamenco/keys_driver.cpp" +#include "radio/src/targets/Flamenco/audio_driver.cpp" +#include "radio/src/targets/Flamenco/telemetry_driver.cpp" +#include "radio/src/targets/Flamenco/eeprom_driver.cpp" +// #include "radio/src/targets/Flamenco/haptic_driver.cpp" +#include "radio/src/targets/Flamenco/pulses_driver.cpp" +// #include "radio/src/targets/Flamenco/rtc_driver.cpp" +#include "radio/src/targets/Flamenco/trainer_driver.cpp" +#elif defined(PCBTARANIS) #include "radio/src/targets/Taranis/board_taranis.cpp" #include "radio/src/targets/Taranis/keys_driver.cpp" #include "radio/src/targets/Taranis/audio_driver.cpp" @@ -255,7 +351,11 @@ namespace NAMESPACE { #elif defined(PCBMEGA2560) #include "radio/src/targets/Mega2560/board_mega2560.cpp" #else -#include "../../../../../radio/src/targets/9x/board_stock.cpp" +#include "radio/src/targets/9x/board_stock.cpp" +#endif + +#if defined(CPUARM) +#include "radio/src/gui/gui_helpers.cpp" #endif #include "radio/src/keys.cpp" @@ -526,7 +626,11 @@ class OpenTxSimulatorFactory: public SimulatorFactory virtual BoardEnum type() { -#if defined(PCBTARANIS) +#if defined(PCBHORUS) + return BOARD_HORUS; +#elif defined(PCBFLAMENCO) + return BOARD_FLAMENCO; +#elif defined(PCBTARANIS) return BOARD_TARANIS; #else return BOARD_STOCK; diff --git a/companion/src/firmwares/opentx/simulator/opentxsimulator.h b/companion/src/firmwares/opentx/simulator/opentxsimulator.h index a17f2aba5..95cdafd39 100644 --- a/companion/src/firmwares/opentx/simulator/opentxsimulator.h +++ b/companion/src/firmwares/opentx/simulator/opentxsimulator.h @@ -19,7 +19,15 @@ #include "simulatorinterface.h" -#if defined(PCBTARANIS) && defined(REV9E) +#if defined(PCBHORUS) + #define FLAVOUR "horus" + #define NAMESPACE HORUS + #define EEPROM_VARIANT 0 +#elif defined(PCBFLAMENCO) + #define FLAVOUR "flamenco" + #define NAMESPACE FLAMENCO + #define EEPROM_VARIANT 0 +#elif defined(PCBTARANIS) && defined(REV9E) #define FLAVOUR "taranisx9e" #define NAMESPACE TaranisX9E #define EEPROM_VARIANT 0x8000 diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index c396f13b4..518e3cbc2 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -788,7 +788,13 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) } BoardEnum board = GetCurrentFirmware()->getBoard(); SimulatorDialog * sd; - if (IS_TARANIS(board)) { + if (board == BOARD_HORUS) { + sd = new SimulatorDialogHorus(parent, si, flags); + } + else if (board == BOARD_FLAMENCO) { + sd = new SimulatorDialogFlamenco(parent, si, flags); + } + else if (IS_TARANIS(board)) { for (int i=0; igetCapability(Pots); i++) { if (radioData.generalSettings.isPotAvailable(i)) { flags |= (SIMULATOR_FLAGS_S1 << i); diff --git a/companion/src/simulation/CMakeLists.txt b/companion/src/simulation/CMakeLists.txt index bda9fed7f..c5173c094 100644 --- a/companion/src/simulation/CMakeLists.txt +++ b/companion/src/simulation/CMakeLists.txt @@ -9,6 +9,8 @@ set(simulation_SRCS set(simulation_UIS simulatordialog-9x.ui simulatordialog-taranis.ui + simulatordialog-horus.ui + simulatordialog-flamenco.ui telemetrysimu.ui trainersimu.ui debugoutput.ui diff --git a/companion/src/simulation/lcdwidget.h b/companion/src/simulation/lcdwidget.h index 35af6e114..035c8ce8b 100644 --- a/companion/src/simulation/lcdwidget.h +++ b/companion/src/simulation/lcdwidget.h @@ -14,15 +14,15 @@ * */ -#ifndef lcd_widget_h -#define lcd_widget_h +#ifndef _LCD_WIDGET_H_ +#define _LCD_WIDGET_H_ #include #include "appdata.h" -class lcdWidget : public QWidget { +class LcdWidget : public QWidget { public: - lcdWidget(QWidget * parent = 0): + LcdWidget(QWidget * parent = 0): QWidget(parent), lcdBuf(NULL), previousBuf(NULL), @@ -30,10 +30,11 @@ class lcdWidget : public QWidget { { } - ~lcdWidget() + ~LcdWidget() { - if (previousBuf) + if (previousBuf) { free(previousBuf); + } } void setData(unsigned char *buf, int width, int height, int depth=1) @@ -43,7 +44,7 @@ class lcdWidget : public QWidget { lcdHeight = height; lcdDepth = depth; if (depth >= 8) - lcdSize = (width * height) * (depth / 8); + lcdSize = (width * height) * ((depth+7) / 8); else lcdSize = (width * ((height+7)/8)) * depth; previousBuf = (unsigned char *)malloc(lcdSize); @@ -109,7 +110,17 @@ class lcdWidget : public QWidget { { QRgb rgb; - if (lcdDepth >= 8) { + if (lcdDepth == 16) { + for (int x=0; x>11)/0x1F, 255*((z&0x07E0)>>5)/0x3F, 255*(z&0x001F)/0x1F); + p.setPen(rgb); + p.drawPoint(x, y); + } + } + } + else if (lcdDepth == 12) { for (int x=0; x - + 0 @@ -1469,7 +1469,7 @@ QPushButton:checked { - lcdWidget + LcdWidget QWidget
lcdwidget.h
1 diff --git a/companion/src/simulation/simulatordialog-flamenco.ui b/companion/src/simulation/simulatordialog-flamenco.ui new file mode 100644 index 000000000..09d45e6cc --- /dev/null +++ b/companion/src/simulation/simulatordialog-flamenco.ui @@ -0,0 +1,1663 @@ + + + SimulatorDialogFlamenco + + + + 0 + 0 + 726 + 688 + + + + + 0 + 0 + + + + + 739 + 16777215 + + + + Companion Simulator + + + + :/icon.png:/icon.png + + + + 5 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 570 + 5 + + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 0 + + + + Flamenco Simulator + + + + + + QLayout::SetMinimumSize + + + 0 + + + + + + 0 + 0 + + + + + 120 + 208 + + + + true + + + background:url(:/images/x9l0.png); + + + + + + + + 0 + 0 + + + + + 120 + 208 + + + + background:url(:/images/x9r0.png) + + + + + + + + 0 + 0 + + + + + 320 + 240 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + 438 + 6 + + + + + + + + + + + Outputs + + + + + + + + + + + + + Outputs2 + + + + + + + + + + + + + Gvars + + + + + 10 + 10 + 691 + 231 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Raised + + + 2 + + + + 5 + + + 6 + + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + ^ + + + false + + + + + + + + 0 + 0 + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + v + + + false + + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 5 + 20 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SF + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + + + + 1 + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + SA + + + Qt::AlignCenter + + + + + + + SB + + + Qt::AlignCenter + + + + + + + SE + + + Qt::AlignCenter + + + + + + + LS + + + Qt::AlignCenter + + + + + + + S1 + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + <- + + + false + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + -> + + + false + + + + + + + + + + + QLayout::SetDefaultConstraint + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 5 + 20 + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + ^ + + + false + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + v + + + false + + + + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + S2 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + false + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SC + + + Qt::AlignCenter + + + + + + + SD + + + Qt::AlignCenter + + + + + + + SG + + + Qt::AlignCenter + + + + + + + SH + + + Qt::AlignCenter + + + + + + + RS + + + Qt::AlignCenter + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + <- + + + false + + + + + + + + 0 + 0 + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + -> + + + false + + + + + + + + + + + + + + + LcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + mySlider + QSlider +
myslider.h
+
+ + xcursorWidget + QWidget +
xcursorwidget.h
+ 1 +
+ + xmenuWidget + QWidget +
xmenuwidget.h
+ 1 +
+
+ + + + +
diff --git a/companion/src/simulation/simulatordialog-horus.ui b/companion/src/simulation/simulatordialog-horus.ui new file mode 100644 index 000000000..fbeb54962 --- /dev/null +++ b/companion/src/simulation/simulatordialog-horus.ui @@ -0,0 +1,1663 @@ + + + SimulatorDialogHorus + + + + 0 + 0 + 726 + 688 + + + + + 0 + 0 + + + + + 739 + 16777215 + + + + Companion Simulator + + + + :/icon.png:/icon.png + + + + 5 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 570 + 5 + + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 0 + + + + Forus Simulator + + + + + + QLayout::SetMinimumSize + + + 0 + + + + + + 0 + 0 + + + + + 120 + 208 + + + + true + + + background:url(:/images/x9l0.png); + + + + + + + + 0 + 0 + + + + + 120 + 208 + + + + background:url(:/images/x9r0.png) + + + + + + + + 0 + 0 + + + + + 480 + 272 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + 438 + 6 + + + + + + + + + + + Outputs + + + + + + + + + + + + + Outputs2 + + + + + + + + + + + + + Gvars + + + + + 10 + 10 + 691 + 231 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Raised + + + 2 + + + + 5 + + + 6 + + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + ^ + + + false + + + + + + + + 0 + 0 + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + v + + + false + + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 5 + 20 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SF + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + + + + 1 + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + SA + + + Qt::AlignCenter + + + + + + + SB + + + Qt::AlignCenter + + + + + + + SE + + + Qt::AlignCenter + + + + + + + LS + + + Qt::AlignCenter + + + + + + + S1 + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + <- + + + false + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + -> + + + false + + + + + + + + + + + QLayout::SetDefaultConstraint + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 5 + 20 + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + ^ + + + false + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + v + + + false + + + + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + S2 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + false + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + + + + + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SC + + + Qt::AlignCenter + + + + + + + SD + + + Qt::AlignCenter + + + + + + + SG + + + Qt::AlignCenter + + + + + + + SH + + + Qt::AlignCenter + + + + + + + RS + + + Qt::AlignCenter + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + <- + + + false + + + + + + + + 0 + 0 + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 23 + 23 + + + + -> + + + false + + + + + + + + + + + + + + + LcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + mySlider + QSlider +
myslider.h
+
+ + xcursorWidget + QWidget +
xcursorwidget.h
+ 1 +
+ + xmenuWidget + QWidget +
xmenuwidget.h
+ 1 +
+
+ + + + +
diff --git a/companion/src/simulation/simulatordialog-taranis.ui b/companion/src/simulation/simulatordialog-taranis.ui index 34fec2025..422cc5195 100644 --- a/companion/src/simulation/simulatordialog-taranis.ui +++ b/companion/src/simulation/simulatordialog-taranis.ui @@ -146,7 +146,7 @@
- + 0 @@ -1735,7 +1735,7 @@ QPushButton:checked { - lcdWidget + LcdWidget QWidget
lcdwidget.h
1 diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp index 31fa94406..24d6bba2b 100644 --- a/companion/src/simulation/simulatordialog.cpp +++ b/companion/src/simulation/simulatordialog.cpp @@ -217,6 +217,7 @@ SimulatorDialogTaranis::~SimulatorDialogTaranis() delete ui; } + SimulatorDialog::~SimulatorDialog() { traceCallbackInstance = 0; @@ -1134,3 +1135,6 @@ void SimulatorDialog::onjoystickAxisValueChanged(int axis, int value) } } #endif + +#include "simulatordialogflamenco.cpp" +#include "simulatordialoghorus.cpp" diff --git a/companion/src/simulation/simulatordialog.h b/companion/src/simulation/simulatordialog.h index 18f30dfdf..44af808e6 100644 --- a/companion/src/simulation/simulatordialog.h +++ b/companion/src/simulation/simulatordialog.h @@ -21,10 +21,12 @@ namespace Ui { class SimulatorDialog9X; class SimulatorDialogTaranis; + class SimulatorDialogFlamenco; + class SimulatorDialogHorus; } // TODO rename + move? -class lcdWidget; +class LcdWidget; class mySlider; #define SIMULATOR_FLAGS_NOTX 1 @@ -38,6 +40,8 @@ class mySlider; #define SIMULATOR_FLAGS_S3_MULTI 256 #define SIMULATOR_FLAGS_S4_MULTI 512 // reserved for the future +void traceCb(const char * text); + class SimulatorDialog : public QDialog { Q_OBJECT @@ -56,7 +60,7 @@ class SimulatorDialog : public QDialog virtual void updateBeepButton() { } unsigned int flags; - lcdWidget * lcd; + LcdWidget * lcd; QGraphicsView * leftStick, * rightStick; QVector pots; QVector potLabels; @@ -205,4 +209,48 @@ class SimulatorDialogTaranis: public SimulatorDialog void on_switchH_sliderReleased(); }; +class SimulatorDialogFlamenco: public SimulatorDialog +{ + Q_OBJECT + + public: + explicit SimulatorDialogFlamenco(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); + virtual ~SimulatorDialogFlamenco(); + + protected: + virtual void getValues(); + void saveSwitches(void); + void restoreSwitches(void); + + private: + Ui::SimulatorDialogFlamenco * ui; + static uint32_t switchstatus; + + private slots: + void resetSH(); + void on_switchH_sliderReleased(); +}; + +class SimulatorDialogHorus: public SimulatorDialog +{ + Q_OBJECT + + public: + explicit SimulatorDialogHorus(QWidget * parent, SimulatorInterface *simulator, unsigned int flags=0); + virtual ~SimulatorDialogHorus(); + + protected: + virtual void getValues(); + void saveSwitches(void); + void restoreSwitches(void); + + private: + Ui::SimulatorDialogHorus * ui; + static uint32_t switchstatus; + + private slots: + void resetSH(); + void on_switchH_sliderReleased(); +}; + #endif // SIMULATORDIALOG_H diff --git a/companion/src/simulation/simulatordialogflamenco.cpp b/companion/src/simulation/simulatordialogflamenco.cpp new file mode 100644 index 000000000..364c5a819 --- /dev/null +++ b/companion/src/simulation/simulatordialogflamenco.cpp @@ -0,0 +1,166 @@ +#include "simulatordialog.h" +#include "ui_simulatordialog-flamenco.h" +#include "helpers.h" + +uint32_t SimulatorDialogFlamenco::switchstatus = 0; + +SimulatorDialogFlamenco::SimulatorDialogFlamenco(QWidget * parent, SimulatorInterface *simulator, unsigned int flags): + SimulatorDialog(parent, simulator, flags), + ui(new Ui::SimulatorDialogFlamenco) +{ + lcdWidth = 320; + lcdHeight = 240; + lcdDepth = 12; + + initUi(ui); + + // install simulator TRACE hook + simulator->installTraceHook(traceCb); + + // TODO dialP_4 = ui->dialP_4; + + ui->lcd->setBackgroundColor(47, 123, 227); + + //restore switches + if (g.simuSW()) + restoreSwitches(); + + ui->trimHR_L->setText(QString::fromUtf8(leftArrow)); + ui->trimHR_R->setText(QString::fromUtf8(rightArrow)); + ui->trimVR_U->setText(QString::fromUtf8(upArrow)); + ui->trimVR_D->setText(QString::fromUtf8(downArrow)); + ui->trimHL_L->setText(QString::fromUtf8(leftArrow)); + ui->trimHL_R->setText(QString::fromUtf8(rightArrow)); + ui->trimVL_U->setText(QString::fromUtf8(upArrow)); + ui->trimVL_D->setText(QString::fromUtf8(downArrow)); + + connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHR_R, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVR_U, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVR_D, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHL_R, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHL_L, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVL_U, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVL_D, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHR_L, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHR_R, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVR_U, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVR_D, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHL_R, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHL_L, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVL_U, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVL_D, SIGNAL(released()), this, SLOT(onTrimReleased())); +} + +SimulatorDialogFlamenco::~SimulatorDialogFlamenco() +{ + saveSwitches(); + delete ui; +} + +void SimulatorDialogFlamenco::resetSH() +{ + ui->switchH->setValue(0); +} + +void SimulatorDialogFlamenco::on_switchH_sliderReleased() +{ + QTimer::singleShot(400, this, SLOT(resetSH())); +} + +void SimulatorDialogFlamenco::getValues() +{ + TxInputs inputs = { + { + int(1024*nodeLeft->getX()), // LEFT HORZ + int(-1024*nodeLeft->getY()), // LEFT VERT + int(-1024*nodeRight->getY()), // RGHT VERT + int(1024*nodeRight->getX()) // RGHT HORZ + }, + + { + -ui->dialP_1->value(), + ui->dialP_2->value(), + 0, + -ui->dialP_3->value(), + ui->dialP_4->value() + }, + + { + ui->switchA->value() - 1, + ui->switchB->value() - 1, + ui->switchC->value() - 1, + ui->switchD->value() - 1, + ui->switchE->value() - 1, + ui->switchF->value(), + ui->switchG->value() - 1, + ui->switchH->value(), 0, 0 + }, + + { + buttonPressed == Qt::Key_PageUp, + buttonPressed == Qt::Key_Escape, + buttonPressed == Qt::Key_Enter, + buttonPressed == Qt::Key_PageDown, + buttonPressed == Qt::Key_Plus, + buttonPressed == Qt::Key_Minus + }, + + middleButtonPressed, + + { + trimPressed == TRIM_LH_L, + trimPressed == TRIM_LH_R, + trimPressed == TRIM_LV_DN, + trimPressed == TRIM_LV_UP, + trimPressed == TRIM_RV_DN, + trimPressed == TRIM_RV_UP, + trimPressed == TRIM_RH_L, + trimPressed == TRIM_RH_R + } + }; + + simulator->setValues(inputs); +} + +void SimulatorDialogFlamenco::saveSwitches(void) +{ + // qDebug() << "SimulatorDialogTaranis::saveSwitches()"; + switchstatus=ui->switchA->value(); + switchstatus<<=2; + switchstatus+=ui->switchB->value(); + switchstatus<<=2; + switchstatus+=ui->switchC->value(); + switchstatus<<=2; + switchstatus+=ui->switchD->value(); + switchstatus<<=2; + switchstatus+=ui->switchE->value(); + switchstatus<<=2; + switchstatus+=ui->switchF->value(); + switchstatus<<=2; + switchstatus+=ui->switchG->value(); + switchstatus<<=2; + switchstatus+=ui->switchH->value(); +} + +void SimulatorDialogFlamenco::restoreSwitches(void) +{ + // qDebug() << "SimulatorDialogTaranis::restoreSwitches()"; + ui->switchH->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchG->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchF->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchE->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchD->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchC->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchB->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchA->setValue(switchstatus & 0x3); +} diff --git a/companion/src/simulation/simulatordialoghorus.cpp b/companion/src/simulation/simulatordialoghorus.cpp new file mode 100644 index 000000000..df64a61b0 --- /dev/null +++ b/companion/src/simulation/simulatordialoghorus.cpp @@ -0,0 +1,166 @@ +#include "simulatordialog.h" +#include "ui_simulatordialog-horus.h" +#include "helpers.h" + +uint32_t SimulatorDialogHorus::switchstatus = 0; + +SimulatorDialogHorus::SimulatorDialogHorus(QWidget * parent, SimulatorInterface *simulator, unsigned int flags): + SimulatorDialog(parent, simulator, flags), + ui(new Ui::SimulatorDialogHorus) +{ + lcdWidth = 480; + lcdHeight = 270; + lcdDepth = 16; + + initUi(ui); + + // install simulator TRACE hook + simulator->installTraceHook(traceCb); + + // TODO dialP_4 = ui->dialP_4; + + ui->lcd->setBackgroundColor(47, 123, 227); + + //restore switches + if (g.simuSW()) + restoreSwitches(); + + ui->trimHR_L->setText(QString::fromUtf8(leftArrow)); + ui->trimHR_R->setText(QString::fromUtf8(rightArrow)); + ui->trimVR_U->setText(QString::fromUtf8(upArrow)); + ui->trimVR_D->setText(QString::fromUtf8(downArrow)); + ui->trimHL_L->setText(QString::fromUtf8(leftArrow)); + ui->trimHL_R->setText(QString::fromUtf8(rightArrow)); + ui->trimVL_U->setText(QString::fromUtf8(upArrow)); + ui->trimVL_D->setText(QString::fromUtf8(downArrow)); + + connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHR_R, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVR_U, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVR_D, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHL_R, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHL_L, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVL_U, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimVL_D, SIGNAL(pressed()), this, SLOT(onTrimPressed())); + connect(ui->trimHR_L, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHR_R, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVR_U, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVR_D, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHL_R, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimHL_L, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVL_U, SIGNAL(released()), this, SLOT(onTrimReleased())); + connect(ui->trimVL_D, SIGNAL(released()), this, SLOT(onTrimReleased())); +} + +SimulatorDialogHorus::~SimulatorDialogHorus() +{ + saveSwitches(); + delete ui; +} + +void SimulatorDialogHorus::resetSH() +{ + ui->switchH->setValue(0); +} + +void SimulatorDialogHorus::on_switchH_sliderReleased() +{ + QTimer::singleShot(400, this, SLOT(resetSH())); +} + +void SimulatorDialogHorus::getValues() +{ + TxInputs inputs = { + { + int(1024*nodeLeft->getX()), // LEFT HORZ + int(-1024*nodeLeft->getY()), // LEFT VERT + int(-1024*nodeRight->getY()), // RGHT VERT + int(1024*nodeRight->getX()) // RGHT HORZ + }, + + { + -ui->dialP_1->value(), + ui->dialP_2->value(), + 0, + -ui->dialP_3->value(), + ui->dialP_4->value() + }, + + { + ui->switchA->value() - 1, + ui->switchB->value() - 1, + ui->switchC->value() - 1, + ui->switchD->value() - 1, + ui->switchE->value() - 1, + ui->switchF->value(), + ui->switchG->value() - 1, + ui->switchH->value(), 0, 0 + }, + + { + buttonPressed == Qt::Key_PageUp, + buttonPressed == Qt::Key_Escape, + buttonPressed == Qt::Key_Enter, + buttonPressed == Qt::Key_PageDown, + buttonPressed == Qt::Key_Plus, + buttonPressed == Qt::Key_Minus + }, + + middleButtonPressed, + + { + trimPressed == TRIM_LH_L, + trimPressed == TRIM_LH_R, + trimPressed == TRIM_LV_DN, + trimPressed == TRIM_LV_UP, + trimPressed == TRIM_RV_DN, + trimPressed == TRIM_RV_UP, + trimPressed == TRIM_RH_L, + trimPressed == TRIM_RH_R + } + }; + + simulator->setValues(inputs); +} + +void SimulatorDialogHorus::saveSwitches(void) +{ + // qDebug() << "SimulatorDialogTaranis::saveSwitches()"; + switchstatus=ui->switchA->value(); + switchstatus<<=2; + switchstatus+=ui->switchB->value(); + switchstatus<<=2; + switchstatus+=ui->switchC->value(); + switchstatus<<=2; + switchstatus+=ui->switchD->value(); + switchstatus<<=2; + switchstatus+=ui->switchE->value(); + switchstatus<<=2; + switchstatus+=ui->switchF->value(); + switchstatus<<=2; + switchstatus+=ui->switchG->value(); + switchstatus<<=2; + switchstatus+=ui->switchH->value(); +} + +void SimulatorDialogHorus::restoreSwitches(void) +{ + // qDebug() << "SimulatorDialogTaranis::restoreSwitches()"; + ui->switchH->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchG->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchF->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchE->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchD->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchC->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchB->setValue(switchstatus & 0x3); + switchstatus>>=2; + ui->switchA->setValue(switchstatus & 0x3); +} diff --git a/companion/src/simulation/simulatorimport.h b/companion/src/simulation/simulatorimport.h index 0f4fee47e..59a835a57 100644 --- a/companion/src/simulation/simulatorimport.h +++ b/companion/src/simulation/simulatorimport.h @@ -50,7 +50,7 @@ if (inputs.rotenc) pind |= 0x20; if (inputs.rotenc) PIOB->PIO_PDSR &= ~0x40; else PIOB->PIO_PDSR |= 0x40; #endif -#if defined(PCBTARANIS) && defined(REV9E) +#if defined(PCBFLAMENCO) || (defined(PCBTARANIS) && defined(REV9E)) if (inputs.rotenc) simuSetKey(KEY_ENTER, true); #endif #endif diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index 45e22ffd8..3f923be7d 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -160,7 +160,11 @@ int main(int argc, char *argv[]) eepromFileName = QString("eeprom-%1.bin").arg(radioId); eepromFileName = eedir.filePath(eepromFileName.toAscii()); SimulatorFactory *factory = getSimulatorFactory(firmwareId); - if (factory->type() == BOARD_TARANIS) + if (factory->type() == BOARD_HORUS) + dialog = new SimulatorDialogHorus(NULL, factory->create()); + else if (factory->type() == BOARD_FLAMENCO) + dialog = new SimulatorDialogFlamenco(NULL, factory->create()); + else if (factory->type() == BOARD_TARANIS) dialog = new SimulatorDialogTaranis(NULL, factory->create(), SIMULATOR_FLAGS_S1|SIMULATOR_FLAGS_S2); else dialog = new SimulatorDialog9X(NULL, factory->create()); diff --git a/radio/src/gui/Horus/menu_model_select.cpp b/radio/src/gui/Horus/menu_model_select.cpp index 4162a1edb..fe0f450dc 100644 --- a/radio/src/gui/Horus/menu_model_select.cpp +++ b/radio/src/gui/Horus/menu_model_select.cpp @@ -35,56 +35,6 @@ #include "../../opentx.h" -#define POS_MODEL_NAME 35 -#define POS_MODEL_SIZE 170 - -void onModelSelectMenu(const char *result) -{ - int sub = m_posVert; - - if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) { - selectModel(sub); - } - else if (result == STR_COPY_MODEL) { - s_copyMode = COPY_MODE; - s_copyTgtOfs = 0; - s_copySrcRow = -1; - } - else if (result == STR_MOVE_MODEL) { - s_copyMode = MOVE_MODE; - s_copyTgtOfs = 0; - s_copySrcRow = -1; - } - else if (result == STR_BACKUP_MODEL) { - storageCheck(true); // force writing of current model data before this is changed - POPUP_WARNING(eeBackupModel(sub)); - } - else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) { - if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) { - POPUP_WARNING(STR_NO_MODELS_ON_SD); - s_menu_flags = 0; - } - } - else if (result == STR_DELETE_MODEL) { - POPUP_CONFIRMATION(STR_DELETEMODEL); - // SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR); - } - else { - // The user choosed a file on SD to restore - POPUP_WARNING(eeRestoreModel(sub, (char *)result)); - // if (!s_warning && g_eeGeneral.currModel == sub) - // eeLoadModel(sub); - } -} - -char *strAppendModelSize(char *dest, int size) -{ - char s[8] = "---"; - if (size) sprintf(s, "%d", size); - dest = strSetCursor(dest, POS_MODEL_SIZE-getTextWidth(s)); - return strAppend(dest, s); -} - #define CATEGORIES_WIDTH 140 void menuModelSelect(evt_t event) diff --git a/radio/src/gui/Horus/menus.h b/radio/src/gui/Horus/menus.h index d890a1feb..8363231c2 100644 --- a/radio/src/gui/Horus/menus.h +++ b/radio/src/gui/Horus/menus.h @@ -59,6 +59,7 @@ typedef evt_t & check_event_t; extern uint8_t menuPageIndex; extern uint8_t menuPageCount; +extern uint16_t linesCount; extern vertpos_t m_posVert; extern horzpos_t m_posHorz; extern vertpos_t s_pgOfs; diff --git a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma2d.h b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma2d.h index 0e456ed36..1dc95de1c 100644 --- a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma2d.h +++ b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma2d.h @@ -35,7 +35,7 @@ #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx.h" +#include "../../CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" /** @addtogroup STM32F4xx_StdPeriph_Driver * @{ diff --git a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_fmc.h b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_fmc.h index 41b3c64e9..a2157f4d0 100644 --- a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_fmc.h +++ b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_fmc.h @@ -35,7 +35,7 @@ #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx.h" +#include "../../CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" /** @addtogroup STM32F4xx_StdPeriph_Driver * @{ diff --git a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_ltdc.h b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_ltdc.h index 1c67a77fb..e94d2d09e 100644 --- a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_ltdc.h +++ b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_ltdc.h @@ -35,7 +35,7 @@ #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx.h" +#include "../../CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" /** @addtogroup STM32F4xx_StdPeriph_Driver * @{ diff --git a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h index adc8140e5..3fc4d0db7 100644 --- a/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h +++ b/radio/src/thirdparty/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h @@ -35,7 +35,7 @@ #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx.h" +#include "../../CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" /** @addtogroup STM32F4xx_StdPeriph_Driver * @{