@@ -7,7 +7,7 @@ before_install:
|
||||
- sudo apt-get update
|
||||
|
||||
install:
|
||||
- sudo apt-get install -y lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
|
||||
- sudo apt-get install -y xvfb lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
|
||||
|
||||
script:
|
||||
- radio/util/commit-tests.sh
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
PROJECT( companion )
|
||||
|
||||
SET(C9X_VERSION_MAJOR "2")
|
||||
SET(C9X_VERSION_MINOR "2")
|
||||
SET(C9X_VERSION_REVISION "0")
|
||||
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
SET(VERSION_MAJOR "2")
|
||||
SET(VERSION_MINOR "2")
|
||||
SET(VERSION_REVISION "0")
|
||||
SET(VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
|
||||
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
|
||||
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
|
||||
SET(VERSION_FAMILY ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
SET(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFIX})
|
||||
MESSAGE(STATUS "OpenTX Companion ${VERSION}")
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
SET(C9X_NAME_SUFFIX ${C9X_VERSION_MAJOR}${C9X_VERSION_MINOR})
|
||||
SET(C9X_NAME_SUFFIX ${VERSION_MAJOR}${VERSION_MINOR})
|
||||
SET(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
SET(SIMULATOR_NAME "simulator${C9X_NAME_SUFFIX}")
|
||||
SET( SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX} )
|
||||
@@ -452,7 +453,7 @@ string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
|
||||
# The file stripping is deliberately disabled, with the stripped file we get
|
||||
# very poor trace-backs from the users when they report Companion crash
|
||||
SET( CPACK_STRIP_FILES FALSE )
|
||||
SET(CPACK_STRIP_FILES FALSE)
|
||||
|
||||
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||
if(DPKG_PROGRAM)
|
||||
@@ -462,18 +463,18 @@ if(DPKG_PROGRAM)
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${C9X_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bertrand Songis <bsongis-nosp@m-gmail.com>")
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION ${C9X_VERSION})
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${C9X_VERSION_MAJOR})
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${C9X_VERSION_MINOR})
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION ${VERSION})
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
SET(CPACK_DEBIAN_ARCHITECTURE $(CMAKE_SYSTEM_PROCESSOR))
|
||||
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
else(DPKG_PROGRAM)
|
||||
SET(CPACK_GENERATOR "RPM")
|
||||
SET(CPACK_RPM_PACKAGE_VERSION ${C9X_VERSION})
|
||||
SET(CPACK_RPM_PACKAGE_VERSION ${VERSION})
|
||||
SET(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}-${C9X_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}-${VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
endif(DPKG_PROGRAM)
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
@@ -604,8 +604,28 @@ AppData::AppData()
|
||||
for (int i=0; i<MAX_JOYSTICKS; i++)
|
||||
joystick[i].init( i );
|
||||
|
||||
// Copy existing 2.0.16 settings if present
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
|
||||
// Copy existing 2.1 settings if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings settings21("OpenTX", "Companion 2.1");
|
||||
|
||||
QStringList keys = settings21.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
if (settings21.value(*i) != QString("") && settings21.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, settings21.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
}
|
||||
|
||||
// Copy existing 2.0 settings if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings settings20("OpenTX", "Companion 2.0");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QSettings>
|
||||
|
||||
#define COMPANY "OpenTX"
|
||||
#define PRODUCT "Companion 2.1"
|
||||
#define PRODUCT "Companion 2.2"
|
||||
|
||||
#define MAX_PROFILES 15
|
||||
#define MAX_JOYSTICKS 8
|
||||
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
if (strl.contains("--version")) {
|
||||
printf("%s\n", C9X_VERSION);
|
||||
printf("%s\n", VERSION);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Companion @C9X_VERSION@
|
||||
Name=Companion @VERSION@
|
||||
GenericName=Transmitter Companion App
|
||||
Comment=The Ultimate Transmitter Companion
|
||||
Icon=@COMPANION_NAME@
|
||||
|
||||
@@ -5,39 +5,54 @@
|
||||
<file>../../CREDITS.txt</file>
|
||||
<file>../../DONATIONS.txt</file>
|
||||
<file>../releasenotes.txt</file>
|
||||
<file>images/9xdb.png</file>
|
||||
<file>images/9xdl.png</file>
|
||||
<file>images/9xdr.png</file>
|
||||
<file>images/9xdt.png</file>
|
||||
<file>images/9xdb-bl.png</file>
|
||||
<file>images/9xdl-bl.png</file>
|
||||
<file>images/9xdr-bl.png</file>
|
||||
<file>images/9xdt-bl.png</file>
|
||||
<file>images/9xdb-gr.png</file>
|
||||
<file>images/9xdl-gr.png</file>
|
||||
<file>images/9xdr-gr.png</file>
|
||||
<file>images/9xdt-gr.png</file>
|
||||
<file>images/9xdb-or.png</file>
|
||||
<file>images/9xdl-or.png</file>
|
||||
<file>images/9xdr-or.png</file>
|
||||
<file>images/9xdt-or.png</file>
|
||||
<file>images/9xdb-yl.png</file>
|
||||
<file>images/9xdl-yl.png</file>
|
||||
<file>images/9xdr-yl.png</file>
|
||||
<file>images/9xdt-yl.png</file>
|
||||
<file>images/9xdb-rd.png</file>
|
||||
<file>images/9xdl-rd.png</file>
|
||||
<file>images/9xdr-rd.png</file>
|
||||
<file>images/9xdt-rd.png</file>
|
||||
<file>images/9xmenu.png</file>
|
||||
<file>images/9xmenumenu.png</file>
|
||||
<file>images/9xmenuexit.png</file>
|
||||
<file>images/9xcurs.png</file>
|
||||
<file>images/9xcursup.png</file>
|
||||
<file>images/9xcursplus.png</file>
|
||||
<file>images/9xcursmin.png</file>
|
||||
<file>images/9xcursdown.png</file>
|
||||
<file>images/9xcursphoto.png</file>
|
||||
<file>images/simulator/Horus/middle.png</file>
|
||||
<file>images/simulator/Horus/left.png</file>
|
||||
<file>images/simulator/Horus/right.png</file>
|
||||
<file>images/simulator/Horus/top.png</file>
|
||||
<file>images/simulator/Horus/bottom.png</file>
|
||||
<file>images/simulator/Horus/led.png</file>
|
||||
<file>images/simulator/Horus/border-right.png</file>
|
||||
<file>images/simulator/Horus/left_btn1.png</file>
|
||||
<file>images/simulator/Horus/left_btn2.png</file>
|
||||
<file>images/simulator/Horus/left_scrnsht.png</file>
|
||||
<file>images/simulator/Horus/right_btnU.png</file>
|
||||
<file>images/simulator/Horus/right_btnL.png</file>
|
||||
<file>images/simulator/Horus/right_btnD.png</file>
|
||||
<file>images/simulator/Horus/right_btnR.png</file>
|
||||
<file>images/simulator/Horus/right_ent.png</file>
|
||||
<file>images/simulator/9X/9xdb.png</file>
|
||||
<file>images/simulator/9X/9xdl.png</file>
|
||||
<file>images/simulator/9X/9xdr.png</file>
|
||||
<file>images/simulator/9X/9xdt.png</file>
|
||||
<file>images/simulator/9X/9xdb-bl.png</file>
|
||||
<file>images/simulator/9X/9xdl-bl.png</file>
|
||||
<file>images/simulator/9X/9xdr-bl.png</file>
|
||||
<file>images/simulator/9X/9xdt-bl.png</file>
|
||||
<file>images/simulator/9X/9xdb-gr.png</file>
|
||||
<file>images/simulator/9X/9xdl-gr.png</file>
|
||||
<file>images/simulator/9X/9xdr-gr.png</file>
|
||||
<file>images/simulator/9X/9xdt-gr.png</file>
|
||||
<file>images/simulator/9X/9xdb-or.png</file>
|
||||
<file>images/simulator/9X/9xdl-or.png</file>
|
||||
<file>images/simulator/9X/9xdr-or.png</file>
|
||||
<file>images/simulator/9X/9xdt-or.png</file>
|
||||
<file>images/simulator/9X/9xdb-yl.png</file>
|
||||
<file>images/simulator/9X/9xdl-yl.png</file>
|
||||
<file>images/simulator/9X/9xdr-yl.png</file>
|
||||
<file>images/simulator/9X/9xdt-yl.png</file>
|
||||
<file>images/simulator/9X/9xdb-rd.png</file>
|
||||
<file>images/simulator/9X/9xdl-rd.png</file>
|
||||
<file>images/simulator/9X/9xdr-rd.png</file>
|
||||
<file>images/simulator/9X/9xdt-rd.png</file>
|
||||
<file>images/simulator/9X/9xmenu.png</file>
|
||||
<file>images/simulator/9X/9xmenumenu.png</file>
|
||||
<file>images/simulator/9X/9xmenuexit.png</file>
|
||||
<file>images/simulator/9X/9xcurs.png</file>
|
||||
<file>images/simulator/9X/9xcursup.png</file>
|
||||
<file>images/simulator/9X/9xcursplus.png</file>
|
||||
<file>images/simulator/9X/9xcursmin.png</file>
|
||||
<file>images/simulator/9X/9xcursdown.png</file>
|
||||
<file>images/simulator/9X/9xcursphoto.png</file>
|
||||
<file>images/screenshot.png</file>
|
||||
<file>images/splash-9x.png</file>
|
||||
<file>images/splash-9xrpro.png</file>
|
||||
@@ -47,18 +62,18 @@
|
||||
<file>images/maps.png</file>
|
||||
<file>images/track.png</file>
|
||||
<file>images/track0.png</file>
|
||||
<file>images/x9b0.png</file>
|
||||
<file>images/x9l0.png</file>
|
||||
<file>images/x9l1.png</file>
|
||||
<file>images/x9l2.png</file>
|
||||
<file>images/x9l3.png</file>
|
||||
<file>images/x9l4.png</file>
|
||||
<file>images/x9r0.png</file>
|
||||
<file>images/x9r1.png</file>
|
||||
<file>images/x9r2.png</file>
|
||||
<file>images/x9r3.png</file>
|
||||
<file>images/x9s0.png</file>
|
||||
<file>images/x9t0.png</file>
|
||||
<file>images/simulator/Taranis/x9b0.png</file>
|
||||
<file>images/simulator/Taranis/x9l0.png</file>
|
||||
<file>images/simulator/Taranis/x9l1.png</file>
|
||||
<file>images/simulator/Taranis/x9l2.png</file>
|
||||
<file>images/simulator/Taranis/x9l3.png</file>
|
||||
<file>images/simulator/Taranis/x9l4.png</file>
|
||||
<file>images/simulator/Taranis/x9r0.png</file>
|
||||
<file>images/simulator/Taranis/x9r1.png</file>
|
||||
<file>images/simulator/Taranis/x9r2.png</file>
|
||||
<file>images/simulator/Taranis/x9r3.png</file>
|
||||
<file>images/simulator/Taranis/x9s0.png</file>
|
||||
<file>images/simulator/Taranis/x9t0.png</file>
|
||||
<file>images/taranison.png</file>
|
||||
<file>images/wizard/ailerons.png</file>
|
||||
<file>images/wizard/airbrakes.png</file>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,6 @@ eepromFatHeader(NULL)
|
||||
#define EEPROM_BLOCK_SIZE (4*1024)
|
||||
#define EEPROM_MARK 0x84697771 /* thanks ;) */
|
||||
#define EEPROM_ZONE_SIZE (8*1024)
|
||||
#define EEPROM_BUFFER_SIZE 256
|
||||
#define EEPROM_FAT_SIZE 128
|
||||
#define EEPROM_MAX_ZONES (EEPROM_SIZE / EEPROM_ZONE_SIZE)
|
||||
#define EEPROM_MAX_FILES (EEPROM_MAX_ZONES - 1)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
|
||||
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/nightly/firmware"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-22.open-tx.org/firmware"
|
||||
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-22.open-tx.org/nightly/firmware"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -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:
|
||||
@@ -1433,6 +1441,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;
|
||||
}
|
||||
|
||||
@@ -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.inc
|
||||
add_custom_target(lua_exports
|
||||
COMMAND make PCB=TARANIS lua/lua_exports_taranis.inc
|
||||
COMMAND make PCB=FLAMENCO lua/lua_exports_flamenco.inc
|
||||
COMMAND make PCB=HORUS lua/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")
|
||||
@@ -118,65 +134,70 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
# 9X with ATmega64
|
||||
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
|
||||
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
|
||||
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR with ATmega64
|
||||
target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
|
||||
target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
|
||||
target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xr${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9X with ATmega128
|
||||
target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
|
||||
target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
|
||||
target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9x128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR with ATmega128
|
||||
target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
|
||||
target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
|
||||
target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xr128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Gruvin9x
|
||||
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/gruvin9x)
|
||||
target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Gruvin9x)
|
||||
target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Mega2560
|
||||
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/mega2560)
|
||||
target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Mega2560)
|
||||
target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-mega2560${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Sky9x
|
||||
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
|
||||
target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
|
||||
target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-sky9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR-PRO
|
||||
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
|
||||
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
|
||||
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# AR9X
|
||||
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
|
||||
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
|
||||
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis standard
|
||||
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
|
||||
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
|
||||
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranis${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis Plus
|
||||
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
|
||||
target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
|
||||
target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis X9E
|
||||
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
|
||||
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
|
||||
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}
|
||||
)
|
||||
|
||||
@@ -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,15 +101,19 @@ namespace NAMESPACE {
|
||||
#include "radio/src/pulses/pulses_avr.cpp"
|
||||
#endif
|
||||
|
||||
#include "radio/src/eeprom_common.cpp"
|
||||
#include "radio/src/storage/storage_common.cpp"
|
||||
#if defined(EEPROM_RLC)
|
||||
#include "radio/src/eeprom_rlc.cpp"
|
||||
#else
|
||||
#include "radio/src/eeprom_raw.cpp"
|
||||
#include "radio/src/storage/eeprom_common.cpp"
|
||||
#include "radio/src/storage/eeprom_rlc.cpp"
|
||||
#elif defined(EEPROM)
|
||||
#include "radio/src/storage/eeprom_common.cpp"
|
||||
#include "radio/src/storage/eeprom_raw.cpp"
|
||||
#elif defined(SDCARD)
|
||||
#include "radio/src/storage/sdcard_raw.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBSKY9X)
|
||||
#include "radio/src/eeprom_conversions.cpp"
|
||||
#include "radio/src/storage/eeprom_conversions.cpp"
|
||||
#endif
|
||||
|
||||
#include "radio/src/opentx.cpp"
|
||||
@@ -124,7 +132,80 @@ namespace NAMESPACE {
|
||||
#include "radio/src/vario.cpp"
|
||||
#include "radio/src/trainer_input.cpp"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBHORUS)
|
||||
#include "radio/src/bmp.cpp"
|
||||
#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"
|
||||
@@ -221,38 +302,62 @@ namespace NAMESPACE {
|
||||
#include "radio/src/buzzer.cpp"
|
||||
#endif
|
||||
|
||||
#if 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"
|
||||
#include "radio/src/targets/taranis/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/taranis/haptic_driver.cpp"
|
||||
#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/Taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/Horus/trainer_driver.cpp"
|
||||
#include "radio/src/targets/Horus/serial2_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"
|
||||
#include "radio/src/targets/Taranis/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/haptic_driver.cpp"
|
||||
#if defined(REV9E)
|
||||
#include "radio/src/targets/taranis/top_lcd_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/top_lcd_driver.cpp"
|
||||
#endif
|
||||
#include "radio/src/targets/taranis/pulses_driver.cpp"
|
||||
#include "radio/src/targets/taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/taranis/trainer_driver.cpp"
|
||||
#include "radio/src/targets/taranis/serial2_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/pulses_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/trainer_driver.cpp"
|
||||
#include "radio/src/targets/Taranis/serial2_driver.cpp"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "radio/src/targets/sky9x/board_sky9x.cpp"
|
||||
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pwr_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/eeprom_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/keys_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/audio_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/coproc_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/haptic_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/serial2_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pulses_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/board_sky9x.cpp"
|
||||
#include "radio/src/targets/Sky9x/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/pwr_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/eeprom_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/keys_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/audio_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/sdcard_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/coproc_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/haptic_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/serial2_driver.cpp"
|
||||
#include "radio/src/targets/Sky9x/pulses_driver.cpp"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
|
||||
#include "radio/src/targets/gruvin9x/somo14d.cpp"
|
||||
#include "radio/src/targets/Gruvin9x/board_gruvin9x.cpp"
|
||||
#include "radio/src/targets/Gruvin9x/somo14d.cpp"
|
||||
#elif defined(PCBMEGA2560)
|
||||
#include "radio/src/targets/mega2560/board_mega2560.cpp"
|
||||
#include "radio/src/targets/Mega2560/board_mega2560.cpp"
|
||||
#else
|
||||
#include "radio/src/targets/stock/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"
|
||||
@@ -459,11 +564,16 @@ void OpenTxSimulator::getTrims(Trims & trims)
|
||||
|
||||
void OpenTxSimulator::wheelEvent(int steps)
|
||||
{
|
||||
#if defined(REV9E)
|
||||
if (steps == 255)
|
||||
x9de_rotenc -= 2;
|
||||
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
|
||||
if (steps > 0)
|
||||
rotencValue -= 2;
|
||||
else
|
||||
x9de_rotenc += 2;
|
||||
rotencValue += 2;
|
||||
#elif defined(REV9E)
|
||||
if (steps == 255)
|
||||
rotencValue -= 2;
|
||||
else
|
||||
rotencValue += 2;
|
||||
#elif defined(PCBSKY9X) && !defined(REVX)
|
||||
g_rotenc[0] += steps*4;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
@@ -526,7 +636,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; i<GetCurrentFirmware()->getCapability(Pots); i++) {
|
||||
if (radioData.generalSettings.isPotAvailable(i)) {
|
||||
flags |= (SIMULATOR_FLAGS_S1 << i);
|
||||
|
||||
|
After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -70,8 +70,8 @@
|
||||
#include "radiointerface.h"
|
||||
#include "progressdialog.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
|
||||
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/nightly/companion"
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/companion"
|
||||
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightly/companion"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -278,7 +278,7 @@ void MainWindow::closeUpdatesWaitDialog()
|
||||
void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
{
|
||||
QByteArray qba = reply->readAll();
|
||||
int i = qba.indexOf("C9X_VERSION");
|
||||
int i = qba.indexOf("VERSION");
|
||||
if (i>0) {
|
||||
QString version = qba.mid(i+14, qba.indexOf("\"", i+14)-i-14);
|
||||
|
||||
@@ -288,7 +288,7 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
|
||||
int vnum = version2index(version);
|
||||
|
||||
QString c9xversion = QString(C9X_VERSION);
|
||||
QString c9xversion = QString(VERSION);
|
||||
int c9xver = version2index(c9xversion);
|
||||
|
||||
if (c9xver < vnum) {
|
||||
@@ -899,7 +899,7 @@ void MainWindow::about()
|
||||
aboutStr.append("<br/><br/>");
|
||||
aboutStr.append(tr("If you've found this program useful, please support by <a href='%1'>donating</a>").arg(DONATE_STR));
|
||||
aboutStr.append("<br/><br/>");
|
||||
aboutStr.append(QString("Version %1, %2").arg(C9X_VERSION).arg(__DATE__));
|
||||
aboutStr.append(QString("Version %1, %2").arg(VERSION).arg(__DATE__));
|
||||
aboutStr.append("<br/><br/>");
|
||||
aboutStr.append(tr("Copyright OpenTX Team") + "<br/>© 2011-2015<br/>");
|
||||
QMessageBox msgBox(this);
|
||||
@@ -930,7 +930,7 @@ void MainWindow::updateMenus()
|
||||
updateLanguageActions();
|
||||
updateIconSizeActions();
|
||||
updateIconThemeActions();
|
||||
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(C9X_VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
|
||||
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
|
||||
}
|
||||
|
||||
MdiChild *MainWindow::createMdiChild()
|
||||
|
||||
@@ -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
|
||||
@@ -16,11 +18,9 @@ set(simulation_UIS
|
||||
|
||||
set(simulation_HDRS
|
||||
simulatordialog.h
|
||||
cursorwidget.h
|
||||
menuwidget.h
|
||||
xcursorwidget.h
|
||||
xmenuwidget.h
|
||||
myslider.h
|
||||
# lcdwidget.h
|
||||
buttonswidget.h
|
||||
sliderwidget.h
|
||||
telemetrysimu.h
|
||||
trainersimu.h
|
||||
debugoutput.h
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BUTTONSWIDGET_H_
|
||||
#define _BUTTONSWIDGET_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
|
||||
class ButtonsWidget : public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit ButtonsWidget(QWidget * parent):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void setStyleSheet(const QString & sheet)
|
||||
{
|
||||
defaultStyleSheet = sheet;
|
||||
QWidget::setStyleSheet(sheet);
|
||||
}
|
||||
|
||||
void addArea(int x1, int y1, int x2, int y2, int key, const char * bitmap)
|
||||
{
|
||||
QPolygon polygon;
|
||||
polygon.setPoints(4, x1, y1, x1, y2, x2, y2, x2, y1);
|
||||
addArea(polygon, key, bitmap);
|
||||
}
|
||||
|
||||
void addArea(const QPolygon & polygon, int key, const char * bitmap)
|
||||
{
|
||||
areas.push_back(Area(polygon, key, bitmap));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
class Area {
|
||||
public:
|
||||
Area(const QPolygon & polygon, int key, const char * bitmap):
|
||||
polygon(polygon),
|
||||
key(key),
|
||||
bitmap(bitmap)
|
||||
{
|
||||
}
|
||||
bool contains(int x, int y)
|
||||
{
|
||||
return polygon.containsPoint(QPoint(x, y), Qt::OddEvenFill);
|
||||
}
|
||||
public:
|
||||
QPolygon polygon;
|
||||
int key;
|
||||
const char * bitmap;
|
||||
};
|
||||
|
||||
void setBitmap(const char * bitmap)
|
||||
{
|
||||
if (bitmap) {
|
||||
QWidget::setStyleSheet(QString("background:url(:/images/simulator/%1);").arg(bitmap));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
int x = event->x();
|
||||
int y = event->y();
|
||||
setFocus();
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
foreach(Area area, areas) {
|
||||
if (area.contains(x, y)) {
|
||||
setBitmap(area.bitmap);
|
||||
emit buttonPressed(area.key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
QWidget::setStyleSheet(defaultStyleSheet);
|
||||
setFocus();
|
||||
emit buttonPressed(0);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
void buttonPressed(int button);
|
||||
|
||||
protected:
|
||||
|
||||
QList<Area> areas;
|
||||
QString defaultStyleSheet;
|
||||
};
|
||||
|
||||
#endif /* _BUTTONSWIDGET_H_ */
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#ifndef CURSORWIDGET_H
|
||||
#define CURSORWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
|
||||
class cursorWidget : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit cursorWidget(QWidget * parent = 0):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
float upx[] = {68,28,51,83,105,68};
|
||||
float upy[] = {83,45,32,32,45,83};
|
||||
float minx[] = {74,114,127,127,114,74};
|
||||
float miny[] = {90,51,80,106,130,90};
|
||||
float dox[] = {68,28,51,83,105,68};
|
||||
float doy[] = {98,137,151,151,137,98};
|
||||
float plusx[] = { 80,20,7,7,20,80};
|
||||
float plusy[] = {90,51,80,106,130,90};
|
||||
|
||||
int x=event->x();
|
||||
int y=event->y();
|
||||
setFocus();
|
||||
if (event->button()==Qt::LeftButton) {
|
||||
if (pnpoly(6,upx,upy,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/9xcursup.png);");
|
||||
emit buttonPressed(Qt::Key_Up);
|
||||
}
|
||||
else if (pnpoly(6,minx,miny,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/9xcursmin.png);");
|
||||
emit buttonPressed(Qt::Key_Right);
|
||||
}
|
||||
else if (pnpoly(6,dox,doy,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/9xcursdown.png);");
|
||||
emit buttonPressed(Qt::Key_Down);
|
||||
}
|
||||
else if (pnpoly(6,plusx,plusy,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/9xcursplus.png);");
|
||||
emit buttonPressed(Qt::Key_Left);
|
||||
} else if (sqrt(((float)x-22)*((float)x-22)+((float)y-165)*((float)y-165))<17) {
|
||||
setStyleSheet("background:url(:/images/9xcursphoto.png);");
|
||||
emit buttonPressed(Qt::Key_Print);
|
||||
}
|
||||
}
|
||||
// QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
setStyleSheet("background:url(:/images/9xcurs.png);");
|
||||
emit buttonPressed(0);
|
||||
setFocus();
|
||||
//QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
||||
{
|
||||
int i, j, c = 0;
|
||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
||||
c = !c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonPressed(int button);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* CURSORWIDGET_H */
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef _DIALWIDGET_H_
|
||||
#define _DIALWIDGET_H_
|
||||
|
||||
class DialWidget : public QDial
|
||||
{
|
||||
public:
|
||||
|
||||
explicit DialWidget(QWidget * parent = 0):
|
||||
QDial(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||
setValue(0);
|
||||
event->accept();
|
||||
}
|
||||
QDial::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _DIALWIDGET_H_
|
||||
@@ -14,15 +14,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef lcd_widget_h
|
||||
#define lcd_widget_h
|
||||
#ifndef _LCDWIDGET_H_
|
||||
#define _LCDWIDGET_H_
|
||||
|
||||
#include <QWidget>
|
||||
#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 +32,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 +46,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 +112,17 @@ class lcdWidget : public QWidget {
|
||||
{
|
||||
QRgb rgb;
|
||||
|
||||
if (lcdDepth >= 8) {
|
||||
if (lcdDepth == 16) {
|
||||
for (int x=0; x<lcdWidth; x++) {
|
||||
for (int y=0; y<lcdHeight; y++) {
|
||||
uint16_t z = ((uint16_t *)lcdBuf)[y * lcdWidth + x];
|
||||
rgb = qRgb(255*((z&0xF800)>>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<lcdWidth; x++) {
|
||||
for (int y=0; y<lcdHeight; y++) {
|
||||
uint16_t z = ((uint16_t *)lcdBuf)[y * lcdWidth + x];
|
||||
@@ -175,4 +188,4 @@ class lcdWidget : public QWidget {
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _LCDWIDGET_H_
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#ifndef MENUWIDGET_H
|
||||
#define MENUWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
|
||||
class menuWidget : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit menuWidget(QWidget * parent = 0):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
int x=event->x();
|
||||
int y=event->y();
|
||||
setFocus();
|
||||
if (event->button()==Qt::LeftButton) {
|
||||
if (x>25 && x<71 && y>60 && y<81) {
|
||||
setStyleSheet("background:url(:/images/9xmenumenu.png);");
|
||||
emit buttonPressed(Qt::Key_Enter);
|
||||
} else if (x>25 && x<71 && y>117 && y<139) {
|
||||
setStyleSheet("background:url(:/images/9xmenuexit.png);");
|
||||
emit buttonPressed(Qt::Key_Escape);
|
||||
}
|
||||
}
|
||||
// QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
setStyleSheet("background:url(:/images/9xmenu.png);");
|
||||
setFocus();
|
||||
emit buttonPressed(0);
|
||||
// QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonPressed(int button);
|
||||
|
||||
};
|
||||
#endif /* MENUWIDGET_H */
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef MYQDIAL_H
|
||||
#define MYQDIAL_H
|
||||
|
||||
|
||||
class myQDial : public QDial
|
||||
{
|
||||
public:
|
||||
explicit myQDial(QWidget *parent = 0) : QDial(parent) {}
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||
setValue(0);
|
||||
event->accept();
|
||||
}
|
||||
QDial::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef MYSLIDER_H
|
||||
#define MYSLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
#include <QtGui>
|
||||
|
||||
class mySlider : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit mySlider(QFrame * parent = 0):
|
||||
QSlider(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||
setValue(0);
|
||||
event->accept();
|
||||
}
|
||||
QSlider::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -30,7 +30,16 @@
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@@ -66,7 +75,16 @@
|
||||
<number>2</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@@ -399,7 +417,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimHLeft">
|
||||
<widget class="SliderWidget" name="trimHLeft">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -463,7 +481,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimVLeft">
|
||||
<widget class="SliderWidget" name="trimVLeft">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -868,7 +886,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimHRight">
|
||||
<widget class="SliderWidget" name="trimHRight">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -932,7 +950,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimVRight">
|
||||
<widget class="SliderWidget" name="trimVRight">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -990,7 +1008,16 @@ QPushButton:checked {
|
||||
<number>2</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -1020,7 +1047,7 @@ QPushButton:checked {
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="myQDial" name="pot0">
|
||||
<widget class="DialWidget" name="pot0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1077,7 +1104,7 @@ QPushButton:checked {
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="myQDial" name="pot1">
|
||||
<widget class="DialWidget" name="pot1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1137,7 +1164,7 @@ QPushButton:checked {
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="myQDial" name="pot2">
|
||||
<widget class="DialWidget" name="pot2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1262,7 +1289,7 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xdt.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xdt.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1281,12 +1308,12 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xdl.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xdl.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" rowspan="3">
|
||||
<widget class="menuWidget" name="menu" native="true">
|
||||
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1300,12 +1327,12 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xmenu.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xmenu.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="lcdWidget" name="lcd" native="true">
|
||||
<widget class="LcdWidget" name="lcd" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1335,29 +1362,7 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xdb.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="cursorWidget" name="cursor" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>186</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xcurs.png);</string>
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xdb.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1376,7 +1381,29 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/9xdr.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xdr.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>186</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/simulator/9X/9xcurs.png);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1469,32 +1496,26 @@ QPushButton:checked {
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lcdWidget</class>
|
||||
<class>LcdWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>lcdwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mySlider</class>
|
||||
<class>SliderWidget</class>
|
||||
<extends>QSlider</extends>
|
||||
<header location="global">myslider.h</header>
|
||||
<header location="global">sliderwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cursorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cursorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>menuWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>menuwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>myQDial</class>
|
||||
<class>DialWidget</class>
|
||||
<extends>QDial</extends>
|
||||
<header location="global">myqdial.h</header>
|
||||
<header location="global">dialwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">buttonswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>739</width>
|
||||
<height>658</height>
|
||||
<height>695</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -30,7 +30,16 @@
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@@ -86,7 +95,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="xcursorWidget" name="cursor" native="true">
|
||||
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -103,7 +112,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/x9l0.png);</string>
|
||||
<string notr="true">background:url(:/images/simulator/Taranis/x9l0.png);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -122,12 +131,12 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/x9t0.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/Taranis/x9t0.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="3">
|
||||
<widget class="xmenuWidget" name="menu" native="true">
|
||||
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -141,12 +150,12 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/x9r0.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/Taranis/x9r0.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="lcdWidget" name="lcd" native="true">
|
||||
<widget class="LcdWidget" name="lcd" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -176,7 +185,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:url(:/images/x9b0.png)</string>
|
||||
<string notr="true">background:url(:/images/simulator/Taranis/x9b0.png)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -864,7 +873,7 @@
|
||||
<item row="0" column="8" rowspan="2" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<item row="0" column="1">
|
||||
<widget class="myQDial" name="pot1">
|
||||
<widget class="DialWidget" name="pot1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -904,7 +913,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="myQDial" name="pot3">
|
||||
<widget class="DialWidget" name="pot3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -935,7 +944,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="myQDial" name="pot2">
|
||||
<widget class="DialWidget" name="pot2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -966,7 +975,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="myQDial" name="pot0">
|
||||
<widget class="DialWidget" name="pot0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1248,7 +1257,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="mySlider" name="trimVLeft">
|
||||
<widget class="SliderWidget" name="trimVLeft">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1320,7 +1329,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimHLeft">
|
||||
<widget class="SliderWidget" name="trimHLeft">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -1420,7 +1429,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="mySlider" name="trimVRight">
|
||||
<widget class="SliderWidget" name="trimVRight">
|
||||
<property name="toolTip">
|
||||
<string>Right Double Click to Reset</string>
|
||||
</property>
|
||||
@@ -1638,7 +1647,7 @@ QPushButton:checked {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="mySlider" name="trimHRight">
|
||||
<widget class="SliderWidget" name="trimHRight">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1735,32 +1744,26 @@ QPushButton:checked {
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lcdWidget</class>
|
||||
<class>LcdWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>lcdwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mySlider</class>
|
||||
<class>ButtonsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">buttonswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SliderWidget</class>
|
||||
<extends>QSlider</extends>
|
||||
<header location="global">myslider.h</header>
|
||||
<header location="global">sliderwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>xcursorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">xcursorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>xmenuWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>xmenuwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>myQDial</class>
|
||||
<class>DialWidget</class>
|
||||
<extends>QDial</extends>
|
||||
<header location="global">myqdial.h</header>
|
||||
<header location="global">dialwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "simulatordialog.h"
|
||||
#include "ui_simulatordialog-9x.h"
|
||||
#include "ui_simulatordialog-taranis.h"
|
||||
#include "appdata.h"
|
||||
#include "lcdwidget.h"
|
||||
#include <iostream>
|
||||
#include "helpers.h"
|
||||
#include "simulatorinterface.h"
|
||||
#include "sliderwidget.h"
|
||||
|
||||
#define GBALL_SIZE 20
|
||||
#define RESX 1024
|
||||
@@ -47,6 +48,11 @@ void SimulatorDialog::updateDebugOutput()
|
||||
traceMutex.unlock();
|
||||
}
|
||||
|
||||
void SimulatorDialog::wheelEvent (QWheelEvent *event)
|
||||
{
|
||||
simulator->wheelEvent(event->delta() > 0 ? 1 : -1);
|
||||
}
|
||||
|
||||
SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||
QDialog(parent),
|
||||
flags(flags),
|
||||
@@ -70,153 +76,6 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator
|
||||
traceCallbackInstance = this;
|
||||
}
|
||||
|
||||
uint32_t SimulatorDialog9X::switchstatus = 0;
|
||||
|
||||
SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||
SimulatorDialog(parent, simulator, flags),
|
||||
ui(new Ui::SimulatorDialog9X),
|
||||
beepShow(0)
|
||||
{
|
||||
lcdWidth = 128;
|
||||
lcdHeight = 64;
|
||||
lcdDepth = 1;
|
||||
|
||||
initUi<Ui::SimulatorDialog9X>(ui);
|
||||
|
||||
// install simulator TRACE hook
|
||||
simulator->installTraceHook(traceCb);
|
||||
|
||||
backLight = g.backLight();
|
||||
if (backLight > 4) backLight = 0;
|
||||
switch (backLight) {
|
||||
case 1:
|
||||
ui->lcd->setBackgroundColor(166,247,159);
|
||||
break;
|
||||
case 2:
|
||||
ui->lcd->setBackgroundColor(247,159,166);
|
||||
break;
|
||||
case 3:
|
||||
ui->lcd->setBackgroundColor(255,195,151);
|
||||
break;
|
||||
case 4:
|
||||
ui->lcd->setBackgroundColor(247,242,159);
|
||||
break;
|
||||
default:
|
||||
ui->lcd->setBackgroundColor(159,165,247);
|
||||
break;
|
||||
}
|
||||
|
||||
//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));
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
pots[i]->setProperty("index", i);
|
||||
connect(pots[i], SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int)));
|
||||
}
|
||||
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()));
|
||||
}
|
||||
|
||||
SimulatorDialog9X::~SimulatorDialog9X()
|
||||
{
|
||||
saveSwitches();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
uint32_t SimulatorDialogTaranis::switchstatus = 0;
|
||||
|
||||
SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||
SimulatorDialog(parent, simulator, flags),
|
||||
ui(new Ui::SimulatorDialogTaranis)
|
||||
{
|
||||
lcdWidth = 212;
|
||||
lcdHeight = 64;
|
||||
lcdDepth = 4;
|
||||
|
||||
initUi<Ui::SimulatorDialogTaranis>(ui);
|
||||
|
||||
// install simulator TRACE hook
|
||||
simulator->installTraceHook(traceCb);
|
||||
|
||||
ui->lcd->setBackgroundColor(47, 123, 227);
|
||||
|
||||
// restore switches
|
||||
if (g.simuSW()) {
|
||||
restoreSwitches();
|
||||
}
|
||||
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||
pots[i]->setValue(-1024);
|
||||
pots[i]->setSingleStep(2048/5);
|
||||
pots[i]->setPageStep(2048/5);
|
||||
}
|
||||
else if (!(flags & (SIMULATOR_FLAGS_S1 << i))) {
|
||||
pots[i]->hide();
|
||||
potLabels[i]->hide();
|
||||
}
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
SimulatorDialogTaranis::~SimulatorDialogTaranis()
|
||||
{
|
||||
saveSwitches();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
SimulatorDialog::~SimulatorDialog()
|
||||
{
|
||||
traceCallbackInstance = 0;
|
||||
@@ -244,17 +103,6 @@ void SimulatorDialog::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::dialChanged(int value)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
potValues[index]->setText(QString("%1 %").arg((value*100)/1024));
|
||||
}
|
||||
|
||||
void SimulatorDialog::wheelEvent (QWheelEvent *event)
|
||||
{
|
||||
simulator->wheelEvent(event->delta() > 0 ? 1 : -1);
|
||||
}
|
||||
|
||||
void SimulatorDialog::onTrimPressed()
|
||||
{
|
||||
if (sender()->objectName() == QString("trimHL_L"))
|
||||
@@ -488,7 +336,7 @@ void SimulatorDialog::initUi(T * ui)
|
||||
|
||||
QSlider * slider = new QSlider(tabWidget);
|
||||
slider->setEnabled(false);
|
||||
slider->setMaximumSize(QSize(16777215, 18));
|
||||
/*slider->setMaximumSize(QSize(16777215, 18));
|
||||
slider->setStyleSheet(QString::fromUtf8("QSlider::sub-page:horizontal:disabled {\n"
|
||||
"border-color: #999;\n"
|
||||
"}\n"
|
||||
@@ -501,7 +349,7 @@ void SimulatorDialog::initUi(T * ui)
|
||||
"background: #0000CC;\n"
|
||||
"border: 1px solid #aaa;\n"
|
||||
"border-radius: 4px;\n"
|
||||
"}"));
|
||||
"}")); */
|
||||
slider->setMinimum(-1024);
|
||||
slider->setMaximum(1024);
|
||||
slider->setPageStep(128);
|
||||
@@ -599,36 +447,6 @@ void SimulatorDialog::onButtonPressed(int value)
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::setLightOn(bool enable)
|
||||
{
|
||||
QString bg = "";
|
||||
if (enable) {
|
||||
QStringList list;
|
||||
list << "bl" << "gr" << "rd" << "or" << "yl";
|
||||
bg = QString("-") + list[backLight];
|
||||
}
|
||||
ui->top->setStyleSheet(QString("background:url(:/images/9xdt%1.png);").arg(bg));
|
||||
ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg));
|
||||
ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg));
|
||||
ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg));
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::updateBeepButton()
|
||||
{
|
||||
#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
||||
#define CBEEP_OFF "QLabel { }"
|
||||
|
||||
if (beepVal) {
|
||||
beepShow = 20;
|
||||
}
|
||||
|
||||
ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF);
|
||||
|
||||
if (beepShow) {
|
||||
beepShow--;
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorDialog::onTimerEvent()
|
||||
{
|
||||
static unsigned int lcd_counter = 0;
|
||||
@@ -728,211 +546,6 @@ void SimulatorDialog::setTrims()
|
||||
trimHRight->setRange(trimMin, trimMax); trimHRight->setValue(trims.values[3]);
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::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
|
||||
},
|
||||
|
||||
{
|
||||
pots[0]->value(),
|
||||
pots[1]->value(),
|
||||
pots[2]->value()
|
||||
},
|
||||
|
||||
{
|
||||
ui->switchTHR->isChecked(),
|
||||
ui->switchRUD->isChecked(),
|
||||
ui->switchELE->isChecked(),
|
||||
ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1),
|
||||
ui->switchAIL->isChecked(),
|
||||
ui->switchGEA->isChecked(),
|
||||
ui->switchTRN->isDown(),
|
||||
0, 0, 0
|
||||
},
|
||||
|
||||
{
|
||||
buttonPressed == Qt::Key_Enter,
|
||||
buttonPressed == Qt::Key_Escape,
|
||||
buttonPressed == Qt::Key_Down,
|
||||
buttonPressed == Qt::Key_Up,
|
||||
buttonPressed == Qt::Key_Right,
|
||||
buttonPressed == Qt::Key_Left,
|
||||
},
|
||||
|
||||
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 SimulatorDialog9X::saveSwitches(void)
|
||||
{
|
||||
// qDebug() << "SimulatorDialog9X::saveSwitches()";
|
||||
switchstatus=ui->switchTHR->isChecked();
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchRUD->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID2->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID1->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID0->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchGEA->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchELE->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchAIL->isChecked()&0x1);
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::restoreSwitches(void)
|
||||
{
|
||||
// qDebug() << "SimulatorDialog9X::restoreSwitches()";
|
||||
ui->switchAIL->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchELE->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchGEA->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID0->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID1->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID2->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchRUD->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchTHR->setChecked(switchstatus & 0x1);
|
||||
}
|
||||
|
||||
void SimulatorDialogTaranis::resetSH()
|
||||
{
|
||||
ui->switchH->setValue(0);
|
||||
}
|
||||
|
||||
void SimulatorDialogTaranis::on_switchH_sliderReleased()
|
||||
{
|
||||
QTimer::singleShot(400, this, SLOT(resetSH()));
|
||||
}
|
||||
|
||||
void SimulatorDialogTaranis::getValues()
|
||||
{
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||
int s1 = round((pots[i]->value()+1024)/(2048.0/5))*(2048.0/5)-1024;
|
||||
pots[i]->setValue(s1);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
|
||||
{
|
||||
-pots[0]->value(),
|
||||
pots[1]->value(),
|
||||
((flags && SIMULATOR_FLAGS_S3) ? pots[2]->value() : 0),
|
||||
-sliders[0]->value(),
|
||||
sliders[1]->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 SimulatorDialogTaranis::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 SimulatorDialogTaranis::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);
|
||||
}
|
||||
|
||||
inline int chVal(int val)
|
||||
{
|
||||
return qMin(1024, qMax(-1024, val));
|
||||
@@ -1134,3 +747,8 @@ void SimulatorDialog::onjoystickAxisValueChanged(int axis, int value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "simulatordialog9x.cpp"
|
||||
#include "simulatordialogtaranis.cpp"
|
||||
#include "simulatordialogflamenco.cpp"
|
||||
#include "simulatordialoghorus.cpp"
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
namespace Ui {
|
||||
class SimulatorDialog9X;
|
||||
class SimulatorDialogTaranis;
|
||||
class SimulatorDialogFlamenco;
|
||||
class SimulatorDialogHorus;
|
||||
}
|
||||
|
||||
// TODO rename + move?
|
||||
class lcdWidget;
|
||||
class mySlider;
|
||||
class LcdWidget;
|
||||
class SliderWidget;
|
||||
|
||||
#define SIMULATOR_FLAGS_NOTX 1
|
||||
#define SIMULATOR_FLAGS_STICK_MODE_LEFT 2
|
||||
@@ -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,14 +60,14 @@ class SimulatorDialog : public QDialog
|
||||
virtual void updateBeepButton() { }
|
||||
|
||||
unsigned int flags;
|
||||
lcdWidget * lcd;
|
||||
LcdWidget * lcd;
|
||||
QGraphicsView * leftStick, * rightStick;
|
||||
QVector<QDial *> pots;
|
||||
QVector<QLabel *> potLabels;
|
||||
QVector<QLabel *> potValues;
|
||||
QVector<QSlider *> sliders;
|
||||
|
||||
mySlider * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
|
||||
SliderWidget * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
|
||||
QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc;
|
||||
QTabWidget * tabWidget;
|
||||
QVector<QLabel *> logicalSwitchLabels;
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
#include "ui_simulatordialog-9x.h"
|
||||
|
||||
uint32_t SimulatorDialog9X::switchstatus = 0;
|
||||
|
||||
SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||
SimulatorDialog(parent, simulator, flags),
|
||||
ui(new Ui::SimulatorDialog9X),
|
||||
beepShow(0)
|
||||
{
|
||||
QPolygon polygon;
|
||||
|
||||
lcdWidth = 128;
|
||||
lcdHeight = 64;
|
||||
lcdDepth = 1;
|
||||
|
||||
initUi<Ui::SimulatorDialog9X>(ui);
|
||||
|
||||
polygon.setPoints(6, 68, 83, 28, 45, 51, 32, 83, 32, 105, 45, 68, 83);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Up, "9X/9xcursup.png");
|
||||
polygon.setPoints(6, 74, 90, 114, 51, 127, 80, 127, 106, 114, 130, 74, 90);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Right, "9X/9xcursmin.png");
|
||||
polygon.setPoints(6, 68, 98, 28, 137, 51, 151, 83, 151, 105, 137, 68, 98);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Down, "9X/9xcursdown.png");
|
||||
polygon.setPoints(6, 80, 90, 20, 51, 7, 80, 7, 106, 20, 130, 80, 90);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Left, "9X/9xcursplus.png");
|
||||
ui->leftbuttons->addArea(5, 148, 39, 182, Qt::Key_Print, "9X/9xcursphoto.png");
|
||||
|
||||
ui->rightbuttons->addArea(25, 60, 71, 81, Qt::Key_Enter, "9X/9xmenumenu.png");
|
||||
ui->rightbuttons->addArea(25, 117, 71, 139, Qt::Key_Escape, "9X/9xmenuexit.png");
|
||||
|
||||
// install simulator TRACE hook
|
||||
simulator->installTraceHook(traceCb);
|
||||
|
||||
backLight = g.backLight();
|
||||
if (backLight > 4) backLight = 0;
|
||||
switch (backLight) {
|
||||
case 1:
|
||||
ui->lcd->setBackgroundColor(166,247,159);
|
||||
break;
|
||||
case 2:
|
||||
ui->lcd->setBackgroundColor(247,159,166);
|
||||
break;
|
||||
case 3:
|
||||
ui->lcd->setBackgroundColor(255,195,151);
|
||||
break;
|
||||
case 4:
|
||||
ui->lcd->setBackgroundColor(247,242,159);
|
||||
break;
|
||||
default:
|
||||
ui->lcd->setBackgroundColor(159,165,247);
|
||||
break;
|
||||
}
|
||||
|
||||
//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));
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
pots[i]->setProperty("index", i);
|
||||
connect(pots[i], SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int)));
|
||||
}
|
||||
connect(ui->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||
connect(ui->rightbuttons, 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()));
|
||||
}
|
||||
|
||||
SimulatorDialog9X::~SimulatorDialog9X()
|
||||
{
|
||||
saveSwitches();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::dialChanged(int value)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
potValues[index]->setText(QString("%1 %").arg((value*100)/1024));
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::setLightOn(bool enable)
|
||||
{
|
||||
QString bg = "";
|
||||
if (enable) {
|
||||
QStringList list;
|
||||
list << "bl" << "gr" << "rd" << "or" << "yl";
|
||||
bg = QString("-") + list[backLight];
|
||||
}
|
||||
ui->top->setStyleSheet(QString("background:url(:/images/simulator/9X/9xdt%1.png);").arg(bg));
|
||||
ui->bottom->setStyleSheet(QString("background:url(:/images/simulator/9X/9xdb%1.png);").arg(bg));
|
||||
ui->left->setStyleSheet(QString("background:url(:/images/simulator/9X/9xdl%1.png);").arg(bg));
|
||||
ui->right->setStyleSheet(QString("background:url(:/images/simulator/9X/9xdr%1.png);").arg(bg));
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::updateBeepButton()
|
||||
{
|
||||
#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
||||
#define CBEEP_OFF "QLabel { }"
|
||||
|
||||
if (beepVal) {
|
||||
beepShow = 20;
|
||||
}
|
||||
|
||||
ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF);
|
||||
|
||||
if (beepShow) {
|
||||
beepShow--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SimulatorDialog9X::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
|
||||
},
|
||||
|
||||
{
|
||||
pots[0]->value(),
|
||||
pots[1]->value(),
|
||||
pots[2]->value()
|
||||
},
|
||||
|
||||
{
|
||||
ui->switchTHR->isChecked(),
|
||||
ui->switchRUD->isChecked(),
|
||||
ui->switchELE->isChecked(),
|
||||
ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1),
|
||||
ui->switchAIL->isChecked(),
|
||||
ui->switchGEA->isChecked(),
|
||||
ui->switchTRN->isDown(),
|
||||
0, 0, 0
|
||||
},
|
||||
|
||||
{
|
||||
buttonPressed == Qt::Key_Enter,
|
||||
buttonPressed == Qt::Key_Escape,
|
||||
buttonPressed == Qt::Key_Down,
|
||||
buttonPressed == Qt::Key_Up,
|
||||
buttonPressed == Qt::Key_Right,
|
||||
buttonPressed == Qt::Key_Left,
|
||||
},
|
||||
|
||||
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 SimulatorDialog9X::saveSwitches(void)
|
||||
{
|
||||
// qDebug() << "SimulatorDialog9X::saveSwitches()";
|
||||
switchstatus=ui->switchTHR->isChecked();
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchRUD->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID2->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID1->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchID0->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchGEA->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchELE->isChecked()&0x1);
|
||||
switchstatus<<=1;
|
||||
switchstatus+=(ui->switchAIL->isChecked()&0x1);
|
||||
}
|
||||
|
||||
void SimulatorDialog9X::restoreSwitches(void)
|
||||
{
|
||||
// qDebug() << "SimulatorDialog9X::restoreSwitches()";
|
||||
ui->switchAIL->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchELE->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchGEA->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID0->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID1->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchID2->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchRUD->setChecked(switchstatus & 0x1);
|
||||
switchstatus >>=1;
|
||||
ui->switchTHR->setChecked(switchstatus & 0x1);
|
||||
}
|
||||
|
||||
@@ -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::SimulatorDialogFlamenco>(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->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||
connect(ui->rightbuttons, 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);
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
#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)
|
||||
{
|
||||
QPolygon polygon;
|
||||
|
||||
lcdWidth = 480;
|
||||
lcdHeight = 272;
|
||||
lcdDepth = 16;
|
||||
|
||||
initUi<Ui::SimulatorDialogHorus>(ui);
|
||||
|
||||
polygon.setPoints(23, 72,125, 85,126, 92,129, 98,133, 100,136, 100,141, 99,145, 96,148, 92,149, 87,147, 82,146, 76,145, 69,146, 63,147, 58,148, 54,148, 52,147, 49,144, 48,139, 47,135, 53,130, 63,127, 72,125);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Up, "Horus/right_btnU.png");
|
||||
polygon.setPoints(25, 125,163, 129,164, 132,167, 135,171, 136,177, 137,184, 138,189, 138,195, 137,202, 135,207, 134,211, 131,214, 130,216, 125,217, 121,216, 118,214, 115,211, 115,204, 118,195, 118,187, 118,181, 116,176, 116,171, 118,165, 125,163);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Right, "Horus/right_btnR.png");
|
||||
polygon.setPoints(20, 64,234, 72,235, 84,234, 91,232, 97,234, 99,237, 101,242, 100,248, 96,250, 92,252, 83,254, 72,255, 64,254, 57,253, 50,249, 48,245, 47,240, 50,235, 55,233, 64,234);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Down, "Horus/right_btnD.png");
|
||||
polygon.setPoints(22, 24,163, 29,166, 30,168, 31,171, 31,175, 30,179, 29,187, 29,192, 30,198, 32,204, 32,209, 30,214, 27,216, 22,217, 17,216, 13,208, 10,197, 9,188, 9,178, 12,169, 15,165, 24,162);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Left, "Horus/right_btnL.png");
|
||||
polygon.setPoints(21, 72,148, 83,149, 97,155, 106,163, 112,174, 114,187, 114,198, 110,210, 101,221, 89,228, 78,230, 66,230, 53,226, 43,218, 36,208, 32,196, 32,181, 37,168, 47,157, 57,151, 73,148);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Enter, "Horus/right_ent.png");
|
||||
polygon.setPoints(26, 25,164, 31,165, 33,167, 35,169, 35,172, 35,174, 34,179, 34,183, 34,190, 34,195, 36,200, 37,204, 38,208, 37,212, 34,216, 29,218, 25,217, 21,215, 18,210, 16,203, 14,194, 14,184, 15,175, 17,169, 21,165, 25,164);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_PageUp, "Horus/left_btn1.png");
|
||||
polygon.setPoints(27, 60,227, 66,228, 71,229, 75,230, 81,229, 86,228, 89,227, 94,227, 97,229, 100,232, 100, 234, 100,238, 100,241, 99,243, 94,246, 88,248, 81,249, 73,249, 63,248, 56,246, 50,243, 48,240, 47,235, 48,232, 51,228, 56,227, 60,227);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Escape, "Horus/left_btn2.png");
|
||||
ui->leftbuttons->addArea(9, 259, 34, 282, Qt::Key_Print, "Horus/left_scrnsht.png");
|
||||
|
||||
// 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->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||
connect(ui->rightbuttons, 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 || middleButtonPressed,
|
||||
buttonPressed == Qt::Key_Up,
|
||||
buttonPressed == Qt::Key_Down,
|
||||
buttonPressed == Qt::Key_Right,
|
||||
buttonPressed == Qt::Key_Left
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
#include "ui_simulatordialog-taranis.h"
|
||||
|
||||
uint32_t SimulatorDialogTaranis::switchstatus = 0;
|
||||
|
||||
SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||
SimulatorDialog(parent, simulator, flags),
|
||||
ui(new Ui::SimulatorDialogTaranis)
|
||||
{
|
||||
QPolygon polygon;
|
||||
|
||||
lcdWidth = 212;
|
||||
lcdHeight = 64;
|
||||
lcdDepth = 4;
|
||||
|
||||
initUi<Ui::SimulatorDialogTaranis>(ui);
|
||||
|
||||
polygon.setPoints(6, 20, 59, 27, 50, 45, 52, 56, 59, 50, 71, 26, 72);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_PageUp, "Taranis/x9l1.png");
|
||||
polygon.setPoints(6, 23, 107, 30, 99, 46, 100, 55, 106, 47, 117, 28, 117);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_PageDown, "Taranis/x9l2.png");
|
||||
polygon.setPoints(6, 24, 154, 32, 144, 46, 146, 57, 156, 46, 167, 29, 166);
|
||||
ui->leftbuttons->addArea(polygon, Qt::Key_Escape, "Taranis/x9l3.png");
|
||||
ui->leftbuttons->addArea(90, 177, 118, 197, Qt::Key_Print, "Taranis/x9l4.png");
|
||||
polygon.setPoints(6, 64, 60, 71, 50, 90, 50, 100, 60, 90, 73, 72, 73);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Plus, "Taranis/x9r1.png");
|
||||
polygon.setPoints(6, 63, 109, 73, 100, 88, 100, 98, 109, 88, 119, 72, 119);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Minus, "Taranis/x9r2.png");
|
||||
polygon.setPoints(6, 63, 155, 72, 146, 90, 146, 98, 155, 88, 166, 72, 166);
|
||||
ui->rightbuttons->addArea(polygon, Qt::Key_Enter, "Taranis/x9r3.png");
|
||||
|
||||
// install simulator TRACE hook
|
||||
simulator->installTraceHook(traceCb);
|
||||
|
||||
ui->lcd->setBackgroundColor(47, 123, 227);
|
||||
|
||||
// restore switches
|
||||
if (g.simuSW()) {
|
||||
restoreSwitches();
|
||||
}
|
||||
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||
pots[i]->setValue(-1024);
|
||||
pots[i]->setSingleStep(2048/5);
|
||||
pots[i]->setPageStep(2048/5);
|
||||
}
|
||||
else if (!(flags & (SIMULATOR_FLAGS_S1 << i))) {
|
||||
pots[i]->hide();
|
||||
potLabels[i]->hide();
|
||||
}
|
||||
}
|
||||
|
||||
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->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||
connect(ui->rightbuttons, 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()));
|
||||
}
|
||||
|
||||
SimulatorDialogTaranis::~SimulatorDialogTaranis()
|
||||
{
|
||||
saveSwitches();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void SimulatorDialogTaranis::resetSH()
|
||||
{
|
||||
ui->switchH->setValue(0);
|
||||
}
|
||||
|
||||
void SimulatorDialogTaranis::on_switchH_sliderReleased()
|
||||
{
|
||||
QTimer::singleShot(400, this, SLOT(resetSH()));
|
||||
}
|
||||
|
||||
void SimulatorDialogTaranis::getValues()
|
||||
{
|
||||
for (int i=0; i<pots.count(); i++) {
|
||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||
int s1 = round((pots[i]->value()+1024)/(2048.0/5))*(2048.0/5)-1024;
|
||||
pots[i]->setValue(s1);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
|
||||
{
|
||||
-pots[0]->value(),
|
||||
pots[1]->value(),
|
||||
((flags && SIMULATOR_FLAGS_S3) ? pots[2]->value() : 0),
|
||||
-sliders[0]->value(),
|
||||
sliders[1]->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 SimulatorDialogTaranis::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 SimulatorDialogTaranis::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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -80,9 +80,9 @@ for (int fm=0; fm<MAX_FLIGHT_MODES; fm++) {
|
||||
|
||||
#ifdef LCDCHANGED_IMPORT
|
||||
#undef LCDCHANGED_IMPORT
|
||||
if (lcd_refresh) {
|
||||
if (simuLcdRefresh) {
|
||||
lightEnable = isBacklightEnable();
|
||||
lcd_refresh = false;
|
||||
simuLcdRefresh = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -98,7 +98,7 @@ return true;
|
||||
|
||||
#ifdef GETLCD_IMPORT
|
||||
#undef GETLCD_IMPORT
|
||||
return (::uint8_t *)lcd_buf;
|
||||
return (::uint8_t *)simuLcdBuf;
|
||||
#endif
|
||||
|
||||
#ifdef GETERROR_IMPORT
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef _SLIDERWIDGET_H_
|
||||
#define _SLIDERWIDGET_H_
|
||||
|
||||
#include <QSlider>
|
||||
#include <QtGui>
|
||||
|
||||
class SliderWidget : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit SliderWidget(QFrame * parent = 0):
|
||||
QSlider(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||
setValue(0);
|
||||
event->accept();
|
||||
}
|
||||
QSlider::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _SLIDERWIDGET_H_
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#ifndef XCURSORWIDGET_H
|
||||
#define XCURSORWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
|
||||
class xcursorWidget : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit xcursorWidget(QWidget * parent = 0):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
float p1x[] = {20,27,45,56,50,26};
|
||||
float p1y[] = {59,50,52,59,71,72};
|
||||
float p2x[] = {23,30,46,55,47,28};
|
||||
float p2y[] = {107,99,100,106,117,117};
|
||||
float p3x[] = {24,32,46,57,46,29};
|
||||
float p3y[] = {154,144,146,156,167,166};
|
||||
|
||||
int x=event->x();
|
||||
int y=event->y();
|
||||
setFocus();
|
||||
if (event->button()==Qt::LeftButton) {
|
||||
if (pnpoly(6,p1x,p1y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9l1.png);");
|
||||
emit buttonPressed(Qt::Key_PageUp);
|
||||
}
|
||||
else if (pnpoly(6,p2x,p2y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9l2.png);");
|
||||
emit buttonPressed(Qt::Key_PageDown);
|
||||
}
|
||||
else if (pnpoly(6,p3x,p3y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9l3.png);");
|
||||
emit buttonPressed(Qt::Key_Escape);
|
||||
} else if ((x>90 && x<118) && (y>177 && y<197)) {
|
||||
setStyleSheet("background:url(:/images/x9l4.png);");
|
||||
emit buttonPressed(Qt::Key_Print);
|
||||
}
|
||||
}
|
||||
// QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
setStyleSheet("background:url(:/images/x9l0.png);");
|
||||
emit buttonPressed(0);
|
||||
setFocus();
|
||||
//QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
||||
{
|
||||
int i, j, c = 0;
|
||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
||||
c = !c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonPressed(int button);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* CURSORWIDGET_H */
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#ifndef XMENUWIDGET_H
|
||||
#define XMENUWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
|
||||
class xmenuWidget : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit xmenuWidget(QWidget * parent = 0):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
float p1x[] = {64,71,90,100,90,72};
|
||||
float p1y[] = {60,50,50,60,73,73};
|
||||
float p2x[] = {63,73,88,98,88,72};
|
||||
float p2y[] = {109,100,100,109,119,119};
|
||||
float p3x[] = {63,72,90,98,88,72};
|
||||
float p3y[] = {155,146,146,155,166,166};
|
||||
|
||||
int x=event->x();
|
||||
int y=event->y();
|
||||
setFocus();
|
||||
if (event->button()==Qt::LeftButton) {
|
||||
if (pnpoly(6,p1x,p1y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9r1.png);");
|
||||
emit buttonPressed(Qt::Key_Plus);
|
||||
}
|
||||
else if (pnpoly(6,p2x,p2y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9r2.png);");
|
||||
emit buttonPressed(Qt::Key_Minus);
|
||||
}
|
||||
else if (pnpoly(6,p3x,p3y,(float)x,(float)y)==1) {
|
||||
setStyleSheet("background:url(:/images/x9r3.png);");
|
||||
emit buttonPressed(Qt::Key_Enter);
|
||||
}
|
||||
}
|
||||
// QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
setStyleSheet("background:url(:/images/x9r0.png);");
|
||||
setFocus();
|
||||
emit buttonPressed(0);
|
||||
// QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
||||
{
|
||||
int i, j, c = 0;
|
||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
||||
c = !c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonPressed(int button);
|
||||
|
||||
};
|
||||
#endif /* XMENUWIDGET_H */
|
||||
|
||||