mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
X10 extra switches sticks (#6423)
[X10] 2 extra sticks switches + 2 extra pots
This commit is contained in:
parent
11cb2ea29b
commit
794fe32006
27 changed files with 390 additions and 166 deletions
|
@ -28,47 +28,51 @@
|
||||||
// A set of bitfield handling macros
|
// A set of bitfield handling macros
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T BF_BIT(uint8_t n)
|
inline T bfBit(uint8_t n)
|
||||||
{
|
{
|
||||||
return T(1) << n;
|
return T(1) << n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BF_BIT_GET(y, mask) ( y & (mask) )
|
#define BFBIT_GET(y, mask) ( y & (mask) )
|
||||||
#define BF_BIT_SET(y, mask) ( y |= (mask) )
|
#define BFBIT_SET(y, mask) ( y |= (mask) )
|
||||||
#define BF_BIT_CLEAR(y, mask) ( y &= ~(mask) )
|
#define BFBIT_CLEAR(y, mask) ( y &= ~(mask) )
|
||||||
#define BF_BIT_FLIP(y, mask) ( y ^= (mask) )
|
#define BFBIT_FLIP(y, mask) ( y ^= (mask) )
|
||||||
#define BF_SINGLE_BIT_GET(y, i) BF_BIT_GET(y, BF_BIT(i))
|
#define BF_SINGLE_BIT_GET(y, i) BFBIT_GET(y, bfBit(i))
|
||||||
#define BF_SINGLE_BIT_SET(y, i) BF_BIT_SET(y, BF_BIT(i))
|
#define BF_SINGLE_BIT_SET(y, i) BFBIT_SET(y, bfBit(i))
|
||||||
|
|
||||||
//! Create a bitmask of length 'len'.
|
//! Create a bitmask of length 'len'.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T BF_BITMASK(uint8_t len)
|
inline T bfBitmask(uint8_t len)
|
||||||
{
|
{
|
||||||
return BF_BIT<T>(len) - 1;
|
return bfBit<T>(len) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Create a bitfield mask of length 'len' starting at bit 'start'.
|
//! Create a bitfield mask of length 'len' starting at bit 'start'.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T BF_MASK(uint8_t start, uint8_t len)
|
inline T bfMask(uint8_t start, uint8_t len)
|
||||||
{
|
{
|
||||||
return BF_BITMASK<T>(len) << start;
|
return bfBitmask<T>(len) << start;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Prepare a bitmask for insertion or combining.
|
//! Prepare a bitmask for insertion or combining.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T BF_PREP(T x, uint8_t start, uint8_t len)
|
inline T bfPrep(T x, uint8_t start, uint8_t len)
|
||||||
{
|
{
|
||||||
return (x & BF_BITMASK<T>(len)) << start;
|
return (x & bfBitmask<T>(len)) << start;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Extract a bitfield of length 'len' starting at bit 'start' from 'y'.
|
//! Extract a bitfield of length 'len' starting at bit 'start' from 'y'.
|
||||||
#define BF_GET(y, start, len) ( ((y)>>(start)) & BF_BITMASK(len) )
|
template <typename T>
|
||||||
|
inline T bfGet(T y, uint8_t start, uint8_t len)
|
||||||
|
{
|
||||||
|
return ((y)>>(start)) & bfBitmask<T>(len);
|
||||||
|
}
|
||||||
|
|
||||||
//! Insert 'len' bits of 'x 'into 'y', starting at bit 'start' from 'y'.
|
//! Insert 'len' bits of 'x 'into 'y', starting at bit 'start' from 'y'.
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T BF_SET(T to, T from, uint8_t start, uint8_t len)
|
inline T bfSet(T to, T from, uint8_t start, uint8_t len)
|
||||||
{
|
{
|
||||||
return (to & ~BF_MASK<T>(start, len)) | BF_PREP<T>(from, start, len);
|
return (to & ~bfMask<T>(start, len)) | bfPrep<T>(from, start, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //BITFIELD_H
|
#endif //BITFIELD_H
|
||||||
|
|
31
radio/src/chksize.h
Normal file
31
radio/src/chksize.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) OpenTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHKSIZE_H
|
||||||
|
#define CHKSIZE_H
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
template <typename ToCheck, size_t expectedSize, size_t realSize = sizeof(ToCheck)>
|
||||||
|
void check_size() {
|
||||||
|
static_assert(expectedSize == realSize, "struct size changed");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -383,6 +383,7 @@ enum SwitchSources {
|
||||||
SWSRC_SD0,
|
SWSRC_SD0,
|
||||||
SWSRC_SD1,
|
SWSRC_SD1,
|
||||||
SWSRC_SD2,
|
SWSRC_SD2,
|
||||||
|
#endif
|
||||||
#if defined(PCBHORUS) || defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBXLITES)
|
#if defined(PCBHORUS) || defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBXLITES)
|
||||||
SWSRC_SE0,
|
SWSRC_SE0,
|
||||||
SWSRC_SE1,
|
SWSRC_SE1,
|
||||||
|
@ -443,8 +444,17 @@ enum SwitchSources {
|
||||||
SWSRC_SR1,
|
SWSRC_SR1,
|
||||||
SWSRC_SR2,
|
SWSRC_SR2,
|
||||||
#endif
|
#endif
|
||||||
SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + NUM_SWITCHES_POSITIONS - 1,
|
|
||||||
#else // neither Taranis nor Horus
|
#if defined(PCBHORUS)
|
||||||
|
SWSRC_GMBL0,
|
||||||
|
SWSRC_GMBL1,
|
||||||
|
SWSRC_GMBL2,
|
||||||
|
SWSRC_GMBR0,
|
||||||
|
SWSRC_GMBR1,
|
||||||
|
SWSRC_GMBR2,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBSKY9X)
|
||||||
SWSRC_ID0 = SWSRC_FIRST_SWITCH,
|
SWSRC_ID0 = SWSRC_FIRST_SWITCH,
|
||||||
SWSRC_ID1,
|
SWSRC_ID1,
|
||||||
SWSRC_ID2,
|
SWSRC_ID2,
|
||||||
|
@ -456,11 +466,13 @@ enum SwitchSources {
|
||||||
SWSRC_TRN,
|
SWSRC_TRN,
|
||||||
SWSRC_TRAINER = SWSRC_TRN,
|
SWSRC_TRAINER = SWSRC_TRN,
|
||||||
SWSRC_LAST_SWITCH = SWSRC_TRN,
|
SWSRC_LAST_SWITCH = SWSRC_TRN,
|
||||||
|
#else
|
||||||
|
SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + NUM_SWITCHES_POSITIONS - 1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NUM_XPOTS > 0
|
#if NUM_XPOTS > 0
|
||||||
SWSRC_FIRST_MULTIPOS_SWITCH,
|
SWSRC_FIRST_MULTIPOS_SWITCH,
|
||||||
SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS*XPOTS_MULTIPOS_COUNT) - 1,
|
SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_POTS * XPOTS_MULTIPOS_COUNT) - 1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SWSRC_FIRST_TRIM,
|
SWSRC_FIRST_TRIM,
|
||||||
|
@ -468,12 +480,14 @@ enum SwitchSources {
|
||||||
SWSRC_TrimRudRight,
|
SWSRC_TrimRudRight,
|
||||||
SWSRC_TrimEleDown,
|
SWSRC_TrimEleDown,
|
||||||
SWSRC_TrimEleUp,
|
SWSRC_TrimEleUp,
|
||||||
|
|
||||||
#if NUM_TRIMS > 2
|
#if NUM_TRIMS > 2
|
||||||
SWSRC_TrimThrDown,
|
SWSRC_TrimThrDown,
|
||||||
SWSRC_TrimThrUp,
|
SWSRC_TrimThrUp,
|
||||||
SWSRC_TrimAilLeft,
|
SWSRC_TrimAilLeft,
|
||||||
SWSRC_TrimAilRight,
|
SWSRC_TrimAilRight,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NUM_TRIMS > 4
|
#if NUM_TRIMS > 4
|
||||||
SWSRC_TrimT5Down,
|
SWSRC_TrimT5Down,
|
||||||
SWSRC_TrimT5Up,
|
SWSRC_TrimT5Up,
|
||||||
|
@ -488,16 +502,7 @@ enum SwitchSources {
|
||||||
SWSRC_FIRST_LOGICAL_SWITCH,
|
SWSRC_FIRST_LOGICAL_SWITCH,
|
||||||
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
||||||
SWSRC_SW2,
|
SWSRC_SW2,
|
||||||
SWSRC_SW3,
|
// ...
|
||||||
SWSRC_SW4,
|
|
||||||
SWSRC_SW5,
|
|
||||||
SWSRC_SW6,
|
|
||||||
SWSRC_SW7,
|
|
||||||
SWSRC_SW8,
|
|
||||||
SWSRC_SW9,
|
|
||||||
SWSRC_SWA,
|
|
||||||
SWSRC_SWB,
|
|
||||||
SWSRC_SWC,
|
|
||||||
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
|
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
|
||||||
|
|
||||||
SWSRC_ON,
|
SWSRC_ON,
|
||||||
|
@ -559,9 +564,16 @@ enum MixSources {
|
||||||
MIXSRC_FIRST_SLIDER,
|
MIXSRC_FIRST_SLIDER,
|
||||||
MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
|
MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
|
||||||
MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
|
MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
|
||||||
|
#if defined(PCBX12S)
|
||||||
MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
|
MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
|
||||||
MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
|
MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
|
||||||
MIXSRC_LAST_POT = MIXSRC_RS,
|
MIXSRC_LAST_POT = MIXSRC_RS,
|
||||||
|
#endif
|
||||||
|
#if defined(PCBX10)
|
||||||
|
MIXSRC_EXT1, LUA_EXPORT("ext1", "Ext 1")
|
||||||
|
MIXSRC_EXT2, LUA_EXPORT("ext2", "Ext 2")
|
||||||
|
MIXSRC_LAST_POT = MIXSRC_EXT2,
|
||||||
|
#endif
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
||||||
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
||||||
|
@ -632,6 +644,7 @@ enum MixSources {
|
||||||
MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
|
MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
|
||||||
MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
|
MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
|
||||||
MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
|
MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
|
||||||
|
#endif
|
||||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBXLITES)
|
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBXLITES)
|
||||||
MIXSRC_SE, LUA_EXPORT("se", "Switch E")
|
MIXSRC_SE, LUA_EXPORT("se", "Switch E")
|
||||||
#endif
|
#endif
|
||||||
|
@ -660,7 +673,11 @@ enum MixSources {
|
||||||
MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
|
MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
|
||||||
MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
|
MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
|
||||||
#endif
|
#endif
|
||||||
#else
|
#if defined(PCBHORUS)
|
||||||
|
MIXSRC_GMBL, LUA_EXPORT("gmbl", "Switch Left gimbal")
|
||||||
|
MIXSRC_GMBR, LUA_EXPORT("gmbr", "Switch right gimbal")
|
||||||
|
#endif
|
||||||
|
#if defined(PCBSKY9X)
|
||||||
MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
|
MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
|
||||||
MIXSRC_THR,
|
MIXSRC_THR,
|
||||||
MIXSRC_RUD,
|
MIXSRC_RUD,
|
||||||
|
|
|
@ -606,7 +606,7 @@ PACK(struct ModelData {
|
||||||
|
|
||||||
NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]);
|
NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]);
|
||||||
NOBACKUP(uint8_t potsWarnEnabled);
|
NOBACKUP(uint8_t potsWarnEnabled);
|
||||||
NOBACKUP(int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS+NUM_DUMMY_ANAS]);
|
NOBACKUP(int8_t potsWarnPosition[STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS]);
|
||||||
|
|
||||||
NOBACKUP(TelemetrySensor telemetrySensors[MAX_TELEMETRY_SENSORS];)
|
NOBACKUP(TelemetrySensor telemetrySensors[MAX_TELEMETRY_SENSORS];)
|
||||||
|
|
||||||
|
@ -661,12 +661,12 @@ PACK(struct TrainerData {
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
#define EXTRA_GENERAL_FIELDS \
|
#define EXTRA_GENERAL_FIELDS \
|
||||||
NOBACKUP(uint8_t serial2Mode:4); \
|
NOBACKUP(uint8_t serial2Mode); \
|
||||||
uint8_t slidersConfig:4; \
|
|
||||||
uint32_t switchConfig; \
|
uint32_t switchConfig; \
|
||||||
uint8_t potsConfig; /* two bits per pot */ \
|
uint16_t potsConfig; /* two bits per pot */ \
|
||||||
NOBACKUP(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]); \
|
uint8_t slidersConfig; /* 1 bit per slider */ \
|
||||||
NOBACKUP(char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_DUMMY_ANAS][LEN_ANA_NAME]); \
|
NOBACKUP(char switchNames[STORAGE_NUM_SWITCHES][LEN_SWITCH_NAME]); \
|
||||||
|
NOBACKUP(char anaNames[NUM_STICKS + STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS][LEN_ANA_NAME]); \
|
||||||
NOBACKUP(char currModelFilename[LEN_MODEL_FILENAME+1]); \
|
NOBACKUP(char currModelFilename[LEN_MODEL_FILENAME+1]); \
|
||||||
NOBACKUP(uint8_t spare:1); \
|
NOBACKUP(uint8_t spare:1); \
|
||||||
NOBACKUP(uint8_t blOffBright:7); \
|
NOBACKUP(uint8_t blOffBright:7); \
|
||||||
|
@ -724,7 +724,7 @@ PACK(struct TrainerData {
|
||||||
PACK(struct RadioData {
|
PACK(struct RadioData {
|
||||||
NOBACKUP(uint8_t version);
|
NOBACKUP(uint8_t version);
|
||||||
NOBACKUP(uint16_t variant);
|
NOBACKUP(uint16_t variant);
|
||||||
CalibData calib[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_MOUSE_ANALOGS+NUM_DUMMY_ANAS];
|
CalibData calib[NUM_STICKS + STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS + STORAGE_NUM_MOUSE_ANALOGS];
|
||||||
NOBACKUP(uint16_t chkSum);
|
NOBACKUP(uint16_t chkSum);
|
||||||
N_HORUS_FIELD(int8_t currModel);
|
N_HORUS_FIELD(int8_t currModel);
|
||||||
N_HORUS_FIELD(uint8_t contrast);
|
N_HORUS_FIELD(uint8_t contrast);
|
||||||
|
@ -811,15 +811,13 @@ PACK(struct RadioData {
|
||||||
other than the CPU arch and board type so changes in other
|
other than the CPU arch and board type so changes in other
|
||||||
defines also trigger the struct size changes */
|
defines also trigger the struct size changes */
|
||||||
|
|
||||||
template <typename ToCheck, size_t expectedSize, size_t realSize = sizeof(ToCheck)>
|
#include "chksize.h"
|
||||||
void check_size() {
|
|
||||||
static_assert(expectedSize == realSize, "struct size changed");
|
#define CHKSIZE(x, y) check_size<struct x, y>()
|
||||||
}
|
#define CHKTYPE(x, y) check_size<x, y>()
|
||||||
|
|
||||||
static inline void check_struct()
|
static inline void check_struct()
|
||||||
{
|
{
|
||||||
#define CHKSIZE(x, y) check_size<struct x, y>()
|
|
||||||
#define CHKTYPE(x, y) check_size<x, y>()
|
|
||||||
|
|
||||||
CHKSIZE(CurveRef, 2);
|
CHKSIZE(CurveRef, 2);
|
||||||
|
|
||||||
|
@ -926,11 +924,10 @@ static inline void check_struct()
|
||||||
CHKSIZE(RadioData, 735);
|
CHKSIZE(RadioData, 735);
|
||||||
CHKSIZE(ModelData, 5301);
|
CHKSIZE(ModelData, 5301);
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
CHKSIZE(RadioData, 855);
|
CHKSIZE(RadioData, 881);
|
||||||
CHKSIZE(ModelData, 9734);
|
CHKSIZE(ModelData, 9736);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef CHKSIZE
|
#undef CHKSIZE
|
||||||
#undef CHKSIZEUNION
|
|
||||||
}
|
}
|
||||||
#endif /* BACKUP */
|
#endif /* BACKUP */
|
||||||
|
|
|
@ -31,6 +31,10 @@ enum MenuRadioHardwareItems {
|
||||||
ITEM_RADIO_HARDWARE_POT1,
|
ITEM_RADIO_HARDWARE_POT1,
|
||||||
ITEM_RADIO_HARDWARE_POT2,
|
ITEM_RADIO_HARDWARE_POT2,
|
||||||
ITEM_RADIO_HARDWARE_POT3,
|
ITEM_RADIO_HARDWARE_POT3,
|
||||||
|
#if defined(PCBX10)
|
||||||
|
ITEM_RADIO_HARDWARE_EXT1,
|
||||||
|
ITEM_RADIO_HARDWARE_EXT2,
|
||||||
|
#endif
|
||||||
ITEM_RADIO_HARDWARE_LS,
|
ITEM_RADIO_HARDWARE_LS,
|
||||||
ITEM_RADIO_HARDWARE_RS,
|
ITEM_RADIO_HARDWARE_RS,
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
|
@ -46,6 +50,8 @@ enum MenuRadioHardwareItems {
|
||||||
ITEM_RADIO_HARDWARE_SF,
|
ITEM_RADIO_HARDWARE_SF,
|
||||||
ITEM_RADIO_HARDWARE_SG,
|
ITEM_RADIO_HARDWARE_SG,
|
||||||
ITEM_RADIO_HARDWARE_SH,
|
ITEM_RADIO_HARDWARE_SH,
|
||||||
|
ITEM_RADIO_HARDWARE_GMBL,
|
||||||
|
ITEM_RADIO_HARDWARE_GMBR,
|
||||||
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
|
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
|
||||||
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
|
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
|
||||||
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
|
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
|
||||||
|
@ -59,14 +65,15 @@ enum MenuRadioHardwareItems {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HW_SETTINGS_COLUMN 150
|
#define HW_SETTINGS_COLUMN 150
|
||||||
#if defined(PCBX10)
|
|
||||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
|
||||||
#else
|
|
||||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#endif
|
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
|
||||||
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode != BLUETOOTH_TELEMETRY ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? -1 : 0)
|
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode != BLUETOOTH_TELEMETRY ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? -1 : 0)
|
||||||
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
|
||||||
|
// TODO should be moved to the HAL
|
||||||
|
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw || MIXSRC_GMBL-MIXSRC_FIRST_SWITCH == sw || MIXSRC_GMBR-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
||||||
|
|
||||||
bool menuRadioHardware(event_t event)
|
bool menuRadioHardware(event_t event)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +96,7 @@ bool menuRadioHardware(event_t event)
|
||||||
pushMenu(menuRadioCalibration);
|
pushMenu(menuRadioCalibration);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_RADIO_HARDWARE_LABEL_STICKS:
|
case ITEM_RADIO_HARDWARE_LABEL_STICKS:
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_STICKS);
|
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_STICKS);
|
||||||
break;
|
break;
|
||||||
|
@ -128,24 +136,27 @@ bool menuRadioHardware(event_t event)
|
||||||
case ITEM_RADIO_HARDWARE_POT1:
|
case ITEM_RADIO_HARDWARE_POT1:
|
||||||
case ITEM_RADIO_HARDWARE_POT2:
|
case ITEM_RADIO_HARDWARE_POT2:
|
||||||
case ITEM_RADIO_HARDWARE_POT3:
|
case ITEM_RADIO_HARDWARE_POT3:
|
||||||
|
#if defined(PCBX10)
|
||||||
|
case ITEM_RADIO_HARDWARE_EXT1:
|
||||||
|
case ITEM_RADIO_HARDWARE_EXT2:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int idx = k - ITEM_RADIO_HARDWARE_POT1;
|
int index = k - ITEM_RADIO_HARDWARE_POT1;
|
||||||
uint8_t shift = (2*idx);
|
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
uint8_t mask = (0x03 << shift);
|
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+index]) || (attr && menuHorizontalPosition == 0))
|
||||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
|
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+index], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
||||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
|
|
||||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
|
||||||
else
|
else
|
||||||
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
|
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
|
||||||
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
|
uint32_t potType = bfGet<uint32_t>(g_eeGeneral.potsConfig, 2*(index), 2);
|
||||||
potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
potType = editChoice(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
||||||
g_eeGeneral.potsConfig &= ~mask;
|
g_eeGeneral.potsConfig = bfSet<uint32_t>(g_eeGeneral.potsConfig, potType, 2*index, 2);
|
||||||
g_eeGeneral.potsConfig |= (potType << shift);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ITEM_RADIO_HARDWARE_LABEL_SWITCHES:
|
case ITEM_RADIO_HARDWARE_LABEL_SWITCHES:
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCHES);
|
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCHES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_RADIO_HARDWARE_SA:
|
case ITEM_RADIO_HARDWARE_SA:
|
||||||
case ITEM_RADIO_HARDWARE_SB:
|
case ITEM_RADIO_HARDWARE_SB:
|
||||||
case ITEM_RADIO_HARDWARE_SC:
|
case ITEM_RADIO_HARDWARE_SC:
|
||||||
|
@ -154,8 +165,10 @@ bool menuRadioHardware(event_t event)
|
||||||
case ITEM_RADIO_HARDWARE_SF:
|
case ITEM_RADIO_HARDWARE_SF:
|
||||||
case ITEM_RADIO_HARDWARE_SG:
|
case ITEM_RADIO_HARDWARE_SG:
|
||||||
case ITEM_RADIO_HARDWARE_SH:
|
case ITEM_RADIO_HARDWARE_SH:
|
||||||
|
case ITEM_RADIO_HARDWARE_GMBL:
|
||||||
|
case ITEM_RADIO_HARDWARE_GMBR:
|
||||||
{
|
{
|
||||||
int index = k-ITEM_RADIO_HARDWARE_SA;
|
int index = k - ITEM_RADIO_HARDWARE_SA;
|
||||||
int config = SWITCH_CONFIG(index);
|
int config = SWITCH_CONFIG(index);
|
||||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
|
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
|
||||||
|
@ -164,8 +177,7 @@ bool menuRadioHardware(event_t event)
|
||||||
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
|
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
|
||||||
config = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
|
config = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
swconfig_t mask = (swconfig_t)0x03 << (2*index);
|
g_eeGeneral.switchConfig = bfSet<uint32_t>(g_eeGeneral.switchConfig, config, 2*index, 2);
|
||||||
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,8 +172,10 @@ bool menuStatsAnalogs(event_t event)
|
||||||
#else
|
#else
|
||||||
if (i < NUM_STICKS+NUM_POTS+NUM_SLIDERS)
|
if (i < NUM_STICKS+NUM_POTS+NUM_SLIDERS)
|
||||||
lcdDrawNumber(x+100, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256);
|
lcdDrawNumber(x+100, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256);
|
||||||
|
#if NUM_MOUSE_ANALOGS > 0
|
||||||
else if (i >= MOUSE1)
|
else if (i >= MOUSE1)
|
||||||
lcdDrawNumber(x+100, y, (int16_t)calibratedAnalogs[CALIBRATED_MOUSE1+i-MOUSE1]*25/256);
|
lcdDrawNumber(x+100, y, (int16_t)calibratedAnalogs[CALIBRATED_MOUSE1+i-MOUSE1]*25/256);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define _MYEEPROM_H_
|
#define _MYEEPROM_H_
|
||||||
|
|
||||||
#include "datastructs.h"
|
#include "datastructs.h"
|
||||||
|
#include "bitfield.h"
|
||||||
|
|
||||||
#define EEPROM_VER 219
|
#define EEPROM_VER 219
|
||||||
#define FIRST_CONV_EEPROM_VER 216
|
#define FIRST_CONV_EEPROM_VER 216
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
SLIDER_NONE,
|
SLIDER_NONE,
|
||||||
SLIDER_WITH_DETENT,
|
SLIDER_WITH_DETENT,
|
||||||
};
|
};
|
||||||
#define SWITCH_CONFIG(x) ((g_eeGeneral.switchConfig >> (2*(x))) & 0x03)
|
#define SWITCH_CONFIG(x) (bfGet<uint32_t>(g_eeGeneral.switchConfig, 2*(x), 2))
|
||||||
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
|
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
|
||||||
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
|
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
|
||||||
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
|
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
|
||||||
|
@ -113,8 +114,6 @@
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "topbar.h"
|
#include "topbar.h"
|
||||||
#else
|
|
||||||
#define THEME_DATA
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SWITCHES_DELAY() uint8_t(15+g_eeGeneral.switchesDelay)
|
#define SWITCHES_DELAY() uint8_t(15+g_eeGeneral.switchesDelay)
|
||||||
|
|
|
@ -11,7 +11,7 @@ if(PCB STREQUAL X7 OR PCB STREQUAL XLITE OR PCB STREQUAL X9E)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PCB STREQUAL X12S OR PCB STREQUAL X10)
|
if(PCB STREQUAL X12S OR PCB STREQUAL X10)
|
||||||
# TODO set(EEPROM_CONVERSIONS 218)
|
set(EEPROM_CONVERSIONS 218)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EEPROM_CONVERSIONS)
|
if(EEPROM_CONVERSIONS)
|
||||||
|
|
|
@ -21,10 +21,8 @@
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "conversions.h"
|
#include "conversions.h"
|
||||||
|
|
||||||
void convertModelData(int id, int version)
|
void convertModelData(int version)
|
||||||
{
|
{
|
||||||
eeLoadModelData(id);
|
|
||||||
|
|
||||||
#if EEPROM_CONVERSIONS < 217
|
#if EEPROM_CONVERSIONS < 217
|
||||||
if (version == 216) {
|
if (version == 216) {
|
||||||
version = 217;
|
version = 217;
|
||||||
|
@ -45,7 +43,13 @@ void convertModelData(int id, int version)
|
||||||
convertModelData_218_to_219(g_model);
|
convertModelData_218_to_219(g_model);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(EEPROM)
|
||||||
|
void eeConvertModel(int id, int version)
|
||||||
|
{
|
||||||
|
eeLoadModelData(id);
|
||||||
|
convertModelData(version);
|
||||||
uint8_t currModel = g_eeGeneral.currModel;
|
uint8_t currModel = g_eeGeneral.currModel;
|
||||||
g_eeGeneral.currModel = id;
|
g_eeGeneral.currModel = id;
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
|
@ -106,8 +110,7 @@ bool eeConvert()
|
||||||
#if EEPROM_CONVERSIONS < 219
|
#if EEPROM_CONVERSIONS < 219
|
||||||
if (version == 218) {
|
if (version == 218) {
|
||||||
version = 219;
|
version = 219;
|
||||||
g_eeGeneral.version = 219;
|
convertRadioData_218_to_219(g_eeGeneral);
|
||||||
// no conversion needed for now
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -131,9 +134,10 @@ bool eeConvert()
|
||||||
#endif
|
#endif
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
if (eeModelExists(id)) {
|
if (eeModelExists(id)) {
|
||||||
convertModelData(id, conversionVersionStart);
|
eeConvertModel(id, conversionVersionStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void convertModelData(int version);
|
||||||
|
|
||||||
bool eeConvert();
|
bool eeConvert();
|
||||||
void convertModelData(int id, int version);
|
void eeConvertModel(int id, int version);
|
||||||
|
|
||||||
// Conversions 216 to 217
|
// Conversions 216 to 217
|
||||||
void convertModelData_216_to_217(ModelData &model);
|
void convertModelData_216_to_217(ModelData &model);
|
||||||
|
|
|
@ -614,7 +614,7 @@ PACK(typedef struct {
|
||||||
}) GVarData_v217;
|
}) GVarData_v217;
|
||||||
|
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
ModelHeader header;
|
ModelHeader_v218 header;
|
||||||
TimerData_v217 timers[MAX_TIMERS_218];
|
TimerData_v217 timers[MAX_TIMERS_218];
|
||||||
uint8_t telemetryProtocol:3;
|
uint8_t telemetryProtocol:3;
|
||||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||||
|
|
|
@ -41,6 +41,11 @@ int convertSource_218_to_219(int source)
|
||||||
source += 2;
|
source += 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
if (source >= MIXSRC_GMBL)
|
||||||
|
source += 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,12 +53,21 @@ int convertSwitch_218_to_219(int swtch)
|
||||||
{
|
{
|
||||||
// on X7: 2 additional switches
|
// on X7: 2 additional switches
|
||||||
|
|
||||||
#if defined(PCBX7)
|
#if defined(PCBX7) || defined(PCBHORUS)
|
||||||
if (swtch < 0)
|
if (swtch < 0)
|
||||||
return -convertSwitch_218_to_219(-swtch);
|
return -convertSwitch_218_to_219(-swtch);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBX7)
|
||||||
if (swtch >= SWSRC_SI0)
|
if (swtch >= SWSRC_SI0)
|
||||||
return swtch + 2 * 3;
|
swtch += 2 * 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
if (swtch >= SWSRC_GMBL0)
|
||||||
|
swtch += 2 * 3;
|
||||||
|
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH + 3 * XPOTS_MULTIPOS_COUNT)
|
||||||
|
swtch += 2 * XPOTS_MULTIPOS_COUNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return swtch;
|
return swtch;
|
||||||
|
@ -63,8 +77,14 @@ void convertModelData_218_to_219(ModelData &model)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(ModelData_v218) <= sizeof(ModelData), "ModelData size has been reduced");
|
static_assert(sizeof(ModelData_v218) <= sizeof(ModelData), "ModelData size has been reduced");
|
||||||
|
|
||||||
|
#if defined(STM32)
|
||||||
|
ModelData_v218 * oldModelAllocated = (ModelData_v218 *)malloc(sizeof(ModelData_v218));
|
||||||
|
ModelData_v218 &oldModel = *oldModelAllocated;
|
||||||
|
#else
|
||||||
ModelData_v218 oldModel;
|
ModelData_v218 oldModel;
|
||||||
memcpy(&oldModel, &model, sizeof(oldModel));
|
#endif
|
||||||
|
|
||||||
|
memcpy(&oldModel, &model, sizeof(ModelData_v218));
|
||||||
ModelData_v219 & newModel = (ModelData_v219 &) model;
|
ModelData_v219 & newModel = (ModelData_v219 &) model;
|
||||||
|
|
||||||
memclear(newModel.mixData, sizeof(ModelData_v219) - offsetof(ModelData_v219, mixData));
|
memclear(newModel.mixData, sizeof(ModelData_v219) - offsetof(ModelData_v219, mixData));
|
||||||
|
@ -215,13 +235,14 @@ void convertModelData_218_to_219(ModelData &model)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
memcpy(newModel.screenData, oldModel.screenData,
|
// memcpy(newModel.screenData, oldModel.screenData,
|
||||||
sizeof(newModel.screenData) +
|
// sizeof(newModel.screenData) +
|
||||||
sizeof(newModel.topbarData))
|
// sizeof(newModel.topbarData))
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
newModel.screensType = oldModel.frsky.screensType;
|
newModel.screensType = oldModel.frsky.screensType;
|
||||||
memmove(&newModel.screens, &oldModel.frsky.screens, sizeof(newModel.screens));
|
memmove(&newModel.screens, &oldModel.frsky.screens, sizeof(newModel.screens));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX7)
|
#if defined(PCBX7)
|
||||||
for (int i=0; i<MAX_TELEMETRY_SCREENS; i++) {
|
for (int i=0; i<MAX_TELEMETRY_SCREENS; i++) {
|
||||||
uint8_t screenType = (newModel.screensType >> (2*i)) & 0x03;
|
uint8_t screenType = (newModel.screensType >> (2*i)) & 0x03;
|
||||||
|
@ -239,4 +260,35 @@ void convertModelData_218_to_219(ModelData &model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
free(oldModelAllocated);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void convertRadioData_218_to_219(RadioData & settings)
|
||||||
|
{
|
||||||
|
settings.version = 219;
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
RadioData_v218 settings_v218 = (RadioData_v218 &)settings;
|
||||||
|
|
||||||
|
memcpy(&settings.chkSum, &settings_v218.chkSum, offsetof(RadioData, serial2Mode) - offsetof(RadioData, chkSum));
|
||||||
|
memcpy(&settings.calib[NUM_STICKS + 5], &settings_v218.calib[NUM_STICKS + 3], sizeof(CalibData) * (STORAGE_NUM_SLIDERS + STORAGE_NUM_MOUSE_ANALOGS));
|
||||||
|
memclear(&settings.calib[NUM_STICKS + 3], sizeof(CalibData) * 2);
|
||||||
|
|
||||||
|
settings.serial2Mode = settings_v218.serial2Mode;
|
||||||
|
settings.switchConfig = settings_v218.switchConfig;
|
||||||
|
settings.potsConfig = settings_v218.potsConfig;
|
||||||
|
settings.slidersConfig = settings_v218.slidersConfig;
|
||||||
|
|
||||||
|
memcpy(&settings.switchNames[0], &settings_v218.switchNames[0], 8 * LEN_SWITCH_NAME);
|
||||||
|
memclear(&settings.switchNames[8], 2 * LEN_SWITCH_NAME);
|
||||||
|
|
||||||
|
memcpy(&settings.anaNames[0], &settings_v218.anaNames[0], (NUM_STICKS + 3) * LEN_ANA_NAME);
|
||||||
|
memclear(&settings.anaNames[NUM_STICKS + 3], 2 * LEN_SWITCH_NAME);
|
||||||
|
memcpy(&settings.anaNames[NUM_STICKS + 5], &settings_v218.anaNames[NUM_STICKS + 3], STORAGE_NUM_SLIDERS * LEN_ANA_NAME);
|
||||||
|
|
||||||
|
memcpy(&settings.currModelFilename[0], &settings_v218.currModelFilename[0], sizeof(RadioData_v218) - offsetof(RadioData_v218, currModelFilename[0]));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef OPENTX_DATASTRUCTS_218_H
|
#ifndef OPENTX_DATASTRUCTS_218_H
|
||||||
#define OPENTX_DATASTRUCTS_218_H
|
#define OPENTX_DATASTRUCTS_218_H
|
||||||
|
|
||||||
|
@ -192,7 +191,7 @@ PACK(typedef struct {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
trim_t trim[NUM_STICKS];
|
trim_t trim[NUM_TRIMS];
|
||||||
char name[LEN_FLIGHT_MODE_NAME_218];
|
char name[LEN_FLIGHT_MODE_NAME_218];
|
||||||
int16_t swtch:9; // swtch of phase[0] is not used
|
int16_t swtch:9; // swtch of phase[0] is not used
|
||||||
int16_t spare:7;
|
int16_t spare:7;
|
||||||
|
@ -289,7 +288,7 @@ PACK(typedef struct {
|
||||||
uint8_t active;
|
uint8_t active;
|
||||||
}) CustomFunctionData_v218;
|
}) CustomFunctionData_v218;
|
||||||
|
|
||||||
PACK(typedef struct {
|
PACK(struct GVarData_v218 {
|
||||||
char name[LEN_GVAR_NAME_218];
|
char name[LEN_GVAR_NAME_218];
|
||||||
uint32_t min:12;
|
uint32_t min:12;
|
||||||
uint32_t max:12;
|
uint32_t max:12;
|
||||||
|
@ -297,7 +296,7 @@ PACK(typedef struct {
|
||||||
uint32_t prec:1;
|
uint32_t prec:1;
|
||||||
uint32_t unit:2;
|
uint32_t unit:2;
|
||||||
uint32_t spare:4;
|
uint32_t spare:4;
|
||||||
}) GVarData_v218;
|
});
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
PACK(struct FrSkyTelemetryData_v217 {
|
PACK(struct FrSkyTelemetryData_v217 {
|
||||||
|
@ -330,16 +329,12 @@ PACK(struct FrSkyTelemetryData_v217 {
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBHORUS)
|
||||||
#define MODELDATA_EXTRA_218 uint8_t spare:3;uint8_t trainerMode:3;uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1];ScriptData scriptsData[MAX_SCRIPTS_218];char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218];;uint8_t potsWarnEnabled;;int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];;
|
#define MODELDATA_EXTRA_218 uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS_218]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[3 + 4];
|
||||||
#elif defined(PCBX10)
|
|
||||||
#define MODELDATA_EXTRA_218 uint8_t spare:3;;uint8_t trainerMode:3;;uint8_t potsWarnMode:2;; ModuleData_v218 moduleData[NUM_MODULES+1];ScriptData scriptsData[MAX_SCRIPTS_218];;char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218];;uint8_t potsWarnEnabled;;int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];;uint8_t potsWarnSpares[NUM_DUMMY_ANAS];;
|
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
#define MODELDATA_EXTRA_218 uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS_218]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];
|
#define MODELDATA_EXTRA_218 uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS_218]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS];
|
||||||
#elif defined(PCBSKY9X)
|
#elif defined(PCBSKY9X)
|
||||||
#define MODELDATA_EXTRA_218 uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; uint8_t rxBattAlarms[2];
|
#define MODELDATA_EXTRA_218 uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS]; uint8_t rxBattAlarms[2];
|
||||||
#else
|
|
||||||
#define MODELDATA_EXTRA_218
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PACK(struct TelemetrySensor_218 {
|
PACK(struct TelemetrySensor_218 {
|
||||||
|
@ -391,14 +386,35 @@ PACK(struct TelemetrySensor_218 {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBHORUS)
|
||||||
|
PACK(struct CustomScreenData_v218 {
|
||||||
|
char layoutName[10];
|
||||||
|
Layout::PersistentData layoutData;
|
||||||
|
});
|
||||||
|
#define VIEW_DATA \
|
||||||
|
CustomScreenData screenData[MAX_CUSTOM_SCREENS]; \
|
||||||
|
Topbar::PersistentData topbarData; \
|
||||||
|
uint8_t view;
|
||||||
|
#elif defined(PCBTARANIS)
|
||||||
#define VIEW_DATA uint8_t view;
|
#define VIEW_DATA uint8_t view;
|
||||||
#else
|
#else
|
||||||
#define VIEW_DATA
|
#define VIEW_DATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PACK(typedef struct {
|
#if LEN_BITMAP_NAME > 0
|
||||||
ModelHeader header;
|
#define MODEL_HEADER_BITMAP_FIELD_218 char bitmap[10];
|
||||||
|
#else
|
||||||
|
#define MODEL_HEADER_BITMAP_FIELD_218
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PACK(struct ModelHeader_v218 {
|
||||||
|
char name[LEN_MODEL_NAME]; // must be first for eeLoadModelName
|
||||||
|
uint8_t modelId[NUM_MODULES];
|
||||||
|
MODEL_HEADER_BITMAP_FIELD_218
|
||||||
|
});
|
||||||
|
|
||||||
|
PACK(struct ModelData_v218 {
|
||||||
|
ModelHeader_v218 header;
|
||||||
TimerData_v218 timers[MAX_TIMERS_218];
|
TimerData_v218 timers[MAX_TIMERS_218];
|
||||||
uint8_t telemetryProtocol:3;
|
uint8_t telemetryProtocol:3;
|
||||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||||
|
@ -427,7 +443,10 @@ PACK(typedef struct {
|
||||||
uint8_t thrTraceSrc;
|
uint8_t thrTraceSrc;
|
||||||
|
|
||||||
swarnstate_t switchWarningState;
|
swarnstate_t switchWarningState;
|
||||||
|
|
||||||
|
#if !defined(COLORLCD)
|
||||||
swarnenable_t switchWarningEnable;
|
swarnenable_t switchWarningEnable;
|
||||||
|
#endif
|
||||||
|
|
||||||
GVarData_v218 gvars[MAX_GVARS_218];
|
GVarData_v218 gvars[MAX_GVARS_218];
|
||||||
|
|
||||||
|
@ -442,19 +461,22 @@ PACK(typedef struct {
|
||||||
|
|
||||||
// TODO conversion for custom screens?
|
// TODO conversion for custom screens?
|
||||||
VIEW_DATA
|
VIEW_DATA
|
||||||
}) ModelData_v218;
|
});
|
||||||
|
|
||||||
|
#include "chksize.h"
|
||||||
|
|
||||||
|
#define CHKSIZE(x, y) check_size<struct x, y>()
|
||||||
|
|
||||||
|
static inline void check_struct_218()
|
||||||
|
{
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
static_assert(sizeof(ModelData_v218) == 9380, "ModelData size changed");
|
CHKSIZE(ModelData_v218, 9380);
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
static_assert(sizeof(ModelData_v218) == 6520, "ModelData size changed");
|
CHKSIZE(ModelData_v218, 6520);
|
||||||
#elif defined(PCBX9D)
|
|
||||||
static_assert(sizeof(ModelData_v218) == 6507, "ModelData size changed");
|
|
||||||
#elif defined(PCBXLITE) || defined(PCBX7)
|
|
||||||
static_assert(sizeof(ModelData_v218) == 6025, "ModelData size changed");
|
|
||||||
#elif defined(PCBSKY9X)
|
|
||||||
static_assert(sizeof(ModelData_v218) == 5188, "ModelData size changed");
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef CHKSIZE
|
||||||
|
|
||||||
#define EXTRA_GENERAL_FIELDS_GENERAL_218 \
|
#define EXTRA_GENERAL_FIELDS_GENERAL_218 \
|
||||||
uint8_t backlightBright; \
|
uint8_t backlightBright; \
|
||||||
|
@ -485,7 +507,7 @@ static_assert(sizeof(ModelData_v218) == 5188, "ModelData size changed");
|
||||||
uint32_t switchConfig; \
|
uint32_t switchConfig; \
|
||||||
uint8_t potsConfig; /* two bits per pot */ \
|
uint8_t potsConfig; /* two bits per pot */ \
|
||||||
char switchNames[NUM_SWITCHES_218][LEN_SWITCH_NAME_218]; \
|
char switchNames[NUM_SWITCHES_218][LEN_SWITCH_NAME_218]; \
|
||||||
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_DUMMY_ANAS][LEN_ANA_NAME_218]; \
|
char anaNames[NUM_STICKS+3+4][LEN_ANA_NAME_218]; \
|
||||||
char currModelFilename[LEN_MODEL_FILENAME_218+1]; \
|
char currModelFilename[LEN_MODEL_FILENAME_218+1]; \
|
||||||
uint8_t spare:1; \
|
uint8_t spare:1; \
|
||||||
uint8_t blOffBright:7; \
|
uint8_t blOffBright:7; \
|
||||||
|
@ -534,10 +556,20 @@ static_assert(sizeof(ModelData_v218) == 5188, "ModelData size changed");
|
||||||
#define SPLASH_MODE_218 int8_t splashMode:3
|
#define SPLASH_MODE_218 int8_t splashMode:3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(COLORLCD)
|
||||||
|
#include "gui/480x272/theme.h"
|
||||||
|
#define THEME_NAME_LEN 8
|
||||||
|
#define THEME_DATA \
|
||||||
|
char themeName[THEME_NAME_LEN]; \
|
||||||
|
Theme::PersistentData themeData;
|
||||||
|
#else
|
||||||
|
#define THEME_DATA
|
||||||
|
#endif
|
||||||
|
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint16_t variant;
|
uint16_t variant;
|
||||||
CalibData calib[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_MOUSE_ANALOGS+NUM_DUMMY_ANAS];
|
CalibData calib[NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS+STORAGE_NUM_MOUSE_ANALOGS];
|
||||||
uint16_t chkSum;
|
uint16_t chkSum;
|
||||||
N_HORUS_FIELD(int8_t currModel);
|
N_HORUS_FIELD(int8_t currModel);
|
||||||
N_HORUS_FIELD(uint8_t contrast);
|
N_HORUS_FIELD(uint8_t contrast);
|
||||||
|
|
|
@ -585,7 +585,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
||||||
|
|
||||||
#if defined(EEPROM_CONVERSIONS)
|
#if defined(EEPROM_CONVERSIONS)
|
||||||
if (version < EEPROM_VER) {
|
if (version < EEPROM_VER) {
|
||||||
convertModelData(i_fileDst, version);
|
eeConvertModel(i_fileDst, version);
|
||||||
eeLoadModel(g_eeGeneral.currModel);
|
eeLoadModel(g_eeGeneral.currModel);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -599,7 +599,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
||||||
#if defined(EEPROM_CONVERSIONS)
|
#if defined(EEPROM_CONVERSIONS)
|
||||||
if (version < EEPROM_VER) {
|
if (version < EEPROM_VER) {
|
||||||
storageCheck(true);
|
storageCheck(true);
|
||||||
convertModelData(i_fileDst, version);
|
eeConvertModel(i_fileDst, version);
|
||||||
eeLoadModel(g_eeGeneral.currModel);
|
eeLoadModel(g_eeGeneral.currModel);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -164,14 +164,14 @@ bool ModelCell::fetchRfData()
|
||||||
getModelPath(buf, modelFilename);
|
getModelPath(buf, modelFilename);
|
||||||
|
|
||||||
FIL file;
|
FIL file;
|
||||||
uint16_t file_size;
|
uint16_t size;
|
||||||
|
uint8_t version;
|
||||||
|
|
||||||
const char* err = openFile(buf,&file,&file_size);
|
const char * err = openFile(buf, &file, &size, &version);
|
||||||
if (err) return false;
|
if (err || version != EEPROM_VER) return false;
|
||||||
|
|
||||||
FSIZE_t start_offset = f_tell(&file);
|
FSIZE_t start_offset = f_tell(&file);
|
||||||
|
|
||||||
|
|
||||||
UINT read;
|
UINT read;
|
||||||
if ((f_read(&file, buf, LEN_MODEL_NAME, &read) != FR_OK) || (read != LEN_MODEL_NAME))
|
if ((f_read(&file, buf, LEN_MODEL_NAME, &read) != FR_OK) || (read != LEN_MODEL_NAME))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "modelslist.h"
|
#include "modelslist.h"
|
||||||
|
#include "conversions/conversions.h"
|
||||||
|
|
||||||
void getModelPath(char * path, const char * filename)
|
void getModelPath(char * path, const char * filename)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +70,7 @@ const char * writeModel()
|
||||||
return writeFile(path, (uint8_t *)&g_model, sizeof(g_model));
|
return writeFile(path, (uint8_t *)&g_model, sizeof(g_model));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * openFile(const char * fullpath, FIL* file, uint16_t* size)
|
const char * openFile(const char * fullpath, FIL * file, uint16_t * size, uint8_t * version)
|
||||||
{
|
{
|
||||||
FRESULT result = f_open(file, fullpath, FA_OPEN_EXISTING | FA_READ);
|
FRESULT result = f_open(file, fullpath, FA_OPEN_EXISTING | FA_READ);
|
||||||
if (result != FR_OK) {
|
if (result != FR_OK) {
|
||||||
|
@ -90,14 +91,14 @@ const char * openFile(const char * fullpath, FIL* file, uint16_t* size)
|
||||||
return SDCARD_ERROR(result);
|
return SDCARD_ERROR(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t version = (uint8_t)buf[4];
|
*version = (uint8_t)buf[4];
|
||||||
if ((*(uint32_t*)&buf[0] != OTX_FOURCC && *(uint32_t*)&buf[0] != O9X_FOURCC) || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') {
|
if ((*(uint32_t*)&buf[0] != OTX_FOURCC && *(uint32_t*)&buf[0] != O9X_FOURCC) || *version < FIRST_CONV_EEPROM_VER || *version > EEPROM_VER || buf[5] != 'M') {
|
||||||
f_close(file);
|
f_close(file);
|
||||||
return STR_INCOMPATIBLE;
|
return STR_INCOMPATIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = *(uint16_t*)&buf[6];
|
*size = *(uint16_t*)&buf[6];
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
||||||
|
@ -105,11 +106,13 @@ const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
||||||
FIL file;
|
FIL file;
|
||||||
UINT read;
|
UINT read;
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
|
uint8_t version;
|
||||||
|
|
||||||
TRACE("loadFile(%s)", fullpath);
|
TRACE("loadFile(%s)", fullpath);
|
||||||
|
|
||||||
const char* err = openFile(fullpath, &file, &size);
|
const char * err = openFile(fullpath, &file, &size, &version);
|
||||||
if (err) return err;
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
size = min<uint16_t>(maxsize, size);
|
size = min<uint16_t>(maxsize, size);
|
||||||
FRESULT result = f_read(&file, data, size, &read);
|
FRESULT result = f_read(&file, data, size, &read);
|
||||||
|
@ -118,8 +121,12 @@ const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
||||||
return SDCARD_ERROR(result);
|
return SDCARD_ERROR(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version < EEPROM_VER) {
|
||||||
|
convertModelData(version);
|
||||||
|
}
|
||||||
|
|
||||||
f_close(&file);
|
f_close(&file);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size)
|
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#define DEFAULT_MODEL_FILENAME "model1.bin"
|
#define DEFAULT_MODEL_FILENAME "model1.bin"
|
||||||
|
|
||||||
// opens radio.bin or model file
|
// opens radio.bin or model file
|
||||||
const char * openFile(const char * fullpath, FIL* file, uint16_t* size);
|
const char * openFile(const char * fullpath, FIL * file, uint16_t * size, uint8_t * version);
|
||||||
|
|
||||||
void getModelPath(char * path, const char * filename);
|
void getModelPath(char * path, const char * filename);
|
||||||
|
|
||||||
|
|
|
@ -107,14 +107,6 @@ extern uint16_t sessionTimer;
|
||||||
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_DETECT_GPIO, TRAINER_DETECT_GPIO_PIN) == Bit_RESET)
|
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_DETECT_GPIO, TRAINER_DETECT_GPIO_PIN) == Bit_RESET)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX10)
|
|
||||||
#define NUM_SLIDERS 2
|
|
||||||
#define NUM_PWMSTICKS 4
|
|
||||||
#else
|
|
||||||
#define NUM_SLIDERS 4
|
|
||||||
#define NUM_PWMSTICKS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Board driver
|
// Board driver
|
||||||
void boardPreInit(void);
|
void boardPreInit(void);
|
||||||
void boardInit(void);
|
void boardInit(void);
|
||||||
|
@ -142,19 +134,6 @@ void delay_ms(uint32_t ms);
|
||||||
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() (!IS_HORUS_PROD())
|
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() (!IS_HORUS_PROD())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NUM_PWMSTICKS > 0
|
|
||||||
PACK(typedef struct {
|
|
||||||
uint8_t sticksPwmDisabled : 1;
|
|
||||||
uint8_t pxx2Enabled : 1;
|
|
||||||
}) HardwareOptions;
|
|
||||||
#else
|
|
||||||
PACK(typedef struct {
|
|
||||||
uint8_t pxx2Enabled : 1;
|
|
||||||
}) HardwareOptions;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern HardwareOptions hardwareOptions;
|
|
||||||
|
|
||||||
// SD driver
|
// SD driver
|
||||||
#define BLOCK_SIZE 512 /* Block Size in Bytes */
|
#define BLOCK_SIZE 512 /* Block Size in Bytes */
|
||||||
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
||||||
|
@ -300,8 +279,12 @@ enum EnumSwitches
|
||||||
SW_SF,
|
SW_SF,
|
||||||
SW_SG,
|
SW_SG,
|
||||||
SW_SH,
|
SW_SH,
|
||||||
|
SW_GMBL,
|
||||||
|
SW_GMBR,
|
||||||
NUM_SWITCHES
|
NUM_SWITCHES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define STORAGE_NUM_SWITCHES 10
|
||||||
#define IS_3POS(x) ((x) != SW_SF && (x) != SW_SH)
|
#define IS_3POS(x) ((x) != SW_SF && (x) != SW_SH)
|
||||||
|
|
||||||
enum EnumSwitchesPositions
|
enum EnumSwitchesPositions
|
||||||
|
@ -330,8 +313,20 @@ enum EnumSwitchesPositions
|
||||||
SW_SH0,
|
SW_SH0,
|
||||||
SW_SH1,
|
SW_SH1,
|
||||||
SW_SH2,
|
SW_SH2,
|
||||||
|
SW_SGMBL0,
|
||||||
|
SW_SGMBL1,
|
||||||
|
SW_SGMBL2,
|
||||||
|
SW_SGMBR0,
|
||||||
|
SW_SGMBR1,
|
||||||
|
SW_SGMBR2,
|
||||||
NUM_SWITCHES_POSITIONS
|
NUM_SWITCHES_POSITIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
static_assert(NUM_SWITCHES_POSITIONS == NUM_SWITCHES * 3, "Wrong switches positions count");
|
||||||
|
#endif
|
||||||
|
|
||||||
void keysInit(void);
|
void keysInit(void);
|
||||||
uint8_t keyState(uint8_t index);
|
uint8_t keyState(uint8_t index);
|
||||||
uint32_t switchState(uint8_t index);
|
uint32_t switchState(uint8_t index);
|
||||||
|
@ -384,8 +379,26 @@ void watchdogInit(unsigned int duration);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ADC driver
|
// ADC driver
|
||||||
|
|
||||||
|
#if defined(PCBX10)
|
||||||
|
#define NUM_POTS 5
|
||||||
|
#else
|
||||||
#define NUM_POTS 3
|
#define NUM_POTS 3
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NUM_XPOTS NUM_POTS
|
#define NUM_XPOTS NUM_POTS
|
||||||
|
#define STORAGE_NUM_POTS 5
|
||||||
|
|
||||||
|
#if defined(PCBX10)
|
||||||
|
#define NUM_SLIDERS 2
|
||||||
|
#define NUM_PWMSTICKS 4
|
||||||
|
#else
|
||||||
|
#define NUM_SLIDERS 4
|
||||||
|
#define NUM_PWMSTICKS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define STORAGE_NUM_SLIDERS 4
|
||||||
|
|
||||||
enum Analogs {
|
enum Analogs {
|
||||||
STICK1,
|
STICK1,
|
||||||
STICK2,
|
STICK2,
|
||||||
|
@ -395,7 +408,10 @@ enum Analogs {
|
||||||
POT1 = POT_FIRST,
|
POT1 = POT_FIRST,
|
||||||
POT2,
|
POT2,
|
||||||
POT3,
|
POT3,
|
||||||
POT_LAST = POT3,
|
#if defined(PCBX10)
|
||||||
|
EXT1,
|
||||||
|
EXT2,
|
||||||
|
#endif
|
||||||
SLIDER_FIRST,
|
SLIDER_FIRST,
|
||||||
SLIDER1 = SLIDER_FIRST,
|
SLIDER1 = SLIDER_FIRST,
|
||||||
SLIDER2,
|
SLIDER2,
|
||||||
|
@ -410,12 +426,16 @@ enum Analogs {
|
||||||
#endif
|
#endif
|
||||||
SLIDER_LAST = SLIDER_FIRST + NUM_SLIDERS - 1,
|
SLIDER_LAST = SLIDER_FIRST + NUM_SLIDERS - 1,
|
||||||
TX_VOLTAGE,
|
TX_VOLTAGE,
|
||||||
|
#if defined(PCBX12S)
|
||||||
MOUSE1, // TODO why after voltage?
|
MOUSE1, // TODO why after voltage?
|
||||||
MOUSE2,
|
MOUSE2,
|
||||||
|
#endif
|
||||||
NUM_ANALOGS,
|
NUM_ANALOGS,
|
||||||
TX_RTC = NUM_ANALOGS
|
TX_RTC = NUM_ANALOGS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define POT_LAST (SLIDER_FIRST - 1)
|
||||||
|
|
||||||
enum CalibratedAnalogs {
|
enum CalibratedAnalogs {
|
||||||
CALIBRATED_STICK1,
|
CALIBRATED_STICK1,
|
||||||
CALIBRATED_STICK2,
|
CALIBRATED_STICK2,
|
||||||
|
@ -445,12 +465,13 @@ void adcInit(void);
|
||||||
void adcRead(void);
|
void adcRead(void);
|
||||||
uint16_t getRTCBattVoltage();
|
uint16_t getRTCBattVoltage();
|
||||||
uint16_t getAnalogValue(uint8_t index);
|
uint16_t getAnalogValue(uint8_t index);
|
||||||
#define NUM_MOUSE_ANALOGS 2
|
|
||||||
#if defined(PCBX10)
|
#if defined(PCBX12S)
|
||||||
#define NUM_DUMMY_ANAS 2
|
#define NUM_MOUSE_ANALOGS 2
|
||||||
#else
|
#else
|
||||||
#define NUM_DUMMY_ANAS 0
|
#define NUM_MOUSE_ANALOGS 0
|
||||||
#endif
|
#endif
|
||||||
|
#define STORAGE_NUM_MOUSE_ANALOGS 2
|
||||||
|
|
||||||
#if NUM_PWMSTICKS > 0
|
#if NUM_PWMSTICKS > 0
|
||||||
#define STICKS_PWM_ENABLED() (!hardwareOptions.sticksPwmDisabled)
|
#define STICKS_PWM_ENABLED() (!hardwareOptions.sticksPwmDisabled)
|
||||||
|
@ -636,4 +657,17 @@ extern DMAFifo<512> telemetryFifo;
|
||||||
extern DMAFifo<32> serial2RxFifo;
|
extern DMAFifo<32> serial2RxFifo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NUM_PWMSTICKS > 0
|
||||||
|
PACK(typedef struct {
|
||||||
|
uint8_t sticksPwmDisabled : 1;
|
||||||
|
uint8_t pxx2Enabled : 1;
|
||||||
|
}) HardwareOptions;
|
||||||
|
#else
|
||||||
|
PACK(typedef struct {
|
||||||
|
uint8_t pxx2Enabled : 1;
|
||||||
|
}) HardwareOptions;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern HardwareOptions hardwareOptions;
|
||||||
|
|
||||||
#endif // _BOARD_HORUS_H_
|
#endif // _BOARD_HORUS_H_
|
||||||
|
|
|
@ -39,10 +39,6 @@
|
||||||
#define KEYS_GPIO_REG_RIGHT GPIOC->IDR
|
#define KEYS_GPIO_REG_RIGHT GPIOC->IDR
|
||||||
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_4 // PC.04
|
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_4 // PC.04
|
||||||
#elif defined(PCBX10)
|
#elif defined(PCBX10)
|
||||||
// #define KEYS_GPIO_REG_UNUSED GPIOH->IDR
|
|
||||||
// #define KEYS_GPIO_PIN_UNUSED GPIO_Pin_14 // PH.14
|
|
||||||
// #define KEYS_GPIO_REG_UNUSED GPIOH->IDR
|
|
||||||
// #define KEYS_GPIO_PIN_UNUSED GPIO_Pin_15 // PH.15
|
|
||||||
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
|
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
|
||||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
|
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
|
||||||
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
||||||
|
@ -176,7 +172,7 @@
|
||||||
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_LSD)
|
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_LSD)
|
||||||
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
|
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
|
||||||
#define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD)
|
#define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD)
|
||||||
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12) // | GPIO_Pin_14 | GPIO_Pin_15)
|
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15)
|
||||||
#define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15)
|
#define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15)
|
||||||
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LSU)
|
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LSU)
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,7 +225,7 @@
|
||||||
#define PWM_GPIOA_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
#define PWM_GPIOA_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
||||||
#define ADC_GPIOA_PINS (STICKS_PWM_ENABLED() ? 0 : (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3))
|
#define ADC_GPIOA_PINS (STICKS_PWM_ENABLED() ? 0 : (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3))
|
||||||
#define ADC_GPIOC_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
#define ADC_GPIOC_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
||||||
#define ADC_GPIOF_PINS (GPIO_Pin_6 | GPIO_Pin_7) // | GPIO_Pin_8 | GPIO_Pin_9)
|
#define ADC_GPIOF_PINS (GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9)
|
||||||
#define ADC_CHANNEL_STICK_LH ADC_Channel_0 // ADC3_IN0
|
#define ADC_CHANNEL_STICK_LH ADC_Channel_0 // ADC3_IN0
|
||||||
#define ADC_CHANNEL_STICK_LV ADC_Channel_1 // ADC3_IN1
|
#define ADC_CHANNEL_STICK_LV ADC_Channel_1 // ADC3_IN1
|
||||||
#define ADC_CHANNEL_STICK_RH ADC_Channel_2 // ADC3_IN2
|
#define ADC_CHANNEL_STICK_RH ADC_Channel_2 // ADC3_IN2
|
||||||
|
@ -255,7 +251,6 @@
|
||||||
// Power
|
// Power
|
||||||
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
||||||
#define PWR_GPIO GPIOJ
|
#define PWR_GPIO GPIOJ
|
||||||
#define PWR_SWITCH_GPIO_REG PWR_GPIO->IDR
|
|
||||||
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
||||||
#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01
|
#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,8 @@ uint32_t switchState(uint8_t index)
|
||||||
ADD_2POS_CASE(F);
|
ADD_2POS_CASE(F);
|
||||||
ADD_3POS_CASE(G, 6);
|
ADD_3POS_CASE(G, 6);
|
||||||
ADD_2POS_CASE(H);
|
ADD_2POS_CASE(H);
|
||||||
|
ADD_2POS_CASE(GMBL);
|
||||||
|
ADD_2POS_CASE(GMBR);
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -301,8 +301,11 @@ extern "C" {
|
||||||
|
|
||||||
// ADC driver
|
// ADC driver
|
||||||
#define NUM_POTS 3
|
#define NUM_POTS 3
|
||||||
|
#define STORAGE_NUM_POTS 3
|
||||||
#define NUM_SLIDERS 0
|
#define NUM_SLIDERS 0
|
||||||
|
#define STORAGE_NUM_SLIDERS 0
|
||||||
#define NUM_XPOTS 0
|
#define NUM_XPOTS 0
|
||||||
|
#define STORAGE_NUM_MOUSE_ANALOGS 0
|
||||||
enum Analogs {
|
enum Analogs {
|
||||||
STICK1,
|
STICK1,
|
||||||
STICK2,
|
STICK2,
|
||||||
|
@ -339,7 +342,6 @@ void adcRead(void);
|
||||||
uint16_t getAnalogValue(uint8_t index);
|
uint16_t getAnalogValue(uint8_t index);
|
||||||
void setSticksGain(uint8_t gains);
|
void setSticksGain(uint8_t gains);
|
||||||
#define NUM_MOUSE_ANALOGS 0
|
#define NUM_MOUSE_ANALOGS 0
|
||||||
#define NUM_DUMMY_ANAS 0
|
|
||||||
|
|
||||||
// Battery driver
|
// Battery driver
|
||||||
uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps
|
uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps
|
||||||
|
|
|
@ -493,10 +493,12 @@ enum Analogs {
|
||||||
|
|
||||||
#define NUM_POTS (POT_LAST-POT_FIRST+1)
|
#define NUM_POTS (POT_LAST-POT_FIRST+1)
|
||||||
#define NUM_XPOTS NUM_POTS
|
#define NUM_XPOTS NUM_POTS
|
||||||
|
#define STORAGE_NUM_POTS NUM_POTS
|
||||||
#define NUM_SLIDERS (TX_VOLTAGE-POT_LAST-1)
|
#define NUM_SLIDERS (TX_VOLTAGE-POT_LAST-1)
|
||||||
|
#define STORAGE_NUM_SLIDERS NUM_SLIDERS
|
||||||
#define NUM_TRIMS 4
|
#define NUM_TRIMS 4
|
||||||
#define NUM_MOUSE_ANALOGS 0
|
#define NUM_MOUSE_ANALOGS 0
|
||||||
#define NUM_DUMMY_ANAS 0
|
#define STORAGE_NUM_MOUSE_ANALOGS 0
|
||||||
|
|
||||||
#if defined(STICKS_PWM)
|
#if defined(STICKS_PWM)
|
||||||
#define NUM_PWMSTICKS 4
|
#define NUM_PWMSTICKS 4
|
||||||
|
|
|
@ -8,6 +8,7 @@ if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
|
||||||
target_include_directories(gtests-lib PUBLIC ${GTEST_INCDIR} ${GTEST_INCDIR}/gtest ${GTEST_SRCDIR})
|
target_include_directories(gtests-lib PUBLIC ${GTEST_INCDIR} ${GTEST_INCDIR}/gtest ${GTEST_SRCDIR})
|
||||||
add_definitions(-DSIMU)
|
add_definitions(-DSIMU)
|
||||||
add_definitions(-DGTESTS)
|
add_definitions(-DGTESTS)
|
||||||
|
remove_definitions(-DCLI)
|
||||||
set(TESTS_PATH ${RADIO_SRC_DIRECTORY})
|
set(TESTS_PATH ${RADIO_SRC_DIRECTORY})
|
||||||
configure_file(${RADIO_SRC_DIRECTORY}/tests/location.h.in ${CMAKE_CURRENT_BINARY_DIR}/location.h @ONLY)
|
configure_file(${RADIO_SRC_DIRECTORY}/tests/location.h.in ${CMAKE_CURRENT_BINARY_DIR}/location.h @ONLY)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
BIN
radio/src/tests/MODELS/model_22_horus.bin
Normal file
BIN
radio/src/tests/MODELS/model_22_horus.bin
Normal file
Binary file not shown.
|
@ -31,12 +31,12 @@ void loadEEPROMFile(const char * filename)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX9DP)
|
#if defined(PCBX9DP)
|
||||||
TEST(Eeprom, ConversionX9DPFrom22)
|
TEST(Conversions, ConversionX9DPFrom22)
|
||||||
{
|
{
|
||||||
loadEEPROMFile(TESTS_PATH "/tests/eeprom_22_x9d+.bin");
|
loadEEPROMFile(TESTS_PATH "/tests/eeprom_22_x9d+.bin");
|
||||||
|
|
||||||
eepromOpen();
|
eepromOpen();
|
||||||
convertModelData(0, 218);
|
eeConvertModel(0, 218);
|
||||||
eeLoadModel(0);
|
eeLoadModel(0);
|
||||||
|
|
||||||
EXPECT_ZSTREQ("Test", g_model.header.name);
|
EXPECT_ZSTREQ("Test", g_model.header.name);
|
||||||
|
@ -57,12 +57,12 @@ TEST(Eeprom, ConversionX9DPFrom22)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX7)
|
#if defined(PCBX7)
|
||||||
TEST(Eeprom, ConversionX7From22)
|
TEST(Conversions, ConversionX7From22)
|
||||||
{
|
{
|
||||||
loadEEPROMFile(TESTS_PATH "/tests/eeprom_22_x7.bin");
|
loadEEPROMFile(TESTS_PATH "/tests/eeprom_22_x7.bin");
|
||||||
|
|
||||||
eepromOpen();
|
eepromOpen();
|
||||||
convertModelData(0, 218);
|
eeConvertModel(0, 218);
|
||||||
eeLoadModel(0);
|
eeLoadModel(0);
|
||||||
|
|
||||||
EXPECT_ZSTREQ("Test", g_model.header.name);
|
EXPECT_ZSTREQ("Test", g_model.header.name);
|
||||||
|
@ -91,3 +91,32 @@ TEST(Eeprom, ConversionX7From22)
|
||||||
EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.screens[0].lines[0].sources[0]);
|
EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.screens[0].lines[0].sources[0]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBX10)
|
||||||
|
TEST(Conversions, ConversionHorusFrom22)
|
||||||
|
{
|
||||||
|
simuFatfsSetPaths(TESTS_PATH "/tests/", TESTS_PATH "/tests/");
|
||||||
|
loadModel("model_22_horus.bin");
|
||||||
|
|
||||||
|
EXPECT_ZSTREQ("Test", g_model.header.name);
|
||||||
|
EXPECT_EQ(80, g_model.mixData[0].weight);
|
||||||
|
EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.mixData[4].srcRaw);
|
||||||
|
EXPECT_EQ(SWSRC_TELEMETRY_STREAMING, g_model.mixData[4].swtch);
|
||||||
|
EXPECT_EQ(-100, g_model.limitData[0].max);
|
||||||
|
EXPECT_EQ(80, g_model.expoData[0].weight);
|
||||||
|
EXPECT_EQ(LS_FUNC_VPOS, g_model.logicalSw[0].func);
|
||||||
|
EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.logicalSw[0].v1);
|
||||||
|
EXPECT_EQ(0, g_model.logicalSw[0].v2);
|
||||||
|
EXPECT_EQ(SWASH_TYPE_120X, g_model.swashR.type);
|
||||||
|
EXPECT_ZSTREQ("Tes", g_model.flightModeData[0].name);
|
||||||
|
EXPECT_EQ(10, g_model.flightModeData[0].gvars[0]);
|
||||||
|
EXPECT_ZSTREQ("Tes", g_model.gvars[0].name);
|
||||||
|
EXPECT_EQ(MODULE_TYPE_PXX_R9M, g_model.moduleData[EXTERNAL_MODULE].type);
|
||||||
|
EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, g_model.moduleData[EXTERNAL_MODULE].subType);
|
||||||
|
EXPECT_ZSTREQ("Rud", g_model.inputNames[0]);
|
||||||
|
EXPECT_ZSTREQ("Tes", g_model.telemetrySensors[0].label);
|
||||||
|
EXPECT_EQ(10, g_model.telemetrySensors[0].id);
|
||||||
|
EXPECT_EQ(10, g_model.telemetrySensors[0].frskyInstance.physID);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
|
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
#define TR_POTS_VSRCRAW "\310S1\0""\3106P\0""\310S2\0""\313L1\0""\313L2\0""\311LS\0""\311RS\0""\310JSx""\310JSy"
|
#define TR_POTS_VSRCRAW "\310S1\0""\3106P\0""\310S2\0""\313L1\0""\313L2\0""\311LS\0""\311RS\0""\310JSx""\310JSy"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0""\312GML""\312GMR"
|
||||||
#elif defined(PCBX10)
|
#elif defined(PCBX10)
|
||||||
#define TR_POTS_VSRCRAW "\310S1\0""\3106P\0""\310S2\0""\311LS\0""\311RS\0""None""None""\310EX1""\310EX2"
|
#define TR_POTS_VSRCRAW "\310S1\0""\3106P\0""\310S2\0""\310EX1""\310EX2""\311LS\0""\311RS\0""\313L1\0""\313L2\0"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0""\312GML""\312GMR"
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
#define TR_POTS_VSRCRAW "\310F1\0""\310F2\0""\310F3\0""\310F4\0""\311S1\0""\311S2\0""\311LS\0""\311RS\0"
|
#define TR_POTS_VSRCRAW "\310F1\0""\310F2\0""\310F3\0""\310F4\0""\311S1\0""\311S2\0""\311LS\0""\311RS\0"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0""\312SI\0""\312SJ\0""\312SK\0""\312SL\0""\312SM\0""\312SN\0""\312SO\0""\312SP\0""\312SQ\0""\312SR\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0""\312SI\0""\312SJ\0""\312SK\0""\312SL\0""\312SM\0""\312SN\0""\312SO\0""\312SP\0""\312SQ\0""\312SR\0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue