feat: support for RadioMaster GX12 (#5703)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
raphaelcoeffic
philmoz
Peter Feerick
parent
0f86cd9a95
commit
36cdd93a1a
@@ -107,6 +107,7 @@ body:
|
|||||||
- Jumper T-Pro
|
- Jumper T-Pro
|
||||||
- Jumper T-Pro V2
|
- Jumper T-Pro V2
|
||||||
- RadioMaster Boxer
|
- RadioMaster Boxer
|
||||||
|
- RadioMaster GX12
|
||||||
- RadioMaster MT12
|
- RadioMaster MT12
|
||||||
- RadioMaster Pocket
|
- RadioMaster Pocket
|
||||||
- RadioMaster T8
|
- RadioMaster T8
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ jobs:
|
|||||||
- xlite
|
- xlite
|
||||||
- xlites
|
- xlites
|
||||||
- mt12
|
- mt12
|
||||||
|
- gx12
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/edgetx/edgetx-dev:latest
|
image: ghcr.io/edgetx/edgetx-dev:latest
|
||||||
volumes:
|
volumes:
|
||||||
@@ -103,7 +104,7 @@ jobs:
|
|||||||
- t8;zorro;pocket;mt12;commando8
|
- t8;zorro;pocket;mt12;commando8
|
||||||
- tlite;tpro;tprov2;tpros;bumblebee;lr3pro
|
- tlite;tpro;tprov2;tpros;bumblebee;lr3pro
|
||||||
- t20;t20v2;t14
|
- t20;t20v2;t14
|
||||||
- tx12;tx12mk2;boxer
|
- tx12;tx12mk2;boxer;gx12
|
||||||
- tx16s
|
- tx16s
|
||||||
- f16
|
- f16
|
||||||
- v16
|
- v16
|
||||||
@@ -114,7 +115,7 @@ jobs:
|
|||||||
- x9e;x9e-hall
|
- x9e;x9e-hall
|
||||||
- x9lite;x9lites
|
- x9lite;x9lites
|
||||||
- xlite;xlites
|
- xlite;xlites
|
||||||
- mt12
|
- mt12;gx12
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/edgetx/edgetx-dev:latest
|
image: ghcr.io/edgetx/edgetx-dev:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- t8;zorro;pocket;mt12;commando8
|
- t8;zorro;pocket;mt12;commando8
|
||||||
- tlite;tpro;tprov2;tpros;bumblebee;lr3pro
|
- tlite;tpro;tprov2;tpros;bumblebee;lr3pro
|
||||||
- t20;t20v2;t14
|
- t20;t20v2;t14
|
||||||
- tx12;tx12mk2;boxer
|
- tx12;tx12mk2;boxer;gx12
|
||||||
- tx16s
|
- tx16s
|
||||||
- f16
|
- f16
|
||||||
- v16
|
- v16
|
||||||
@@ -35,6 +35,7 @@ jobs:
|
|||||||
- x9lite;x9lites
|
- x9lite;x9lites
|
||||||
- xlite;xlites
|
- xlite;xlites
|
||||||
- mt12
|
- mt12
|
||||||
|
- gx12
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/edgetx/edgetx-dev:latest
|
image: ghcr.io/edgetx/edgetx-dev:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -321,6 +321,8 @@ elseif(PCB STREQUAL X7 AND PCBREV STREQUAL ZORRO)
|
|||||||
set(FLAVOUR zorro)
|
set(FLAVOUR zorro)
|
||||||
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL BOXER)
|
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL BOXER)
|
||||||
set(FLAVOUR boxer)
|
set(FLAVOUR boxer)
|
||||||
|
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL GX12)
|
||||||
|
set(FLAVOUR gx12)
|
||||||
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL POCKET)
|
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL POCKET)
|
||||||
set(FLAVOUR pocket)
|
set(FLAVOUR pocket)
|
||||||
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL LR3PRO)
|
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL LR3PRO)
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ int Boards::getEEpromSize(Board::Type board)
|
|||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
case BOARD_RADIOMASTER_MT12:
|
case BOARD_RADIOMASTER_MT12:
|
||||||
|
case BOARD_RADIOMASTER_GX12:
|
||||||
return EESIZE_TARANIS;
|
return EESIZE_TARANIS;
|
||||||
case BOARD_UNKNOWN:
|
case BOARD_UNKNOWN:
|
||||||
return EESIZE_MAX;
|
return EESIZE_MAX;
|
||||||
@@ -260,6 +261,7 @@ int Boards::getFlashSize(Type board)
|
|||||||
case BOARD_RADIOMASTER_T8:
|
case BOARD_RADIOMASTER_T8:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
case BOARD_RADIOMASTER_MT12:
|
case BOARD_RADIOMASTER_MT12:
|
||||||
|
case BOARD_RADIOMASTER_GX12:
|
||||||
return FSIZE_TARANIS;
|
return FSIZE_TARANIS;
|
||||||
case BOARD_HORUS_X12S:
|
case BOARD_HORUS_X12S:
|
||||||
case BOARD_X10:
|
case BOARD_X10:
|
||||||
@@ -620,6 +622,8 @@ QString Boards::getBoardName(Board::Type board)
|
|||||||
return "Radiomaster TX16S";
|
return "Radiomaster TX16S";
|
||||||
case BOARD_RADIOMASTER_ZORRO:
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
return "Radiomaster Zorro";
|
return "Radiomaster Zorro";
|
||||||
|
case BOARD_RADIOMASTER_GX12:
|
||||||
|
return "Radiomaster GX12";
|
||||||
case BOARD_FLYSKY_NV14:
|
case BOARD_FLYSKY_NV14:
|
||||||
return "FlySky NV14";
|
return "FlySky NV14";
|
||||||
case BOARD_FLYSKY_EL18:
|
case BOARD_FLYSKY_EL18:
|
||||||
@@ -744,6 +748,7 @@ int Boards::getDefaultInternalModules(Board::Type board)
|
|||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
case BOARD_RADIOMASTER_MT12:
|
case BOARD_RADIOMASTER_MT12:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
|
case BOARD_RADIOMASTER_GX12:
|
||||||
case BOARD_RADIOMASTER_TX12_MK2:
|
case BOARD_RADIOMASTER_TX12_MK2:
|
||||||
case BOARD_IFLIGHT_COMMANDO8:
|
case BOARD_IFLIGHT_COMMANDO8:
|
||||||
case BOARD_JUMPER_T12MAX:
|
case BOARD_JUMPER_T12MAX:
|
||||||
@@ -786,6 +791,7 @@ void Boards::getBattRange(Board::Type board, int& vmin, int& vmax, unsigned int&
|
|||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
case BOARD_RADIOMASTER_ZORRO:
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
case BOARD_RADIOMASTER_MT12:
|
case BOARD_RADIOMASTER_MT12:
|
||||||
|
case BOARD_RADIOMASTER_GX12:
|
||||||
case BOARD_JUMPER_T12:
|
case BOARD_JUMPER_T12:
|
||||||
case BOARD_JUMPER_T14:
|
case BOARD_JUMPER_T14:
|
||||||
case BOARD_JUMPER_TPRO:
|
case BOARD_JUMPER_TPRO:
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ namespace Board {
|
|||||||
BOARD_RADIOMASTER_TX12,
|
BOARD_RADIOMASTER_TX12,
|
||||||
BOARD_RADIOMASTER_TX12_MK2,
|
BOARD_RADIOMASTER_TX12_MK2,
|
||||||
BOARD_RADIOMASTER_BOXER,
|
BOARD_RADIOMASTER_BOXER,
|
||||||
|
BOARD_RADIOMASTER_GX12,
|
||||||
BOARD_RADIOMASTER_T8,
|
BOARD_RADIOMASTER_T8,
|
||||||
BOARD_JUMPER_TLITE,
|
BOARD_JUMPER_TLITE,
|
||||||
BOARD_JUMPER_TLITE_F4,
|
BOARD_JUMPER_TLITE_F4,
|
||||||
@@ -590,6 +591,11 @@ inline bool IS_RADIOMASTER_POCKET(Board::Type board)
|
|||||||
return board == Board::BOARD_RADIOMASTER_POCKET;
|
return board == Board::BOARD_RADIOMASTER_POCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IS_RADIOMASTER_GX12(Board::Type board)
|
||||||
|
{
|
||||||
|
return board == Board::BOARD_RADIOMASTER_GX12;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool IS_RADIOMASTER_T8(Board::Type board)
|
inline bool IS_RADIOMASTER_T8(Board::Type board)
|
||||||
{
|
{
|
||||||
return board == Board::BOARD_RADIOMASTER_T8;
|
return board == Board::BOARD_RADIOMASTER_T8;
|
||||||
@@ -629,6 +635,7 @@ inline bool IS_FAMILY_T12(Board::Type board)
|
|||||||
board == Board::BOARD_RADIOMASTER_BOXER ||
|
board == Board::BOARD_RADIOMASTER_BOXER ||
|
||||||
board == Board::BOARD_RADIOMASTER_MT12 ||
|
board == Board::BOARD_RADIOMASTER_MT12 ||
|
||||||
board == Board::BOARD_RADIOMASTER_POCKET ||
|
board == Board::BOARD_RADIOMASTER_POCKET ||
|
||||||
|
board == Board::BOARD_RADIOMASTER_GX12 ||
|
||||||
board == Board::BOARD_RADIOMASTER_T8 ||
|
board == Board::BOARD_RADIOMASTER_T8 ||
|
||||||
board == Board::BOARD_BETAFPV_LR3PRO ||
|
board == Board::BOARD_BETAFPV_LR3PRO ||
|
||||||
board == Board::BOARD_IFLIGHT_COMMANDO8;
|
board == Board::BOARD_IFLIGHT_COMMANDO8;
|
||||||
|
|||||||
@@ -781,6 +781,13 @@ void registerOpenTxFirmwares()
|
|||||||
registerOpenTxFirmware(firmware);
|
registerOpenTxFirmware(firmware);
|
||||||
addOpenTxRfOptions(firmware, FLEX);
|
addOpenTxRfOptions(firmware, FLEX);
|
||||||
|
|
||||||
|
/* Radiomaster GX12 board */
|
||||||
|
firmware = new OpenTxFirmware(FIRMWAREID("gx12"), QCoreApplication::translate("Firmware", "Radiomaster GX12"), BOARD_RADIOMASTER_GX12);
|
||||||
|
addOpenTxCommonOptions(firmware);
|
||||||
|
addOpenTxFontOptions(firmware);
|
||||||
|
registerOpenTxFirmware(firmware);
|
||||||
|
addOpenTxRfOptions(firmware, FLEX);
|
||||||
|
|
||||||
/* Radiomaster TX16S board */
|
/* Radiomaster TX16S board */
|
||||||
firmware = new OpenTxFirmware(FIRMWAREID("tx16s"), Firmware::tr("Radiomaster TX16S / SE / Hall / Masterfire"), BOARD_RADIOMASTER_TX16S);
|
firmware = new OpenTxFirmware(FIRMWAREID("tx16s"), Firmware::tr("Radiomaster TX16S / SE / Hall / Masterfire"), BOARD_RADIOMASTER_TX16S);
|
||||||
addOpenTxFrskyOptions(firmware);
|
addOpenTxFrskyOptions(firmware);
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
|||||||
case Board::BOARD_RADIOMASTER_MT12:
|
case Board::BOARD_RADIOMASTER_MT12:
|
||||||
radioUiWidget = new SimulatedUIWidgetMT12(simulator, this);
|
radioUiWidget = new SimulatedUIWidgetMT12(simulator, this);
|
||||||
break;
|
break;
|
||||||
|
case Board::BOARD_RADIOMASTER_GX12:
|
||||||
|
radioUiWidget = new SimulatedUIWidgetGeneric(simulator, this);
|
||||||
|
break;
|
||||||
case Board::BOARD_RADIOMASTER_T8:
|
case Board::BOARD_RADIOMASTER_T8:
|
||||||
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -44,7 +44,8 @@
|
|||||||
["RadioMaster TX12", "tx12-"],
|
["RadioMaster TX12", "tx12-"],
|
||||||
["RadioMaster TX12MK2", "tx12mk2-"],
|
["RadioMaster TX12MK2", "tx12mk2-"],
|
||||||
["RadioMaster TX16S", "tx16s-"],
|
["RadioMaster TX16S", "tx16s-"],
|
||||||
["RadioMaster Zorro","zorro-"]
|
["RadioMaster Zorro","zorro-"],
|
||||||
|
["RadioMaster GX12", "gx12-"]
|
||||||
],
|
],
|
||||||
"changelog": "- Major initial bug fixes"
|
"changelog": "- Major initial bug fixes"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ void rgbSetLedColor(uint8_t led, uint8_t r, uint8_t g, uint8_t b)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t rgbGetLedColor(uint8_t led)
|
||||||
|
{
|
||||||
|
return ws2812_get_color(led);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rgbGetState(uint8_t led)
|
||||||
|
{
|
||||||
|
return ws2812_get_state(led);
|
||||||
|
}
|
||||||
|
|
||||||
void rgbLedColorApply()
|
void rgbLedColorApply()
|
||||||
{
|
{
|
||||||
ws2812_update(&_led_timer);;
|
ws2812_update(&_led_timer);;
|
||||||
|
|||||||
@@ -24,4 +24,6 @@
|
|||||||
void rgbLedStart();
|
void rgbLedStart();
|
||||||
void rgbLedStop();
|
void rgbLedStop();
|
||||||
void rgbSetLedColor(unsigned char, unsigned char, unsigned char, unsigned char);
|
void rgbSetLedColor(unsigned char, unsigned char, unsigned char, unsigned char);
|
||||||
|
uint32_t rgbGetLedColor(uint8_t led);
|
||||||
|
bool rgbGetState(unsigned char);
|
||||||
void rgbLedColorApply();
|
void rgbLedColorApply();
|
||||||
|
|||||||
@@ -31,12 +31,12 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void boardInitSwitches()
|
__weak void boardInitSwitches()
|
||||||
{
|
{
|
||||||
_init_switches();
|
_init_switches();
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
__weak SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
||||||
{
|
{
|
||||||
return stm32_switch_get_position(&_switch_offsets[cat][idx]);
|
return stm32_switch_get_position(&_switch_offsets[cat][idx]);
|
||||||
}
|
}
|
||||||
|
|||||||
+146
-101
@@ -22,6 +22,7 @@
|
|||||||
#include <FreeRTOS/include/FreeRTOS.h>
|
#include <FreeRTOS/include/FreeRTOS.h>
|
||||||
#include <FreeRTOS/include/stream_buffer.h>
|
#include <FreeRTOS/include/stream_buffer.h>
|
||||||
|
|
||||||
|
#include "hal/serial_driver.h"
|
||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
#include "timers_driver.h"
|
#include "timers_driver.h"
|
||||||
#include "hal/watchdog_driver.h"
|
#include "hal/watchdog_driver.h"
|
||||||
@@ -1045,28 +1046,77 @@ int cliSet(const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_SERIAL_PASSTHROUGH)
|
#if defined(ENABLE_SERIAL_PASSTHROUGH)
|
||||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
|
||||||
static etx_module_state_t *spInternalModuleState = nullptr;
|
|
||||||
|
|
||||||
static void spInternalModuleTx(uint8_t* buf, uint32_t len)
|
static const etx_serial_driver_t* _sp_drv = nullptr;
|
||||||
|
static void* _sp_ctx = nullptr;
|
||||||
|
|
||||||
|
static void _sp_Tx(uint8_t* buf, uint32_t len)
|
||||||
{
|
{
|
||||||
auto drv = modulePortGetSerialDrv(spInternalModuleState->tx);
|
|
||||||
auto ctx = modulePortGetCtx(spInternalModuleState->tx);
|
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
drv->sendByte(ctx, *(buf++));
|
_sp_drv->sendByte(_sp_ctx, *(buf++));
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const etx_serial_init spIntmoduleSerialInitParams = {
|
#if defined(HARDWARE_INTERNAL_MODULE) || defined(HARDWARE_EXTERNAL_MODULE)
|
||||||
.baudrate = 0,
|
static etx_module_state_t *spModuleState = nullptr;
|
||||||
.encoding = ETX_Encoding_8N1,
|
|
||||||
.direction = ETX_Dir_TX_RX,
|
static void spModuleInit(int port_n, int baudrate)
|
||||||
.polarity = ETX_Pol_Normal,
|
{
|
||||||
};
|
etx_serial_init params = {
|
||||||
|
.baudrate = (uint32_t)baudrate,
|
||||||
|
.encoding = ETX_Encoding_8N1,
|
||||||
|
.direction = ETX_Dir_TX_RX,
|
||||||
|
.polarity = ETX_Pol_Normal,
|
||||||
|
};
|
||||||
|
|
||||||
|
spModuleState =
|
||||||
|
modulePortInitSerial(port_n, ETX_MOD_PORT_UART, ¶ms, false);
|
||||||
|
_sp_drv = modulePortGetSerialDrv(spModuleState->rx);
|
||||||
|
_sp_ctx = modulePortGetCtx(spModuleState->rx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void spModuleDeInit(int port_n)
|
||||||
|
{
|
||||||
|
// and stop module
|
||||||
|
modulePortDeInit(spModuleState);
|
||||||
|
spModuleState = nullptr;
|
||||||
|
|
||||||
|
// power off the module and wait for a bit
|
||||||
|
modulePortSetPower(port_n, false);
|
||||||
|
delay_ms(200);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // HARDWARE_INTERNAL_MODULE
|
#endif // HARDWARE_INTERNAL_MODULE
|
||||||
|
|
||||||
|
#if defined(FLYSKY_GIMBAL)
|
||||||
|
#include "flysky_gimbal_driver.h"
|
||||||
|
|
||||||
|
static void spGimbalInit(int port_n, int baudrate)
|
||||||
|
{
|
||||||
|
etx_serial_init params = {
|
||||||
|
.baudrate = (uint32_t)baudrate,
|
||||||
|
.encoding = ETX_Encoding_8N1,
|
||||||
|
.direction = ETX_Dir_TX_RX,
|
||||||
|
.polarity = ETX_Pol_Normal,
|
||||||
|
};
|
||||||
|
|
||||||
|
(void)port_n;
|
||||||
|
flysky_gimbal_deinit();
|
||||||
|
|
||||||
|
auto port = flysky_gimbal_get_port();
|
||||||
|
_sp_drv = port->uart;
|
||||||
|
_sp_ctx = _sp_drv->init(port->hw_def, ¶ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void spGimbalDeInit(int port_n)
|
||||||
|
{
|
||||||
|
(void)port_n;
|
||||||
|
_sp_drv->deinit(_sp_ctx);
|
||||||
|
flysky_gimbal_init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: use proper method instead
|
// TODO: use proper method instead
|
||||||
extern bool cdcConnected;
|
extern bool cdcConnected;
|
||||||
extern uint32_t usbSerialBaudRate(void*);
|
extern uint32_t usbSerialBaudRate(void*);
|
||||||
@@ -1074,121 +1124,116 @@ extern uint32_t usbSerialBaudRate(void*);
|
|||||||
int cliSerialPassthrough(const char **argv)
|
int cliSerialPassthrough(const char **argv)
|
||||||
{
|
{
|
||||||
const char* port_type = argv[1];
|
const char* port_type = argv[1];
|
||||||
const char* port_num = argv[2];
|
|
||||||
|
|
||||||
// 3rd argument (baudrate is optional)
|
if (!port_type) {
|
||||||
if (!port_type || !port_num) {
|
|
||||||
cliSerialPrint("%s: missing argument", argv[0]);
|
cliSerialPrint("%s: missing argument", argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int baudrate = 0;
|
||||||
|
void (*initCB)(int, int) = nullptr;
|
||||||
|
void (*deinitCB)(int) = nullptr;
|
||||||
|
|
||||||
int port_n = 0;
|
int port_n = 0;
|
||||||
int err = toInt(argv, 2, &port_n);
|
if (!strcmp("rfmod", port_type)) {
|
||||||
if (err == -1) return err;
|
// parse port number
|
||||||
if (err == 0) {
|
if (toInt(argv, 2, &port_n) <= 0) {
|
||||||
cliSerialPrint("%s: missing port #", argv[0]);
|
cliSerialPrint("%s: invalid or missing port number", argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// 3rd argument (baudrate is optional)
|
||||||
|
if (toInt(argv, 3, &baudrate) <= 0) {
|
||||||
|
baudrate = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(port_n) {
|
||||||
|
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||||
|
case INTERNAL_MODULE:
|
||||||
|
initCB = spModuleInit;
|
||||||
|
deinitCB = spModuleDeInit;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
// TODO:
|
||||||
|
// - external module (S.PORT?)
|
||||||
|
default:
|
||||||
|
cliSerialPrint("%s: invalid port # '%i'", port_n);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else if (!strcmp("gimbals", port_type)) {
|
||||||
|
#if defined(FLYSKY_GIMBAL)
|
||||||
|
// 2nd argument (baudrate is optional)
|
||||||
|
if (toInt(argv, 2, &baudrate) <= 0) {
|
||||||
|
baudrate = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
initCB = spGimbalInit;
|
||||||
|
deinitCB = spGimbalDeInit;
|
||||||
|
#else
|
||||||
|
cliSerialPrint("%s: serial gimbals not supported");
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
cliSerialPrint("%s: invalid port type '%s'", port_type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int baudrate = 0;
|
// stop pulses
|
||||||
err = toInt(argv, 3, &baudrate);
|
watchdogSuspend(200/*2s*/);
|
||||||
if (err <= 0) {
|
pulsesStop();
|
||||||
|
|
||||||
|
// suspend RTOS scheduler
|
||||||
|
vTaskSuspendAll();
|
||||||
|
|
||||||
|
if (baudrate <= 0) {
|
||||||
// use current baudrate
|
// use current baudrate
|
||||||
baudrate = cliGetBaudRate();
|
baudrate = cliGetBaudRate();
|
||||||
if (!baudrate) {
|
if (!baudrate) {
|
||||||
// default to 115200
|
|
||||||
baudrate = 115200;
|
baudrate = 115200;
|
||||||
cliSerialPrint("%s: baudrate is 0, default to 115200", argv[0]);
|
cliSerialPrint("%s: baudrate is 0, default to 115200", argv[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("rfmod", port_type)) {
|
if (initCB) initCB(port_n, baudrate);
|
||||||
|
|
||||||
if (port_n >= NUM_MODULES
|
if (_sp_drv != nullptr) {
|
||||||
// only internal module supported for now
|
auto backupCB = cliReceiveCallBack;
|
||||||
&& port_n != INTERNAL_MODULE) {
|
cliReceiveCallBack = _sp_Tx;
|
||||||
cliSerialPrint("%s: invalid port # '%s'", port_num);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop pulses
|
// loop until cable disconnected
|
||||||
watchdogSuspend(200/*2s*/);
|
while (usbPlugged()) {
|
||||||
pulsesStop();
|
|
||||||
|
|
||||||
// suspend RTOS scheduler
|
uint32_t cli_br = cliGetBaudRate();
|
||||||
vTaskSuspendAll();
|
if (cli_br && (cli_br != (uint32_t)baudrate)) {
|
||||||
|
baudrate = cli_br;
|
||||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
_sp_drv->setBaudrate(_sp_ctx, baudrate);
|
||||||
if (port_n == INTERNAL_MODULE) {
|
|
||||||
|
|
||||||
// setup serial com
|
|
||||||
|
|
||||||
// TODO: '8n1' param
|
|
||||||
etx_serial_init params(spIntmoduleSerialInitParams);
|
|
||||||
params.baudrate = baudrate;
|
|
||||||
|
|
||||||
spInternalModuleState = modulePortInitSerial(port_n, ETX_MOD_PORT_UART,
|
|
||||||
¶ms, false);
|
|
||||||
|
|
||||||
auto drv = modulePortGetSerialDrv(spInternalModuleState->rx);
|
|
||||||
auto ctx = modulePortGetCtx(spInternalModuleState->rx);
|
|
||||||
|
|
||||||
// backup and swap CLI input
|
|
||||||
auto backupCB = cliReceiveCallBack;
|
|
||||||
cliReceiveCallBack = spInternalModuleTx;
|
|
||||||
|
|
||||||
// loop until cable disconnected
|
|
||||||
while (usbPlugged()) {
|
|
||||||
|
|
||||||
uint32_t cli_br = cliGetBaudRate();
|
|
||||||
if (cli_br && (cli_br != (uint32_t)baudrate)) {
|
|
||||||
baudrate = cli_br;
|
|
||||||
drv->setBaudrate(ctx, baudrate);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t data;
|
|
||||||
if (drv->getByte(ctx, &data) > 0) {
|
|
||||||
|
|
||||||
uint8_t timeout = 10; // 10 ms
|
|
||||||
while(!usbSerialFreeSpace() && (timeout > 0)) {
|
|
||||||
delay_ms(1);
|
|
||||||
timeout--;
|
|
||||||
}
|
|
||||||
|
|
||||||
cliSerialPutc(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// keep us up & running
|
|
||||||
WDG_RESET();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore callsbacks
|
uint8_t data;
|
||||||
cliReceiveCallBack = backupCB;
|
if (_sp_drv->getByte(_sp_ctx, &data) > 0) {
|
||||||
|
uint8_t timeout = 10; // 10 ms
|
||||||
|
while(!usbSerialFreeSpace() && (timeout > 0)) {
|
||||||
|
delay_ms(1);
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
|
||||||
// and stop module
|
cliSerialPutc(data);
|
||||||
modulePortDeInit(spInternalModuleState);
|
}
|
||||||
spInternalModuleState = nullptr;
|
|
||||||
|
|
||||||
// power off the module and wait for a bit
|
// keep us up & running
|
||||||
modulePortSetPower(port_n, false);
|
WDG_RESET();
|
||||||
delay_ms(200);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO:
|
// restore callsbacks
|
||||||
// - external module (S.PORT?)
|
cliReceiveCallBack = backupCB;
|
||||||
|
if (deinitCB != nullptr) deinitCB(port_n);
|
||||||
watchdogSuspend(200/*2s*/);
|
|
||||||
pulsesStart();
|
|
||||||
|
|
||||||
// suspend RTOS scheduler
|
|
||||||
xTaskResumeAll();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cliSerialPrint("%s: invalid port type '%s'", port_type);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watchdogSuspend(200/*2s*/);
|
||||||
|
pulsesStart();
|
||||||
|
|
||||||
|
// suspend RTOS scheduler
|
||||||
|
xTaskResumeAll();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1626,7 +1671,7 @@ const CliCommand cliCommands[] = {
|
|||||||
{ "reboot", cliReboot, "[wdt]" },
|
{ "reboot", cliReboot, "[wdt]" },
|
||||||
{ "set", cliSet, "<what> <value>" },
|
{ "set", cliSet, "<what> <value>" },
|
||||||
#if defined(ENABLE_SERIAL_PASSTHROUGH)
|
#if defined(ENABLE_SERIAL_PASSTHROUGH)
|
||||||
{ "serialpassthrough", cliSerialPassthrough, "<port type> <port number>"},
|
{ "serialpassthrough", cliSerialPassthrough, "<port type> [<port number>] [<baudrate>]"},
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
{ "print", cliDisplay, "<address> [<size>] | <what>" },
|
{ "print", cliDisplay, "<address> [<size>] | <what>" },
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ static inline void check_struct()
|
|||||||
CHKSIZE(ModelData, 6329);
|
CHKSIZE(ModelData, 6329);
|
||||||
#elif defined(RADIO_FAMILY_T20)
|
#elif defined(RADIO_FAMILY_T20)
|
||||||
CHKSIZE(ModelData, 6390);
|
CHKSIZE(ModelData, 6390);
|
||||||
|
#elif defined(RADIO_GX12)
|
||||||
|
CHKSIZE(ModelData, 6390);
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
CHKSIZE(ModelData, 6771);
|
CHKSIZE(ModelData, 6771);
|
||||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "usb_joystick.h"
|
#include "usb_joystick.h"
|
||||||
#include "input_mapping.h"
|
#include "input_mapping.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define N_TARANIS_FIELD(x)
|
#define N_TARANIS_FIELD(x)
|
||||||
@@ -626,13 +627,37 @@ PACK(struct CustomScreenData {
|
|||||||
#define SCRIPT_DATA
|
#define SCRIPT_DATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct RGBLedColor {
|
||||||
|
uint8_t r;
|
||||||
|
uint8_t g;
|
||||||
|
uint8_t b;
|
||||||
|
|
||||||
|
uint32_t getColor() {
|
||||||
|
return ((r << 16) + (g << 8) + b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColor(uint32_t color) {
|
||||||
|
r = color >> 16;
|
||||||
|
g = color >> 8;
|
||||||
|
b = color;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS \
|
||||||
|
RGBLedColor functionSwitchLedONColor[NUM_FUNCTIONS_SWITCHES]; \
|
||||||
|
RGBLedColor functionSwitchLedOFFColor[NUM_FUNCTIONS_SWITCHES];
|
||||||
|
#else
|
||||||
|
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS
|
||||||
|
#endif
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#define FUNCTION_SWITCHS_FIELDS \
|
#define FUNCTION_SWITCHS_FIELDS \
|
||||||
uint16_t functionSwitchConfig; \
|
uint16_t functionSwitchConfig; \
|
||||||
uint16_t functionSwitchGroup; \
|
uint16_t functionSwitchGroup; \
|
||||||
uint16_t functionSwitchStartConfig; \
|
uint16_t functionSwitchStartConfig; \
|
||||||
uint8_t functionSwitchLogicalState; \
|
uint8_t functionSwitchLogicalState; \
|
||||||
char switchNames[NUM_FUNCTIONS_SWITCHES][LEN_SWITCH_NAME];
|
char switchNames[NUM_FUNCTIONS_SWITCHES][LEN_SWITCH_NAME]; \
|
||||||
|
FUNCTION_SWITCHS_RGB_LEDS_FIELDS
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHS_FIELDS
|
#define FUNCTION_SWITCHS_FIELDS
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1365,8 +1365,6 @@ void edgeTxInit()
|
|||||||
menuHandlers[1] = menuModelSelect;
|
menuHandlers[1] = menuModelSelect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switchInit();
|
|
||||||
|
|
||||||
#if defined(GUI) && !defined(COLORLCD)
|
#if defined(GUI) && !defined(COLORLCD)
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
lcdClear();
|
lcdClear();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "hal/adc_driver.h"
|
#include "hal/adc_driver.h"
|
||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "hal/module_port.h"
|
#include "hal/module_port.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
|
||||||
#if defined(USBJ_EX)
|
#if defined(USBJ_EX)
|
||||||
@@ -70,7 +71,30 @@ enum MenuModelSetupItems {
|
|||||||
ITEM_MODEL_SETUP_TIMER3_PERSISTENT,
|
ITEM_MODEL_SETUP_TIMER3_PERSISTENT,
|
||||||
ITEM_MODEL_SETUP_TIMER3_MINUTE_BEEP,
|
ITEM_MODEL_SETUP_TIMER3_MINUTE_BEEP,
|
||||||
ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP,
|
ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP,
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
ITEM_MODEL_SETUP_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_SW1,
|
||||||
|
ITEM_MODEL_SETUP_SW1_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_SW2,
|
||||||
|
ITEM_MODEL_SETUP_SW2_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_SW3,
|
||||||
|
ITEM_MODEL_SETUP_SW3_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_SW4,
|
||||||
|
ITEM_MODEL_SETUP_SW4_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_SW5,
|
||||||
|
ITEM_MODEL_SETUP_SW5_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_SW6,
|
||||||
|
ITEM_MODEL_SETUP_SW6_COLOR,
|
||||||
|
ITEM_MODEL_SETUP_GROUP1_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP1_START,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_START,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_START,
|
||||||
|
#elif defined(FUNCTION_SWITCHES)
|
||||||
ITEM_MODEL_SETUP_LABEL,
|
ITEM_MODEL_SETUP_LABEL,
|
||||||
ITEM_MODEL_SETUP_SW1,
|
ITEM_MODEL_SETUP_SW1,
|
||||||
ITEM_MODEL_SETUP_SW2,
|
ITEM_MODEL_SETUP_SW2,
|
||||||
@@ -354,7 +378,30 @@ inline uint8_t TIMER_ROW(uint8_t timer, uint8_t value)
|
|||||||
|
|
||||||
#define EXTRA_MODULE_ROWS
|
#define EXTRA_MODULE_ROWS
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
#define FUNCTION_SWITCHES_ROWS 1, \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
|
FS_ROW(1), \
|
||||||
|
FS_ROW(G1_ROW(LABEL())), \
|
||||||
|
FS_ROW(G1_ROW(0)), \
|
||||||
|
FS_ROW(G1_ROW(0)), \
|
||||||
|
FS_ROW(G2_ROW(LABEL())), \
|
||||||
|
FS_ROW(G2_ROW(0)), \
|
||||||
|
FS_ROW(G2_ROW(0)), \
|
||||||
|
FS_ROW(G3_ROW(LABEL())), \
|
||||||
|
FS_ROW(G3_ROW(0)), \
|
||||||
|
FS_ROW(G3_ROW(0)),
|
||||||
|
#elif defined(FUNCTION_SWITCHES)
|
||||||
#define FUNCTION_SWITCHES_ROWS 1, \
|
#define FUNCTION_SWITCHES_ROWS 1, \
|
||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
@@ -838,9 +885,15 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_SW5:
|
case ITEM_MODEL_SETUP_SW5:
|
||||||
case ITEM_MODEL_SETUP_SW6:
|
case ITEM_MODEL_SETUP_SW6:
|
||||||
{
|
{
|
||||||
int index = k - ITEM_MODEL_SETUP_SW1;
|
int index = (k - ITEM_MODEL_SETUP_SW1) / 2;
|
||||||
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(index+switchGetMaxSwitches()), menuHorizontalPosition < 0 ? attr : 0);
|
|
||||||
|
// TODO: restore following line when switchGetName(index+switchGetMaxSwitches()) doesn't crash anymore
|
||||||
|
//lcdDrawText(lcdNextPos, y, switchGetName(index+switchGetMaxSwitches()), menuHorizontalPosition < 0 ? attr : 0);
|
||||||
|
|
||||||
|
// TODO : delete next 2 lines when switchGetName(index+switchGetMaxSwitches()) doesn't crash anymore
|
||||||
|
lcdDrawText(lcdNextPos, y, "SW", menuHorizontalPosition < 0 ? attr : 0);
|
||||||
|
lcdDrawChar(lcdNextPos, y, '1' + index, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
|
|
||||||
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
||||||
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0, 0, old_editMode);
|
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0, 0, old_editMode);
|
||||||
@@ -892,6 +945,39 @@ void menuModelSetup(event_t event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
case ITEM_MODEL_SETUP_SW1_COLOR:
|
||||||
|
case ITEM_MODEL_SETUP_SW2_COLOR:
|
||||||
|
case ITEM_MODEL_SETUP_SW3_COLOR:
|
||||||
|
case ITEM_MODEL_SETUP_SW4_COLOR:
|
||||||
|
case ITEM_MODEL_SETUP_SW5_COLOR:
|
||||||
|
case ITEM_MODEL_SETUP_SW6_COLOR:
|
||||||
|
{
|
||||||
|
int index = (k - ITEM_MODEL_SETUP_SW1_COLOR) / 2;
|
||||||
|
uint8_t selectedColor = 0;
|
||||||
|
|
||||||
|
// ON
|
||||||
|
selectedColor = getRGBColorIndex(g_model.functionSwitchLedONColor[index].getColor());
|
||||||
|
selectedColor = editChoice(INDENT_WIDTH + getTextWidth(STR_FS_ON_COLOR) + 2, y, STR_FS_ON_COLOR, \
|
||||||
|
STR_FS_COLOR_LIST, selectedColor, 0, (sizeof(colorTable) / sizeof(colorTable[0])) - 1, menuHorizontalPosition == 0 ? attr : 0, event, INDENT_WIDTH);
|
||||||
|
if (attr && menuHorizontalPosition == 0 && checkIncDec_Ret) {
|
||||||
|
g_model.functionSwitchLedONColor[index].setColor(colorTable[selectedColor]);
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFF
|
||||||
|
selectedColor = getRGBColorIndex(g_model.functionSwitchLedOFFColor[index].getColor());
|
||||||
|
selectedColor = editChoice((30 + 5*FW) + getTextWidth(STR_FS_OFF_COLOR) + 2, y, STR_FS_OFF_COLOR, \
|
||||||
|
STR_FS_COLOR_LIST, selectedColor, 0, (sizeof(colorTable) / sizeof(colorTable[0])) - 1, menuHorizontalPosition == 1 ? attr : 0, event, 30 + 5*FW);
|
||||||
|
if (attr && menuHorizontalPosition == 1 && checkIncDec_Ret) {
|
||||||
|
g_model.functionSwitchLedOFFColor[index].setColor(colorTable[selectedColor]);
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_GROUP1_LABEL:
|
case ITEM_MODEL_SETUP_GROUP1_LABEL:
|
||||||
case ITEM_MODEL_SETUP_GROUP2_LABEL:
|
case ITEM_MODEL_SETUP_GROUP2_LABEL:
|
||||||
case ITEM_MODEL_SETUP_GROUP3_LABEL:
|
case ITEM_MODEL_SETUP_GROUP3_LABEL:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "hal/key_driver.h"
|
#include "hal/key_driver.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
|
||||||
void displayKeyState(uint8_t x, uint8_t y, uint8_t key)
|
void displayKeyState(uint8_t x, uint8_t y, uint8_t key)
|
||||||
{
|
{
|
||||||
@@ -54,9 +55,15 @@ static EnumKeys get_ith_key(uint8_t i)
|
|||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
void menuRadioDiagFS(event_t event)
|
void menuRadioDiagFS(event_t event)
|
||||||
{
|
{
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
constexpr coord_t FS_1ST_COLUMN = 32;
|
||||||
|
constexpr coord_t FS_2ND_COLUMN = 60;
|
||||||
|
constexpr coord_t FS_3RD_COLUMN = 80;
|
||||||
|
#else
|
||||||
constexpr coord_t FS_1ST_COLUMN = 40;
|
constexpr coord_t FS_1ST_COLUMN = 40;
|
||||||
constexpr coord_t FS_2ND_COLUMN = 70;
|
constexpr coord_t FS_2ND_COLUMN = 70;
|
||||||
constexpr coord_t FS_3RD_COLUMN = 100;
|
constexpr coord_t FS_3RD_COLUMN = 100;
|
||||||
|
#endif
|
||||||
SIMPLE_SUBMENU(STR_MENU_FSWITCH, 1);
|
SIMPLE_SUBMENU(STR_MENU_FSWITCH, 1);
|
||||||
lcdDrawText(FS_1ST_COLUMN, MENU_HEADER_HEIGHT + 1, "Phys");
|
lcdDrawText(FS_1ST_COLUMN, MENU_HEADER_HEIGHT + 1, "Phys");
|
||||||
lcdDrawText(FS_2ND_COLUMN, MENU_HEADER_HEIGHT + 1, "Log");
|
lcdDrawText(FS_2ND_COLUMN, MENU_HEADER_HEIGHT + 1, "Log");
|
||||||
@@ -68,7 +75,11 @@ void menuRadioDiagFS(event_t event)
|
|||||||
lcdDrawText(lcdNextPos, y, switchGetName(i+switchGetMaxSwitches()), 0);
|
lcdDrawText(lcdNextPos, y, switchGetName(i+switchGetMaxSwitches()), 0);
|
||||||
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
lcdDrawText(FS_2ND_COLUMN + 5, y, getFSLogicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
lcdDrawText(FS_2ND_COLUMN + 5, y, getFSLogicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
lcdDrawText(FS_3RD_COLUMN, y, STR_OFFON[getFSLedState(i)]);
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
lcdDrawText(FS_3RD_COLUMN, y, STR_FS_COLOR_LIST[getRGBColorIndex(rgbGetLedColor(i))], 0);
|
||||||
|
#else
|
||||||
|
lcdDrawText(FS_3RD_COLUMN, y, STR_OFFON[fsLedState(i)]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
|
||||||
|
|
||||||
#define SLEEP_BITMAP_WIDTH 42
|
#define SLEEP_BITMAP_WIDTH 42
|
||||||
@@ -52,9 +54,14 @@ void drawStartupAnimation(uint32_t duration, uint32_t totalDuration)
|
|||||||
|
|
||||||
for (uint8_t j = 0; j < steps; j++) {
|
for (uint8_t j = 0; j < steps; j++) {
|
||||||
if (index2 > j) {
|
if (index2 > j) {
|
||||||
fsLedOn(j);
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
fsLedRGB(j, 0xFFFFFF);
|
||||||
|
rgbLedColorApply();
|
||||||
|
#else
|
||||||
|
setFSLedON(j);
|
||||||
|
#endif
|
||||||
#if defined(RADIO_FAMILY_T20)
|
#if defined(RADIO_FAMILY_T20)
|
||||||
fsLedOn(j + steps);
|
setFSLedON(j + steps);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,14 +95,14 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
|||||||
steps);
|
steps);
|
||||||
|
|
||||||
for (uint8_t j = 0; j < steps; j++) {
|
for (uint8_t j = 0; j < steps; j++) {
|
||||||
fsLedOff(j);
|
setFSLedOFF(j);
|
||||||
#if defined(RADIO_FAMILY_T20)
|
#if defined(RADIO_FAMILY_T20)
|
||||||
fsLedOff(j + steps);
|
setFSLedOFF(j + steps);
|
||||||
#endif
|
#endif
|
||||||
if (steps - index2 > j) {
|
if (steps - index2 > j) {
|
||||||
fsLedOn(j);
|
setFSLedON(j);
|
||||||
#if defined(RADIO_FAMILY_T20)
|
#if defined(RADIO_FAMILY_T20)
|
||||||
fsLedOn(j + steps);
|
setFSLedON(j + steps);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,13 @@
|
|||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
#include "strhelpers.h"
|
#include "strhelpers.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "color_picker.h"
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
static constexpr coord_t LH = 72;
|
||||||
|
#else
|
||||||
|
static constexpr coord_t LH = 36;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||||
|
|
||||||
@@ -116,6 +123,37 @@ class FunctionSwitch : public Window
|
|||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
new StaticText(this, {8 , 6 + 36, SW_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_FS_OFF_COLOR, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
|
auto offcolor = new ColorPicker(
|
||||||
|
this, rect_t{},
|
||||||
|
[=]() -> int { // getValue
|
||||||
|
return g_model.functionSwitchLedOFFColor[switchIndex];
|
||||||
|
},
|
||||||
|
[=](int newValue) { // setValue
|
||||||
|
g_model.functionSwitchLedOFFColor[switchIndex] =
|
||||||
|
(uint32_t)newValue;
|
||||||
|
TRACE("Color: %x", g_model.functionSwitchLedOFFColor[switchIndex]);
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
|
offcolor->setPos(NM_X, 36);
|
||||||
|
|
||||||
|
new StaticText(this, {TP_X, 6 + 36, SW_W, EdgeTxStyles::PAGE_LINE_HEIGHT}, STR_FS_ON_COLOR, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
|
auto oncolor = new ColorPicker(
|
||||||
|
this, rect_t{},
|
||||||
|
[=]() -> int { // getValue
|
||||||
|
return g_model.functionSwitchLedONColor[switchIndex];
|
||||||
|
},
|
||||||
|
[=](int newValue) { // setValue
|
||||||
|
g_model.functionSwitchLedONColor[switchIndex] =
|
||||||
|
(uint32_t)newValue;
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
|
oncolor->setPos(GR_X, 36);
|
||||||
|
#endif //FUNCTION_SWITCHES_RGB_LEDS
|
||||||
|
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "radio_diagcustswitches.h"
|
#include "radio_diagcustswitches.h"
|
||||||
|
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ set(SRC ${SRC}
|
|||||||
hal/switch_driver.cpp
|
hal/switch_driver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(FUNCTION_SWITCHES)
|
||||||
|
set(SRC ${SRC}
|
||||||
|
hal/rgbleds.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (FLEXSW)
|
if (FLEXSW)
|
||||||
# define the number of allowed flexible adc entries used as switch
|
# define the number of allowed flexible adc entries used as switch
|
||||||
add_definitions(-DMAX_FLEX_SWITCHES=${FLEXSW})
|
add_definitions(-DMAX_FLEX_SWITCHES=${FLEXSW})
|
||||||
|
|||||||
@@ -46,3 +46,6 @@ uint32_t abnormalRebootGetCause();
|
|||||||
|
|
||||||
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() \
|
#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() \
|
||||||
(abnormalRebootGetCause() != ARC_None)
|
(abnormalRebootGetCause() != ARC_None)
|
||||||
|
|
||||||
|
#define WAS_RESET_BY_SOFTWARE() \
|
||||||
|
(abnormalRebootGetCause() == ARC_Software)
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "edgetx.h"
|
||||||
|
#include "rgbleds.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
#include "definitions.h"
|
||||||
|
#include "dataconstants.h"
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
void setFSLedOFF(uint8_t index) {
|
||||||
|
fsLedRGB(index, g_model.functionSwitchLedOFFColor[index].getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFSLedON(uint8_t index) {
|
||||||
|
fsLedRGB(index, g_model.functionSwitchLedONColor[index].getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getFSLedState(uint8_t index) {
|
||||||
|
return rgbGetLedColor(index) == g_model.functionSwitchLedONColor[index].getColor();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void setFSLedOFF(uint8_t index) {
|
||||||
|
fsLedOff(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFSLedON(uint8_t index) {
|
||||||
|
fsLedOn(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getFSLedState(uint8_t index) {
|
||||||
|
return fsLedState(index);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
// MUST match TR_FS_COLOR_LIST ( "White", "Red", "Green", "Yellow", "Orange", "Blue", "Pink", "Off", Custom gets display when none previous match
|
||||||
|
constexpr uint32_t colorTable[] = {0xF8F8F8, 0xF80000, 0x00F800, 0xF8F800, 0xF84000, 0x0000F8, 0xF800F8, 0x000000};
|
||||||
|
|
||||||
|
void setFSLedOFF(uint8_t index);
|
||||||
|
void setFSLedON(uint8_t index);
|
||||||
|
bool getFSLedState(uint8_t index);
|
||||||
@@ -114,6 +114,12 @@ void applyDefaultTemplate()
|
|||||||
g_model.functionSwitchGroup = DEFAULT_FS_GROUPS;
|
g_model.functionSwitchGroup = DEFAULT_FS_GROUPS;
|
||||||
g_model.functionSwitchStartConfig = DEFAULT_FS_STARTUP_CONFIG;
|
g_model.functionSwitchStartConfig = DEFAULT_FS_STARTUP_CONFIG;
|
||||||
g_model.functionSwitchLogicalState = 0;
|
g_model.functionSwitchLogicalState = 0;
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
||||||
|
g_model.functionSwitchLedOFFColor[i].setColor(0);
|
||||||
|
g_model.functionSwitchLedONColor[i].setColor(0xFFFFFF);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
|
|||||||
+1
-1
@@ -365,7 +365,7 @@ void OpenTxSim::updateKeysAndSwitches(bool start)
|
|||||||
KEY_Left, KEY_LEFT,
|
KEY_Left, KEY_LEFT,
|
||||||
KEY_Up, KEY_UP,
|
KEY_Up, KEY_UP,
|
||||||
KEY_Down, KEY_DOWN,
|
KEY_Down, KEY_DOWN,
|
||||||
#elif defined(RADIO_TX12) || defined(RADIO_TX12MK2) || defined(RADIO_BOXER) || defined(RADIO_ZORRO) || defined(RADIO_MT12) || defined(RADIO_POCKET)
|
#elif defined(NAVIGATION_X7_TX12)
|
||||||
KEY_Page_Up, KEY_PAGEUP,
|
KEY_Page_Up, KEY_PAGEUP,
|
||||||
KEY_Page_Down, KEY_PAGEDN,
|
KEY_Page_Down, KEY_PAGEDN,
|
||||||
KEY_Return, KEY_ENTER,
|
KEY_Return, KEY_ENTER,
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_tpro.cpp)
|
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_tpro.cpp)
|
||||||
elseif((PCBREV STREQUAL T20) OR (PCBREV STREQUAL T20V2))
|
elseif((PCBREV STREQUAL T20) OR (PCBREV STREQUAL T20V2))
|
||||||
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_t20.cpp)
|
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_t20.cpp)
|
||||||
|
elseif(PCBREV STREQUAL GX12)
|
||||||
|
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_gx12.cpp)
|
||||||
elseif((PCBREV STREQUAL COMMANDO8) OR (PCBREV STREQUAL LR3PRO) OR (PCBREV STREQUAL T8) OR (PCBREV STREQUAL T12) OR (PCBREV STREQUAL TLITE))
|
elseif((PCBREV STREQUAL COMMANDO8) OR (PCBREV STREQUAL LR3PRO) OR (PCBREV STREQUAL T8) OR (PCBREV STREQUAL T12) OR (PCBREV STREQUAL TLITE))
|
||||||
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_xlite.cpp)
|
set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_xlite.cpp)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include "yaml_datastructs_tpro.cpp"
|
#include "yaml_datastructs_tpro.cpp"
|
||||||
#elif defined(RADIO_FAMILY_T20)
|
#elif defined(RADIO_FAMILY_T20)
|
||||||
#include "yaml_datastructs_t20.cpp"
|
#include "yaml_datastructs_t20.cpp"
|
||||||
|
#elif defined(RADIO_GX12)
|
||||||
|
#include "yaml_datastructs_gx12.cpp"
|
||||||
#elif defined(RADIO_COMMANDO8) || defined(RADIO_LR3PRO) || defined(RADIO_T8) || defined(RADIO_T12) || defined(RADIO_TLITE)
|
#elif defined(RADIO_COMMANDO8) || defined(RADIO_LR3PRO) || defined(RADIO_T8) || defined(RADIO_T12) || defined(RADIO_TLITE)
|
||||||
#include "yaml_datastructs_xlite.cpp"
|
#include "yaml_datastructs_xlite.cpp"
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -0,0 +1,898 @@
|
|||||||
|
// generated by generate_yaml.py
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enums first
|
||||||
|
//
|
||||||
|
|
||||||
|
const struct YamlIdStr enum_BacklightMode[] = {
|
||||||
|
{ e_backlight_mode_off, "backlight_mode_off" },
|
||||||
|
{ e_backlight_mode_keys, "backlight_mode_keys" },
|
||||||
|
{ e_backlight_mode_sticks, "backlight_mode_sticks" },
|
||||||
|
{ e_backlight_mode_all, "backlight_mode_all" },
|
||||||
|
{ e_backlight_mode_on, "backlight_mode_on" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_AntennaModes[] = {
|
||||||
|
{ ANTENNA_MODE_INTERNAL, "MODE_INTERNAL" },
|
||||||
|
{ ANTENNA_MODE_ASK, "MODE_ASK" },
|
||||||
|
{ ANTENNA_MODE_PER_MODEL, "MODE_PER_MODEL" },
|
||||||
|
{ ANTENNA_MODE_EXTERNAL, "MODE_EXTERNAL" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_ModuleType[] = {
|
||||||
|
{ MODULE_TYPE_NONE, "TYPE_NONE" },
|
||||||
|
{ MODULE_TYPE_PPM, "TYPE_PPM" },
|
||||||
|
{ MODULE_TYPE_XJT_PXX1, "TYPE_XJT_PXX1" },
|
||||||
|
{ MODULE_TYPE_ISRM_PXX2, "TYPE_ISRM_PXX2" },
|
||||||
|
{ MODULE_TYPE_DSM2, "TYPE_DSM2" },
|
||||||
|
{ MODULE_TYPE_CROSSFIRE, "TYPE_CROSSFIRE" },
|
||||||
|
{ MODULE_TYPE_MULTIMODULE, "TYPE_MULTIMODULE" },
|
||||||
|
{ MODULE_TYPE_R9M_PXX1, "TYPE_R9M_PXX1" },
|
||||||
|
{ MODULE_TYPE_R9M_PXX2, "TYPE_R9M_PXX2" },
|
||||||
|
{ MODULE_TYPE_R9M_LITE_PXX1, "TYPE_R9M_LITE_PXX1" },
|
||||||
|
{ MODULE_TYPE_R9M_LITE_PXX2, "TYPE_R9M_LITE_PXX2" },
|
||||||
|
{ MODULE_TYPE_GHOST, "TYPE_GHOST" },
|
||||||
|
{ MODULE_TYPE_R9M_LITE_PRO_PXX2, "TYPE_R9M_LITE_PRO_PXX2" },
|
||||||
|
{ MODULE_TYPE_SBUS, "TYPE_SBUS" },
|
||||||
|
{ MODULE_TYPE_XJT_LITE_PXX2, "TYPE_XJT_LITE_PXX2" },
|
||||||
|
{ MODULE_TYPE_FLYSKY_AFHDS2A, "TYPE_FLYSKY_AFHDS2A" },
|
||||||
|
{ MODULE_TYPE_FLYSKY_AFHDS3, "TYPE_FLYSKY_AFHDS3" },
|
||||||
|
{ MODULE_TYPE_LEMON_DSMP, "TYPE_LEMON_DSMP" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_TrainerMultiplex[] = {
|
||||||
|
{ TRAINER_OFF, "OFF" },
|
||||||
|
{ TRAINER_ADD, "ADD" },
|
||||||
|
{ TRAINER_REPL, "REPL" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_BeeperMode[] = {
|
||||||
|
{ e_mode_quiet, "mode_quiet" },
|
||||||
|
{ e_mode_alarms, "mode_alarms" },
|
||||||
|
{ e_mode_nokeys, "mode_nokeys" },
|
||||||
|
{ e_mode_all, "mode_all" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_BluetoothModes[] = {
|
||||||
|
{ BLUETOOTH_OFF, "OFF" },
|
||||||
|
{ BLUETOOTH_TELEMETRY, "TELEMETRY" },
|
||||||
|
{ BLUETOOTH_TRAINER, "TRAINER" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_Functions[] = {
|
||||||
|
{ FUNC_OVERRIDE_CHANNEL, "OVERRIDE_CHANNEL" },
|
||||||
|
{ FUNC_TRAINER, "TRAINER" },
|
||||||
|
{ FUNC_INSTANT_TRIM, "INSTANT_TRIM" },
|
||||||
|
{ FUNC_RESET, "RESET" },
|
||||||
|
{ FUNC_SET_TIMER, "SET_TIMER" },
|
||||||
|
{ FUNC_ADJUST_GVAR, "ADJUST_GVAR" },
|
||||||
|
{ FUNC_VOLUME, "VOLUME" },
|
||||||
|
{ FUNC_SET_FAILSAFE, "SET_FAILSAFE" },
|
||||||
|
{ FUNC_RANGECHECK, "RANGECHECK" },
|
||||||
|
{ FUNC_BIND, "BIND" },
|
||||||
|
{ FUNC_PLAY_SOUND, "PLAY_SOUND" },
|
||||||
|
{ FUNC_PLAY_TRACK, "PLAY_TRACK" },
|
||||||
|
{ FUNC_PLAY_VALUE, "PLAY_VALUE" },
|
||||||
|
{ FUNC_PLAY_SCRIPT, "PLAY_SCRIPT" },
|
||||||
|
{ FUNC_BACKGND_MUSIC, "BACKGND_MUSIC" },
|
||||||
|
{ FUNC_BACKGND_MUSIC_PAUSE, "BACKGND_MUSIC_PAUSE" },
|
||||||
|
{ FUNC_VARIO, "VARIO" },
|
||||||
|
{ FUNC_HAPTIC, "HAPTIC" },
|
||||||
|
{ FUNC_LOGS, "LOGS" },
|
||||||
|
{ FUNC_BACKLIGHT, "BACKLIGHT" },
|
||||||
|
{ FUNC_SCREENSHOT, "SCREENSHOT" },
|
||||||
|
{ FUNC_RACING_MODE, "RACING_MODE" },
|
||||||
|
{ FUNC_SET_SCREEN, "SET_SCREEN" },
|
||||||
|
{ FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" },
|
||||||
|
{ FUNC_RGB_LED, "RGB_LED" },
|
||||||
|
{ FUNC_PUSH_CUST_SWITCH, "PUSH_CUST_SWITCH" },
|
||||||
|
{ FUNC_TEST, "TEST" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
|
{ TMRMODE_OFF, "OFF" },
|
||||||
|
{ TMRMODE_ON, "ON" },
|
||||||
|
{ TMRMODE_START, "START" },
|
||||||
|
{ TMRMODE_THR, "THR" },
|
||||||
|
{ TMRMODE_THR_REL, "THR_REL" },
|
||||||
|
{ TMRMODE_THR_START, "THR_START" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_MixerMultiplex[] = {
|
||||||
|
{ MLTPX_ADD, "ADD" },
|
||||||
|
{ MLTPX_MUL, "MUL" },
|
||||||
|
{ MLTPX_REPL, "REPL" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_MixSources[] = {
|
||||||
|
{ MIXSRC_NONE, "NONE" },
|
||||||
|
{ MIXSRC_MIN, "MIN" },
|
||||||
|
{ MIXSRC_MAX, "MAX" },
|
||||||
|
{ MIXSRC_TX_VOLTAGE, "TX_VOLTAGE" },
|
||||||
|
{ MIXSRC_TX_TIME, "TX_TIME" },
|
||||||
|
{ MIXSRC_TX_GPS, "TX_GPS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_LogicalSwitchesFunctions[] = {
|
||||||
|
{ LS_FUNC_NONE, "FUNC_NONE" },
|
||||||
|
{ LS_FUNC_VEQUAL, "FUNC_VEQUAL" },
|
||||||
|
{ LS_FUNC_VALMOSTEQUAL, "FUNC_VALMOSTEQUAL" },
|
||||||
|
{ LS_FUNC_VPOS, "FUNC_VPOS" },
|
||||||
|
{ LS_FUNC_VNEG, "FUNC_VNEG" },
|
||||||
|
{ LS_FUNC_APOS, "FUNC_APOS" },
|
||||||
|
{ LS_FUNC_ANEG, "FUNC_ANEG" },
|
||||||
|
{ LS_FUNC_AND, "FUNC_AND" },
|
||||||
|
{ LS_FUNC_OR, "FUNC_OR" },
|
||||||
|
{ LS_FUNC_XOR, "FUNC_XOR" },
|
||||||
|
{ LS_FUNC_EDGE, "FUNC_EDGE" },
|
||||||
|
{ LS_FUNC_EQUAL, "FUNC_EQUAL" },
|
||||||
|
{ LS_FUNC_GREATER, "FUNC_GREATER" },
|
||||||
|
{ LS_FUNC_LESS, "FUNC_LESS" },
|
||||||
|
{ LS_FUNC_DIFFEGREATER, "FUNC_DIFFEGREATER" },
|
||||||
|
{ LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" },
|
||||||
|
{ LS_FUNC_TIMER, "FUNC_TIMER" },
|
||||||
|
{ LS_FUNC_STICKY, "FUNC_STICKY" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_SwashType[] = {
|
||||||
|
{ SWASH_TYPE_NONE, "TYPE_NONE" },
|
||||||
|
{ SWASH_TYPE_120, "TYPE_120" },
|
||||||
|
{ SWASH_TYPE_120X, "TYPE_120X" },
|
||||||
|
{ SWASH_TYPE_140, "TYPE_140" },
|
||||||
|
{ SWASH_TYPE_90, "TYPE_90" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchSources[] = {
|
||||||
|
{ SWSRC_NONE, "NONE" },
|
||||||
|
{ SWSRC_ON, "ON" },
|
||||||
|
{ SWSRC_ONE, "ONE" },
|
||||||
|
{ SWSRC_TELEMETRY_STREAMING, "TELEMETRY_STREAMING" },
|
||||||
|
{ SWSRC_RADIO_ACTIVITY, "RADIO_ACTIVITY" },
|
||||||
|
{ SWSRC_TRAINER_CONNECTED, "TRAINER_CONNECTED" },
|
||||||
|
{ SWSRC_OFF, "OFF" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_PotsWarnMode[] = {
|
||||||
|
{ POTS_WARN_OFF, "WARN_OFF" },
|
||||||
|
{ POTS_WARN_MANUAL, "WARN_MANUAL" },
|
||||||
|
{ POTS_WARN_AUTO, "WARN_AUTO" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_ModelOverridableEnable[] = {
|
||||||
|
{ OVERRIDE_GLOBAL, "GLOBAL" },
|
||||||
|
{ OVERRIDE_OFF, "OFF" },
|
||||||
|
{ OVERRIDE_ON, "ON" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_FailsafeModes[] = {
|
||||||
|
{ FAILSAFE_NOT_SET, "NOT_SET" },
|
||||||
|
{ FAILSAFE_HOLD, "HOLD" },
|
||||||
|
{ FAILSAFE_CUSTOM, "CUSTOM" },
|
||||||
|
{ FAILSAFE_NOPULSES, "NOPULSES" },
|
||||||
|
{ FAILSAFE_RECEIVER, "RECEIVER" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_TelemetrySensorFormula[] = {
|
||||||
|
{ TELEM_FORMULA_ADD, "FORMULA_ADD" },
|
||||||
|
{ TELEM_FORMULA_AVERAGE, "FORMULA_AVERAGE" },
|
||||||
|
{ TELEM_FORMULA_MIN, "FORMULA_MIN" },
|
||||||
|
{ TELEM_FORMULA_MAX, "FORMULA_MAX" },
|
||||||
|
{ TELEM_FORMULA_MULTIPLY, "FORMULA_MULTIPLY" },
|
||||||
|
{ TELEM_FORMULA_TOTALIZE, "FORMULA_TOTALIZE" },
|
||||||
|
{ TELEM_FORMULA_CELL, "FORMULA_CELL" },
|
||||||
|
{ TELEM_FORMULA_CONSUMPTION, "FORMULA_CONSUMPTION" },
|
||||||
|
{ TELEM_FORMULA_DIST, "FORMULA_DIST" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_TelemetrySensorType[] = {
|
||||||
|
{ TELEM_TYPE_CUSTOM, "TYPE_CUSTOM" },
|
||||||
|
{ TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_USBJoystickIfMode[] = {
|
||||||
|
{ USBJOYS_JOYSTICK, "JOYSTICK" },
|
||||||
|
{ USBJOYS_GAMEPAD, "GAMEPAD" },
|
||||||
|
{ USBJOYS_MULTIAXIS, "MULTIAXIS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_USBJoystickCh[] = {
|
||||||
|
{ USBJOYS_CH_NONE, "CH_NONE" },
|
||||||
|
{ USBJOYS_CH_BUTTON, "CH_BUTTON" },
|
||||||
|
{ USBJOYS_CH_AXIS, "CH_AXIS" },
|
||||||
|
{ USBJOYS_CH_SIM, "CH_SIM" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Structs last
|
||||||
|
//
|
||||||
|
|
||||||
|
static const struct YamlNode struct_CalibData[] = {
|
||||||
|
YAML_IDX_CUST("calib",r_calib,w_calib),
|
||||||
|
YAML_SIGNED( "mid", 16 ),
|
||||||
|
YAML_SIGNED( "spanNeg", 16 ),
|
||||||
|
YAML_SIGNED( "spanPos", 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_signed_16[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_SIGNED( "val", 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
||||||
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TrainerData[] = {
|
||||||
|
YAML_ARRAY("calib", 16, 4, struct_signed_16, NULL),
|
||||||
|
YAML_ARRAY("mix", 16, 4, struct_TrainerMix, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_1[] = {
|
||||||
|
YAML_STRING("name", 8),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_2[] = {
|
||||||
|
YAML_SIGNED( "val", 16 ),
|
||||||
|
YAML_UNSIGNED( "mode", 8 ),
|
||||||
|
YAML_UNSIGNED( "param", 8 ),
|
||||||
|
YAML_SIGNED( "val2", 32 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_3[] = {
|
||||||
|
YAML_SIGNED( "val1", 32 ),
|
||||||
|
YAML_SIGNED( "val2", 32 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_anonymous_0_elmts[] = {
|
||||||
|
YAML_STRUCT("play", 64, struct_anonymous_1, NULL),
|
||||||
|
YAML_STRUCT("all", 64, struct_anonymous_2, NULL),
|
||||||
|
YAML_STRUCT("clear", 64, struct_anonymous_3, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_ENUM("func", 6, enum_Functions),
|
||||||
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
|
YAML_PADDING( 64 ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_PADDING( 7 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
|
YAML_UNSIGNED( "ppmunit", 2 ),
|
||||||
|
YAML_PADDING( 2 ),
|
||||||
|
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||||
|
YAML_CUSTOM("board",nullptr,w_board),
|
||||||
|
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
|
||||||
|
YAML_PADDING( 16 ),
|
||||||
|
YAML_SIGNED( "currModel", 8 ),
|
||||||
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
||||||
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
||||||
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
|
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
||||||
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
|
YAML_PADDING( 2 ),
|
||||||
|
YAML_UNSIGNED( "fai", 1 ),
|
||||||
|
YAML_SIGNED_CUST( "beepMode", 2, r_beeperMode, w_beeperMode ),
|
||||||
|
YAML_UNSIGNED( "alarmsFlash", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableMemoryWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableAlarmWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "stickMode", 2 ),
|
||||||
|
YAML_SIGNED( "timezone", 5 ),
|
||||||
|
YAML_UNSIGNED( "adjustRTC", 1 ),
|
||||||
|
YAML_UNSIGNED( "inactivityTimer", 8 ),
|
||||||
|
YAML_CUSTOM("telemetryBaudrate",r_telemetryBaudrate,nullptr),
|
||||||
|
YAML_UNSIGNED( "internalModuleBaudrate", 3 ),
|
||||||
|
YAML_SIGNED( "splashMode", 3 ),
|
||||||
|
YAML_SIGNED_CUST( "hapticMode", 2, r_beeperMode, w_beeperMode ),
|
||||||
|
YAML_SIGNED( "switchesDelay", 8 ),
|
||||||
|
YAML_UNSIGNED( "lightAutoOff", 8 ),
|
||||||
|
YAML_UNSIGNED( "templateSetup", 8 ),
|
||||||
|
YAML_SIGNED( "PPM_Multiplier", 8 ),
|
||||||
|
YAML_SIGNED_CUST( "hapticLength", 8, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "beepLength", 3, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "hapticStrength", 3, r_5pos, w_5pos ),
|
||||||
|
YAML_UNSIGNED( "gpsFormat", 1 ),
|
||||||
|
YAML_UNSIGNED( "audioMuteEnable", 1 ),
|
||||||
|
YAML_UNSIGNED_CUST( "speakerPitch", 8, r_spPitch, w_spPitch ),
|
||||||
|
YAML_SIGNED_CUST( "speakerVolume", 8, r_vol, w_vol ),
|
||||||
|
YAML_SIGNED_CUST( "vBatMin", 8, r_vbat_min, w_vbat_min ),
|
||||||
|
YAML_SIGNED_CUST( "vBatMax", 8, r_vbat_max, w_vbat_max ),
|
||||||
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
||||||
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
|
YAML_CUSTOM("jitterFilter",r_jitterFilter,nullptr),
|
||||||
|
YAML_UNSIGNED( "noJitterFilter", 1 ),
|
||||||
|
YAML_UNSIGNED( "imperial", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableRssiPoweroffAlarm", 1 ),
|
||||||
|
YAML_UNSIGNED( "USBMode", 2 ),
|
||||||
|
YAML_UNSIGNED( "jackMode", 2 ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_STRING("ttsLanguage", 2),
|
||||||
|
YAML_SIGNED_CUST( "beepVolume", 4, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "wavVolume", 4, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "varioVolume", 4, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "backgroundVolume", 4, r_5pos, w_5pos ),
|
||||||
|
YAML_SIGNED_CUST( "varioPitch", 8, r_vPitch, w_vPitch ),
|
||||||
|
YAML_SIGNED_CUST( "varioRange", 8, r_vPitch, w_vPitch ),
|
||||||
|
YAML_SIGNED( "varioRepeat", 8 ),
|
||||||
|
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
|
||||||
|
YAML_CUSTOM("auxSerialMode",r_serialMode,nullptr),
|
||||||
|
YAML_CUSTOM("aux2SerialMode",r_serialMode,nullptr),
|
||||||
|
YAML_ARRAY("serialPort", 8, 4, struct_serialConfig, nullptr),
|
||||||
|
YAML_ARRAY("sticksConfig", 0, MAX_STICKS, struct_stickConfig, stick_name_valid),
|
||||||
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
|
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
||||||
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
|
YAML_STRING("bluetoothName", 10),
|
||||||
|
YAML_STRING("ownerRegistrationID", 8),
|
||||||
|
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||||
|
YAML_UNSIGNED( "rotEncMode", 3 ),
|
||||||
|
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_UNSIGNED( "radioGFDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "radioTrainerDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelHeliDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelFMDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelCurvesDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelGVDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelLSDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelSFDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelCustomScriptsDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "modelTelemetryDisabled", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableTrainerPoweroffAlarm", 1 ),
|
||||||
|
YAML_UNSIGNED( "disablePwrOnOffHaptic", 1 ),
|
||||||
|
YAML_UNSIGNED( "invertLCD", 1 ),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_UNSIGNED( "pwrOffIfInactive", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_unsigned_8[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "val", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_ModelHeader[] = {
|
||||||
|
YAML_STRING("name", 10),
|
||||||
|
YAML_ARRAY("modelId", 8, 2, struct_unsigned_8, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TimerData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_SIGNED( "value", 22 ),
|
||||||
|
YAML_ENUM("mode", 3, enum_TimerModes),
|
||||||
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
|
YAML_SIGNED( "countdownStart", 2 ),
|
||||||
|
YAML_UNSIGNED( "showElapsed", 1 ),
|
||||||
|
YAML_UNSIGNED( "extraHaptic", 1 ),
|
||||||
|
YAML_PADDING( 6 ),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_CurveRef[] = {
|
||||||
|
YAML_UNSIGNED( "type", 5 ),
|
||||||
|
YAML_SIGNED_CUST( "value", 11, r_sourceNumVal, w_sourceNumVal ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_MixData[] = {
|
||||||
|
YAML_UNSIGNED( "destCh", 5 ),
|
||||||
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
||||||
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ),
|
||||||
|
YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ),
|
||||||
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_STRUCT("curve", 16, struct_CurveRef, NULL),
|
||||||
|
YAML_UNSIGNED( "delayUp", 8 ),
|
||||||
|
YAML_UNSIGNED( "delayDown", 8 ),
|
||||||
|
YAML_UNSIGNED( "speedUp", 8 ),
|
||||||
|
YAML_UNSIGNED( "speedDown", 8 ),
|
||||||
|
YAML_STRING("name", 6),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_LimitData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_SIGNED_CUST( "min", 11, in_read_weight, in_write_weight ),
|
||||||
|
YAML_SIGNED_CUST( "max", 11, in_read_weight, in_write_weight ),
|
||||||
|
YAML_SIGNED( "ppmCenter", 10 ),
|
||||||
|
YAML_SIGNED_CUST( "offset", 11, in_read_weight, in_write_weight ),
|
||||||
|
YAML_UNSIGNED( "symetrical", 1 ),
|
||||||
|
YAML_UNSIGNED( "revert", 1 ),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_SIGNED( "curve", 8 ),
|
||||||
|
YAML_STRING("name", 4),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_ExpoData[] = {
|
||||||
|
YAML_UNSIGNED( "mode", 2 ),
|
||||||
|
YAML_UNSIGNED( "scale", 14 ),
|
||||||
|
YAML_CUSTOM("carryTrim",r_carryTrim,nullptr),
|
||||||
|
YAML_SIGNED( "trimSource", 6 ),
|
||||||
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
|
YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ),
|
||||||
|
YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ),
|
||||||
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_STRUCT("curve", 16, struct_CurveRef, NULL),
|
||||||
|
YAML_UNSIGNED( "chn", 5 ),
|
||||||
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
|
YAML_PADDING( 2 ),
|
||||||
|
YAML_STRING("name", 6),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_CurveHeader[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "type", 1 ),
|
||||||
|
YAML_UNSIGNED( "smooth", 1 ),
|
||||||
|
YAML_SIGNED( "points", 6 ),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_signed_8[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_SIGNED( "val", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
||||||
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
|
YAML_PADDING( 10 ),
|
||||||
|
YAML_PADDING( 10 ),
|
||||||
|
YAML_SIGNED_CUST( "andsw", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_UNSIGNED( "lsPersist", 1 ),
|
||||||
|
YAML_UNSIGNED( "lsState", 1 ),
|
||||||
|
YAML_PADDING( 16 ),
|
||||||
|
YAML_UNSIGNED( "delay", 8 ),
|
||||||
|
YAML_UNSIGNED( "duration", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
|
YAML_ENUM("type", 8, enum_SwashType),
|
||||||
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_UNSIGNED_CUST( "elevatorSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_SIGNED( "collectiveWeight", 8 ),
|
||||||
|
YAML_SIGNED( "aileronWeight", 8 ),
|
||||||
|
YAML_SIGNED( "elevatorWeight", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_trim_t[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_SIGNED( "value", 11 ),
|
||||||
|
YAML_UNSIGNED( "mode", 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_FlightModeData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_ARRAY("trim", 16, 6, struct_trim_t, NULL),
|
||||||
|
YAML_STRING("name", 6),
|
||||||
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_PADDING( 6 ),
|
||||||
|
YAML_UNSIGNED( "fadeIn", 8 ),
|
||||||
|
YAML_UNSIGNED( "fadeOut", 8 ),
|
||||||
|
YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_GVarData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_UNSIGNED( "min", 12 ),
|
||||||
|
YAML_UNSIGNED( "max", 12 ),
|
||||||
|
YAML_UNSIGNED( "popup", 1 ),
|
||||||
|
YAML_UNSIGNED( "prec", 1 ),
|
||||||
|
YAML_UNSIGNED( "unit", 2 ),
|
||||||
|
YAML_PADDING( 4 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_VarioData[] = {
|
||||||
|
YAML_UNSIGNED_CUST( "source", 7, r_tele_sensor, w_tele_sensor ),
|
||||||
|
YAML_UNSIGNED( "centerSilent", 1 ),
|
||||||
|
YAML_SIGNED( "centerMax", 8 ),
|
||||||
|
YAML_SIGNED( "centerMin", 8 ),
|
||||||
|
YAML_SIGNED( "min", 8 ),
|
||||||
|
YAML_SIGNED( "max", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_RssiAlarmData[] = {
|
||||||
|
YAML_CUSTOM("disabled",r_rssiDisabled,nullptr),
|
||||||
|
YAML_CUSTOM("warning",r_rssiWarning,nullptr),
|
||||||
|
YAML_CUSTOM("critical",r_rssiCritical,nullptr),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_RFAlarmData[] = {
|
||||||
|
YAML_SIGNED( "warning", 8 ),
|
||||||
|
YAML_SIGNED( "critical", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_PpmModule[] = {
|
||||||
|
YAML_SIGNED( "delay", 6 ),
|
||||||
|
YAML_UNSIGNED( "pulsePol", 1 ),
|
||||||
|
YAML_UNSIGNED( "outputType", 1 ),
|
||||||
|
YAML_SIGNED( "frameLength", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_5[] = {
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
|
YAML_UNSIGNED( "disableTelemetry", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableMapping", 1 ),
|
||||||
|
YAML_UNSIGNED( "autoBindMode", 1 ),
|
||||||
|
YAML_UNSIGNED( "lowPowerMode", 1 ),
|
||||||
|
YAML_UNSIGNED( "receiverTelemetryOff", 1 ),
|
||||||
|
YAML_UNSIGNED( "receiverHigherChannels", 1 ),
|
||||||
|
YAML_PADDING( 2 ),
|
||||||
|
YAML_SIGNED( "optionValue", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_6[] = {
|
||||||
|
YAML_UNSIGNED( "power", 2 ),
|
||||||
|
YAML_PADDING( 2 ),
|
||||||
|
YAML_UNSIGNED( "receiverTelemetryOff", 1 ),
|
||||||
|
YAML_UNSIGNED( "receiverHigherChannels", 1 ),
|
||||||
|
YAML_SIGNED( "antennaMode", 2 ),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_7[] = {
|
||||||
|
YAML_PADDING( 6 ),
|
||||||
|
YAML_UNSIGNED( "noninverted", 1 ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_SIGNED( "refreshRate", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_string_64[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_STRING("val", 8),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_8[] = {
|
||||||
|
YAML_UNSIGNED( "receivers", 7 ),
|
||||||
|
YAML_UNSIGNED( "racingMode", 1 ),
|
||||||
|
YAML_ARRAY("receiverName", 64, 3, struct_string_64, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_9[] = {
|
||||||
|
YAML_ARRAY("rx_id", 8, 4, struct_unsigned_8, NULL),
|
||||||
|
YAML_UNSIGNED( "mode", 3 ),
|
||||||
|
YAML_UNSIGNED( "rfPower", 1 ),
|
||||||
|
YAML_UNSIGNED( "reserved", 4 ),
|
||||||
|
YAML_ARRAY("rx_freq", 8, 2, struct_unsigned_8, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_10[] = {
|
||||||
|
YAML_UNSIGNED( "emi", 2 ),
|
||||||
|
YAML_UNSIGNED( "telemetry", 1 ),
|
||||||
|
YAML_UNSIGNED( "phyMode", 3 ),
|
||||||
|
YAML_UNSIGNED( "reserved", 2 ),
|
||||||
|
YAML_UNSIGNED( "rfPower", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_11[] = {
|
||||||
|
YAML_UNSIGNED( "raw12bits", 1 ),
|
||||||
|
YAML_UNSIGNED( "telemetryBaudrate", 3 ),
|
||||||
|
YAML_PADDING( 4 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_12[] = {
|
||||||
|
YAML_UNSIGNED( "telemetryBaudrate", 3 ),
|
||||||
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
|
YAML_PADDING( 4 ),
|
||||||
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
YAML_UNSIGNED( "flags", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_anonymous_4_elmts[] = {
|
||||||
|
YAML_ARRAY("raw", 8, 25, struct_unsigned_8, NULL),
|
||||||
|
YAML_STRUCT("ppm", 16, struct_PpmModule, NULL),
|
||||||
|
YAML_STRUCT("multi", 24, struct_anonymous_5, NULL),
|
||||||
|
YAML_STRUCT("pxx", 16, struct_anonymous_6, NULL),
|
||||||
|
YAML_STRUCT("sbus", 16, struct_anonymous_7, NULL),
|
||||||
|
YAML_STRUCT("pxx2", 200, struct_anonymous_8, NULL),
|
||||||
|
YAML_STRUCT("flysky", 56, struct_anonymous_9, NULL),
|
||||||
|
YAML_STRUCT("afhds3", 16, struct_anonymous_10, NULL),
|
||||||
|
YAML_STRUCT("ghost", 8, struct_anonymous_11, NULL),
|
||||||
|
YAML_STRUCT("crsf", 24, struct_anonymous_12, NULL),
|
||||||
|
YAML_STRUCT("dsmp", 8, struct_anonymous_13, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_ModuleData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED_CUST( "type", 8, r_moduleType, w_moduleType ),
|
||||||
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
||||||
|
YAML_PADDING( 4 ),
|
||||||
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TrainerModuleData[] = {
|
||||||
|
YAML_UNSIGNED_CUST( "mode", 8, r_trainerMode, w_trainerMode ),
|
||||||
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
|
YAML_SIGNED( "channelsCount", 8 ),
|
||||||
|
YAML_SIGNED( "frameLength", 8 ),
|
||||||
|
YAML_SIGNED( "delay", 6 ),
|
||||||
|
YAML_UNSIGNED( "pulsePol", 1 ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_ScriptDataInput_elmts[] = {
|
||||||
|
YAML_SIGNED( "value", 16 ),
|
||||||
|
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_ScriptDataInput[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNION("u", 16, union_ScriptDataInput_elmts, select_script_input),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_ScriptData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_STRING("file", 6),
|
||||||
|
YAML_STRING("name", 6),
|
||||||
|
YAML_ARRAY("inputs", 16, 6, union_ScriptDataInput, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_string_24[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_STRING("val", 3),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_anonymous_14_elmts[] = {
|
||||||
|
YAML_UNSIGNED( "id", 16 ),
|
||||||
|
YAML_UNSIGNED( "persistentValue", 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_16[] = {
|
||||||
|
YAML_UNSIGNED( "physID", 5 ),
|
||||||
|
YAML_UNSIGNED( "rxIndex", 3 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
|
YAML_UNSIGNED( "ratio", 16 ),
|
||||||
|
YAML_SIGNED( "offset", 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_19[] = {
|
||||||
|
YAML_UNSIGNED( "source", 8 ),
|
||||||
|
YAML_UNSIGNED( "index", 8 ),
|
||||||
|
YAML_PADDING( 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_20[] = {
|
||||||
|
YAML_ARRAY("sources", 8, 4, struct_signed_8, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_21[] = {
|
||||||
|
YAML_UNSIGNED( "source", 8 ),
|
||||||
|
YAML_PADDING( 24 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_anonymous_22[] = {
|
||||||
|
YAML_UNSIGNED( "gps", 8 ),
|
||||||
|
YAML_UNSIGNED( "alt", 8 ),
|
||||||
|
YAML_PADDING( 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_anonymous_17_elmts[] = {
|
||||||
|
YAML_STRUCT("custom", 32, struct_anonymous_18, NULL),
|
||||||
|
YAML_STRUCT("cell", 32, struct_anonymous_19, NULL),
|
||||||
|
YAML_STRUCT("calc", 32, struct_anonymous_20, NULL),
|
||||||
|
YAML_STRUCT("consumption", 32, struct_anonymous_21, NULL),
|
||||||
|
YAML_STRUCT("dist", 32, struct_anonymous_22, NULL),
|
||||||
|
YAML_UNSIGNED( "param", 32 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TelemetrySensor[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNION("id1", 16, union_anonymous_14_elmts, select_id1),
|
||||||
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
|
YAML_STRING("label", 4),
|
||||||
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
|
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
|
YAML_UNSIGNED( "autoOffset", 1 ),
|
||||||
|
YAML_UNSIGNED( "filter", 1 ),
|
||||||
|
YAML_UNSIGNED( "logs", 1 ),
|
||||||
|
YAML_UNSIGNED( "persistent", 1 ),
|
||||||
|
YAML_UNSIGNED( "onlyPositive", 1 ),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_FrSkyBarData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_SIGNED( "barMin", 16 ),
|
||||||
|
YAML_SIGNED( "barMax", 16 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_LineDataSource[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED_CUST( "val", 16, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_FrSkyLineData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_ARRAY("sources", 16, 2, struct_LineDataSource, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TelemetryScriptData[] = {
|
||||||
|
YAML_STRING("file", 6),
|
||||||
|
YAML_ARRAY("inputs", 16, 8, struct_signed_16, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode union_TelemetryScreenData_u_elmts[] = {
|
||||||
|
YAML_ARRAY("bars", 48, 4, struct_FrSkyBarData, NULL),
|
||||||
|
YAML_ARRAY("lines", 32, 4, struct_FrSkyLineData, NULL),
|
||||||
|
YAML_STRUCT("script", 176, struct_TelemetryScriptData, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_TelemetryScreenData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_CUSTOM("type",r_tele_screen_type,w_tele_screen_type),
|
||||||
|
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_RGBLedColor[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "r", 8 ),
|
||||||
|
YAML_UNSIGNED( "g", 8 ),
|
||||||
|
YAML_UNSIGNED( "b", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
||||||
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
|
YAML_UNSIGNED( "switch_npos", 3 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_ModelData[] = {
|
||||||
|
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||||
|
YAML_STRUCT("header", 96, struct_ModelHeader, NULL),
|
||||||
|
YAML_ARRAY("timers", 96, 3, struct_TimerData, NULL),
|
||||||
|
YAML_UNSIGNED( "telemetryProtocol", 3 ),
|
||||||
|
YAML_UNSIGNED( "thrTrim", 1 ),
|
||||||
|
YAML_UNSIGNED( "noGlobalFunctions", 1 ),
|
||||||
|
YAML_UNSIGNED( "displayTrims", 2 ),
|
||||||
|
YAML_UNSIGNED( "ignoreSensorIds", 1 ),
|
||||||
|
YAML_SIGNED( "trimInc", 3 ),
|
||||||
|
YAML_UNSIGNED( "disableThrottleWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "displayChecklist", 1 ),
|
||||||
|
YAML_UNSIGNED( "extendedLimits", 1 ),
|
||||||
|
YAML_UNSIGNED( "extendedTrims", 1 ),
|
||||||
|
YAML_UNSIGNED( "throttleReversed", 1 ),
|
||||||
|
YAML_UNSIGNED( "enableCustomThrottleWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||||
|
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||||
|
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||||
|
YAML_PADDING( 4 ),
|
||||||
|
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||||
|
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||||
|
YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL),
|
||||||
|
YAML_ARRAY("limitData", 88, 32, struct_LimitData, NULL),
|
||||||
|
YAML_ARRAY("expoData", 144, 64, struct_ExpoData, NULL),
|
||||||
|
YAML_ARRAY("curves", 32, 32, struct_CurveHeader, NULL),
|
||||||
|
YAML_ARRAY("points", 8, 512, struct_signed_8, NULL),
|
||||||
|
YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL),
|
||||||
|
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
|
||||||
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
|
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
||||||
|
YAML_PADDING(1),
|
||||||
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
||||||
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
|
YAML_STRUCT("trainerData", 40, struct_TrainerModuleData, NULL),
|
||||||
|
YAML_ARRAY("scriptsData", 192, 7, struct_ScriptData, NULL),
|
||||||
|
YAML_ARRAY("inputNames", 24, 32, struct_string_24, NULL),
|
||||||
|
YAML_UNSIGNED( "potsWarnEnabled", 8 ),
|
||||||
|
YAML_ARRAY("potsWarnPosition", 8, 8, struct_signed_8, NULL),
|
||||||
|
YAML_ARRAY("telemetrySensors", 112, 40, struct_TelemetrySensor, NULL),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
|
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
||||||
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
|
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
||||||
|
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
||||||
|
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
||||||
|
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
||||||
|
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
||||||
|
YAML_ARRAY("functionSwitchLedONColor", 24, 6, struct_RGBLedColor, NULL),
|
||||||
|
YAML_ARRAY("functionSwitchLedOFFColor", 24, 6, struct_RGBLedColor, NULL),
|
||||||
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
||||||
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
YAML_STRUCT("header", 96, struct_ModelHeader, NULL),
|
||||||
|
YAML_ARRAY("timers", 96, 3, struct_TimerData, NULL),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_RADIODATA_MODELDATA_PARTIALMODEL_STR_LEN 29
|
||||||
|
|
||||||
|
static const struct YamlNode __RadioData_root_node = YAML_ROOT( struct_RadioData );
|
||||||
|
|
||||||
|
const YamlNode* get_radiodata_nodes()
|
||||||
|
{
|
||||||
|
return &__RadioData_root_node;
|
||||||
|
}
|
||||||
|
static const struct YamlNode __ModelData_root_node = YAML_ROOT( struct_ModelData );
|
||||||
|
|
||||||
|
const YamlNode* get_modeldata_nodes()
|
||||||
|
{
|
||||||
|
return &__ModelData_root_node;
|
||||||
|
}
|
||||||
|
static const struct YamlNode __PartialModel_root_node = YAML_ROOT( struct_PartialModel );
|
||||||
|
|
||||||
|
const YamlNode* get_partialmodel_nodes()
|
||||||
|
{
|
||||||
|
return &__PartialModel_root_node;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -630,7 +630,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ static const struct YamlNode struct_anonymous_12[] = {
|
|||||||
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
YAML_UNSIGNED( "crsfArmingMode", 1 ),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_PADDING( 6 ),
|
YAML_SIGNED( "spare3", 6 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_13[] = {
|
static const struct YamlNode struct_anonymous_13[] = {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "hal/adc_driver.h"
|
#include "hal/adc_driver.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
|
||||||
#include "myeeprom.h"
|
#include "myeeprom.h"
|
||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
@@ -168,7 +169,7 @@ void evalFunctionSwitches()
|
|||||||
uint8_t fct_switches = switchGetMaxFctSwitches();
|
uint8_t fct_switches = switchGetMaxFctSwitches();
|
||||||
for (uint8_t i = 0; i < fct_switches; i++) {
|
for (uint8_t i = 0; i < fct_switches; i++) {
|
||||||
if (FSWITCH_CONFIG(i) == SWITCH_NONE) {
|
if (FSWITCH_CONFIG(i) == SWITCH_NONE) {
|
||||||
fsLedOff(i);
|
setFSLedOFF(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,9 +203,9 @@ void evalFunctionSwitches()
|
|||||||
|
|
||||||
if (!pwrPressed()) {
|
if (!pwrPressed()) {
|
||||||
if (getFSLogicalState(i))
|
if (getFSLogicalState(i))
|
||||||
fsLedOn(i);
|
setFSLedON(i);
|
||||||
else
|
else
|
||||||
fsLedOff(i);
|
setFSLedOFF(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,5 +106,7 @@ extern uint8_t functionSwitchFunctionState;
|
|||||||
//led_driver.cpp
|
//led_driver.cpp
|
||||||
void fsLedOff(uint8_t);
|
void fsLedOff(uint8_t);
|
||||||
void fsLedOn(uint8_t);
|
void fsLedOn(uint8_t);
|
||||||
bool getFSLedState(uint8_t index);
|
bool fsLedState(uint8_t index);
|
||||||
|
void fsLedRGB(uint8_t, uint32_t color);
|
||||||
|
uint8_t getRGBColorIndex(uint32_t color);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
static const stm32_usart_t fsUSART = {
|
static const stm32_usart_t fsUSART = {
|
||||||
.USARTx = FLYSKY_HALL_SERIAL_USART,
|
.USARTx = FLYSKY_HALL_SERIAL_USART,
|
||||||
.txGPIO = GPIO_UNDEF,
|
.txGPIO = FLYSKY_HALL_SERIAL_TX_GPIO,
|
||||||
.rxGPIO = FLYSKY_HALL_SERIAL_RX_GPIO,
|
.rxGPIO = FLYSKY_HALL_SERIAL_RX_GPIO,
|
||||||
.IRQn = FLYSKY_HALL_SERIAL_USART_IRQn,
|
.IRQn = FLYSKY_HALL_SERIAL_USART_IRQn,
|
||||||
.IRQ_Prio = 6,
|
.IRQ_Prio = 4,
|
||||||
.txDMA = nullptr,
|
.txDMA = nullptr,
|
||||||
.txDMA_Stream = 0,
|
.txDMA_Stream = 0,
|
||||||
.txDMA_Channel = 0,
|
.txDMA_Channel = 0,
|
||||||
@@ -49,6 +49,13 @@ static const stm32_usart_t fsUSART = {
|
|||||||
|
|
||||||
DEFINE_STM32_SERIAL_PORT(FSGimbal, fsUSART, HALLSTICK_BUFF_SIZE, 0);
|
DEFINE_STM32_SERIAL_PORT(FSGimbal, fsUSART, HALLSTICK_BUFF_SIZE, 0);
|
||||||
|
|
||||||
|
static const etx_serial_port_t _fs_gimbal_serial_port = {
|
||||||
|
.name = "gimbals",
|
||||||
|
.uart = &STM32SerialDriver,
|
||||||
|
.hw_def = REF_STM32_SERIAL_PORT(FSGimbal),
|
||||||
|
.set_pwr = nullptr,
|
||||||
|
};
|
||||||
|
|
||||||
static STRUCT_HALL HallProtocol = { 0 };
|
static STRUCT_HALL HallProtocol = { 0 };
|
||||||
|
|
||||||
static void* _fs_usart_ctx = nullptr;
|
static void* _fs_usart_ctx = nullptr;
|
||||||
@@ -150,7 +157,7 @@ static void flysky_gimbal_loop(void*)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flysky_gimbal_deinit()
|
void flysky_gimbal_deinit()
|
||||||
{
|
{
|
||||||
STM32SerialDriver.deinit(_fs_usart_ctx);
|
STM32SerialDriver.deinit(_fs_usart_ctx);
|
||||||
}
|
}
|
||||||
@@ -181,3 +188,8 @@ bool flysky_gimbal_init()
|
|||||||
flysky_gimbal_deinit();
|
flysky_gimbal_deinit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const etx_serial_port_t* flysky_gimbal_get_port()
|
||||||
|
{
|
||||||
|
return &_fs_gimbal_serial_port;
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "hal/serial_port.h"
|
||||||
|
|
||||||
#define HALLSTICK_BUFF_SIZE ( 512 )
|
#define HALLSTICK_BUFF_SIZE ( 512 )
|
||||||
#define FLYSKY_HALL_BAUDRATE ( 921600 )
|
#define FLYSKY_HALL_BAUDRATE ( 921600 )
|
||||||
#define FLYSKY_HALL_CHANNEL_COUNT ( 4 )
|
#define FLYSKY_HALL_CHANNEL_COUNT ( 4 )
|
||||||
@@ -124,3 +128,5 @@ extern unsigned short hall_adc_values[FLYSKY_HALL_CHANNEL_COUNT];
|
|||||||
// returns true if the gimbals were detected properly
|
// returns true if the gimbals were detected properly
|
||||||
bool flysky_gimbal_init();
|
bool flysky_gimbal_init();
|
||||||
|
|
||||||
|
void flysky_gimbal_deinit();
|
||||||
|
const etx_serial_port_t* flysky_gimbal_get_port();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#define GPIO_UNDEF (0xffffffff)
|
#define GPIO_UNDEF (0xffffffff)
|
||||||
|
|
||||||
// #define GPIO_PIN(x, y) ((GPIOA_BASE + (x << 10)) | y)
|
// #define GPIO_PIN(x, y) ((GPIOA_BASE + (x << 10)) | y)
|
||||||
#define GPIO_PIN(x, y) ((intptr_t)x | y)
|
#define GPIO_PIN(x, y) ((uintptr_t)x | y)
|
||||||
|
|
||||||
// Generate GPIO mode bitfields
|
// Generate GPIO mode bitfields
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -231,6 +231,22 @@ void ws2812_set_color(uint8_t led, uint8_t r, uint8_t g, uint8_t b)
|
|||||||
pixel[_b_offset] = b;
|
pixel[_b_offset] = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t ws2812_get_color(uint8_t led)
|
||||||
|
{
|
||||||
|
if (led >= _led_strip_len) return 0;
|
||||||
|
|
||||||
|
uint8_t* pixel = &_led_colors[led * WS2812_BYTES_PER_LED];
|
||||||
|
return (pixel[1] << 16) + (pixel[0] << 8) + pixel[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ws2812_get_state(uint8_t led)
|
||||||
|
{
|
||||||
|
if (led >= _led_strip_len) return false;
|
||||||
|
|
||||||
|
uint8_t* pixel = &_led_colors[led * WS2812_BYTES_PER_LED];
|
||||||
|
return pixel[0] || pixel[1] || pixel[2];
|
||||||
|
}
|
||||||
|
|
||||||
void ws2812_update(const stm32_pulse_timer_t* tim)
|
void ws2812_update(const stm32_pulse_timer_t* tim)
|
||||||
{
|
{
|
||||||
WS2812_DBG_HIGH;
|
WS2812_DBG_HIGH;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
void ws2812_init(const stm32_pulse_timer_t* timer, uint8_t strip_len, uint8_t type);
|
void ws2812_init(const stm32_pulse_timer_t* timer, uint8_t strip_len, uint8_t type);
|
||||||
void ws2812_update(const stm32_pulse_timer_t* timer);
|
void ws2812_update(const stm32_pulse_timer_t* timer);
|
||||||
|
bool ws2812_get_state(uint8_t led);
|
||||||
void ws2812_dma_isr(const stm32_pulse_timer_t* timer);
|
void ws2812_dma_isr(const stm32_pulse_timer_t* timer);
|
||||||
|
|
||||||
void ws2812_set_color(uint8_t led, uint8_t r, uint8_t g, uint8_t b);
|
void ws2812_set_color(uint8_t led, uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
uint32_t ws2812_get_color(uint8_t led);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "hal/rotary_encoder.h"
|
#include "hal/rotary_encoder.h"
|
||||||
#include "hal/usb_driver.h"
|
#include "hal/usb_driver.h"
|
||||||
#include "hal/gpio.h"
|
#include "hal/gpio.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "boards/generic_stm32/module_ports.h"
|
#include "boards/generic_stm32/module_ports.h"
|
||||||
@@ -127,7 +128,7 @@ void boardInit()
|
|||||||
board_set_bor_level();
|
board_set_bor_level();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES) && !defined(DEBUG)
|
#if defined(MANUFACTURER_JUMPER) && defined(FUNCTION_SWITCHES) && !defined(DEBUG)
|
||||||
// This is needed to prevent radio from starting when usb is plugged to charge
|
// This is needed to prevent radio from starting when usb is plugged to charge
|
||||||
usbInit();
|
usbInit();
|
||||||
// prime debounce state...
|
// prime debounce state...
|
||||||
|
|||||||
@@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
#include "hal/gpio.h"
|
#include "hal/gpio.h"
|
||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "colors.h"
|
||||||
|
|
||||||
void ledInit()
|
void ledInit()
|
||||||
{
|
{
|
||||||
@@ -39,7 +40,7 @@ void ledInit()
|
|||||||
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES) && !defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
gpio_init(FSLED_GPIO_1, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(FSLED_GPIO_1, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
gpio_init(FSLED_GPIO_2, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(FSLED_GPIO_2, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
gpio_init(FSLED_GPIO_3, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(FSLED_GPIO_3, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
@@ -50,7 +51,23 @@ void ledInit()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
// used to map switch number to led number in the rgbled chain
|
||||||
|
uint8_t ledMapping[] = {1, 2, 3, 4, 5, 6};
|
||||||
|
|
||||||
|
void fsLedOff(uint8_t index, uint32_t color)
|
||||||
|
{
|
||||||
|
rgbSetLedColor(ledMapping[index], GET_RED(color), \
|
||||||
|
GET_GREEN(color),GET_BLUE(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
void fsLedOn(uint8_t index, uint32_t color)
|
||||||
|
{
|
||||||
|
rgbSetLedColor(ledMapping[index], GET_RED(color), \
|
||||||
|
GET_GREEN(color),GET_BLUE(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(FUNCTION_SWITCHES)
|
||||||
gpio_t fsLeds[] = {FSLED_GPIO_1, FSLED_GPIO_2,
|
gpio_t fsLeds[] = {FSLED_GPIO_1, FSLED_GPIO_2,
|
||||||
FSLED_GPIO_3, FSLED_GPIO_4,
|
FSLED_GPIO_3, FSLED_GPIO_4,
|
||||||
FSLED_GPIO_5, FSLED_GPIO_6};
|
FSLED_GPIO_5, FSLED_GPIO_6};
|
||||||
@@ -65,7 +82,7 @@ void fsLedOn(uint8_t index)
|
|||||||
gpio_set(fsLeds[index]);
|
gpio_set(fsLeds[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getFSLedState(uint8_t index)
|
bool fsLedState(uint8_t index)
|
||||||
{
|
{
|
||||||
return (gpio_read(fsLeds[index]));
|
return (gpio_read(fsLeds[index]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
|
||||||
bool usbChargerLed() { return true; }
|
bool usbChargerLed() { return true; }
|
||||||
void ledRed() {}
|
void ledRed() {}
|
||||||
@@ -28,6 +29,33 @@ void ledBlue() {}
|
|||||||
void ledOff() {}
|
void ledOff() {}
|
||||||
void fsLedOn(uint8_t) {}
|
void fsLedOn(uint8_t) {}
|
||||||
void fsLedOff(uint8_t) {}
|
void fsLedOff(uint8_t) {}
|
||||||
bool getFSLedState(uint8_t) { return false;}
|
void fsLedRGB(uint8_t, uint32_t) {}
|
||||||
|
bool fsLedState(uint8_t) { return false;}
|
||||||
void rgbSetLedColor(unsigned char, unsigned char, unsigned char, unsigned char) {}
|
void rgbSetLedColor(unsigned char, unsigned char, unsigned char, unsigned char) {}
|
||||||
void rgbLedColorApply() {}
|
void rgbLedColorApply() {}
|
||||||
|
|
||||||
|
uint8_t getRGBColorIndex(uint32_t color)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < (sizeof(colorTable) / sizeof(colorTable[0])); i++) {
|
||||||
|
if (color == colorTable[i])
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
return 5; // Custom value set with Companion
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGB
|
||||||
|
#define WS2812_BYTES_PER_LED 3
|
||||||
|
|
||||||
|
// Maximum number of supported LEDs
|
||||||
|
#if !defined(WS2812_MAX_LEDS)
|
||||||
|
# define WS2812_MAX_LEDS 48
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Pixel values
|
||||||
|
static uint8_t _led_colors[WS2812_BYTES_PER_LED * WS2812_MAX_LEDS];
|
||||||
|
|
||||||
|
uint32_t rgbGetLedColor(uint8_t led)
|
||||||
|
{
|
||||||
|
uint8_t* pixel = &_led_colors[led * WS2812_BYTES_PER_LED];
|
||||||
|
return (pixel[1] << 16) + (pixel[0] << 8) + pixel[2];
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ option(INTERNAL_MODULE_PPM "Support for PPM internal module" OFF)
|
|||||||
option(AUTOUPDATE "Auto update internal chips from SD" OFF)
|
option(AUTOUPDATE "Auto update internal chips from SD" OFF)
|
||||||
option(BIND_KEY "Enable bind button" OFF)
|
option(BIND_KEY "Enable bind button" OFF)
|
||||||
option(BLUETOOTH "FrSky BT module support" OFF)
|
option(BLUETOOTH "FrSky BT module support" OFF)
|
||||||
|
option(RGBLEDS "WS2812 addressable LED support" OFF)
|
||||||
|
|
||||||
set(USE_RTC_CLOCK YES)
|
set(USE_RTC_CLOCK YES)
|
||||||
set(HARDWARE_EXTERNAL_MODULE YES)
|
set(HARDWARE_EXTERNAL_MODULE YES)
|
||||||
@@ -122,7 +123,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(FLAVOUR tpro)
|
set(FLAVOUR tpro)
|
||||||
set(ROTARY_ENCODER YES)
|
set(ROTARY_ENCODER YES)
|
||||||
set(CPU_TYPE_FULL STM32F205xE)
|
set(CPU_TYPE_FULL STM32F205xE)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
set(FUNCTION_SWITCHES ON)
|
||||||
add_definitions(-DRADIO_TPRO)
|
add_definitions(-DRADIO_TPRO)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||||
@@ -133,7 +134,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(FLAVOUR tprov2)
|
set(FLAVOUR tprov2)
|
||||||
set(CPU_TYPE_FULL STM32F407xE)
|
set(CPU_TYPE_FULL STM32F407xE)
|
||||||
set(ROTARY_ENCODER YES)
|
set(ROTARY_ENCODER YES)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
set(FUNCTION_SWITCHES ON)
|
||||||
add_definitions(-DRADIO_TPROV2)
|
add_definitions(-DRADIO_TPROV2)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||||
@@ -156,7 +157,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(NAVIGATION_TYPE x7)
|
set(NAVIGATION_TYPE x7)
|
||||||
set(CPU_TYPE_FULL STM32F407xG)
|
set(CPU_TYPE_FULL STM32F407xG)
|
||||||
set(ROTARY_ENCODER YES)
|
set(ROTARY_ENCODER YES)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
set(FUNCTION_SWITCHES YES)
|
||||||
add_definitions(-DRADIO_BUMBLEBEE)
|
add_definitions(-DRADIO_BUMBLEBEE)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||||
@@ -192,7 +193,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(ROTARY_ENCODER YES)
|
set(ROTARY_ENCODER YES)
|
||||||
set(CPU_TYPE_FULL STM32F407xE)
|
set(CPU_TYPE_FULL STM32F407xE)
|
||||||
set(FLYSKY_GIMBAL ON)
|
set(FLYSKY_GIMBAL ON)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
set(FUNCTION_SWITCHES ON)
|
||||||
add_definitions(-DRADIO_T20)
|
add_definitions(-DRADIO_T20)
|
||||||
add_definitions(-DRADIO_FAMILY_T20)
|
add_definitions(-DRADIO_FAMILY_T20)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
@@ -206,7 +207,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
set(CPU_TYPE_FULL STM32F407xG)
|
set(CPU_TYPE_FULL STM32F407xG)
|
||||||
set(FLYSKY_GIMBAL ON)
|
set(FLYSKY_GIMBAL ON)
|
||||||
set(PXX2 ON)
|
set(PXX2 ON)
|
||||||
add_definitions(-DFUNCTION_SWITCHES)
|
set(FUNCTION_SWITCHES ON)
|
||||||
add_definitions(-DRADIO_T20V2)
|
add_definitions(-DRADIO_T20V2)
|
||||||
add_definitions(-DRADIO_FAMILY_T20)
|
add_definitions(-DRADIO_FAMILY_T20)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
@@ -285,6 +286,7 @@ elseif(PCB STREQUAL X7)
|
|||||||
if (NOT BLUETOOTH)
|
if (NOT BLUETOOTH)
|
||||||
set(AUX_SERIAL ON)
|
set(AUX_SERIAL ON)
|
||||||
endif()
|
endif()
|
||||||
|
set(RGBLEDS YES)
|
||||||
elseif(PCBREV STREQUAL BOXER)
|
elseif(PCBREV STREQUAL BOXER)
|
||||||
set(DEFAULT_INTERNAL_MODULE CROSSFIRE CACHE STRING "Default internal module")
|
set(DEFAULT_INTERNAL_MODULE CROSSFIRE CACHE STRING "Default internal module")
|
||||||
set(INTERNAL_MODULE_SERIAL YES)
|
set(INTERNAL_MODULE_SERIAL YES)
|
||||||
@@ -301,6 +303,24 @@ elseif(PCB STREQUAL X7)
|
|||||||
if (NOT BLUETOOTH)
|
if (NOT BLUETOOTH)
|
||||||
set(AUX_SERIAL ON)
|
set(AUX_SERIAL ON)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(PCBREV STREQUAL GX12)
|
||||||
|
set(DEFAULT_INTERNAL_MODULE CROSSFIRE CACHE STRING "Default internal module")
|
||||||
|
set(INTERNAL_MODULE_SERIAL YES)
|
||||||
|
set(MODULE_SIZE_SML YES)
|
||||||
|
set(FLAVOUR gx12)
|
||||||
|
set(NAVIGATION_TYPE x7)
|
||||||
|
set(CPU_TYPE_FULL STM32F407xG)
|
||||||
|
set(ROTARY_ENCODER YES)
|
||||||
|
set(USB_CHARGER YES)
|
||||||
|
add_definitions(-DRADIO_GX12)
|
||||||
|
add_definitions(-DMANUFACTURER_RADIOMASTER)
|
||||||
|
set(PXX2 ON)
|
||||||
|
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||||
|
set(FLYSKY_GIMBAL TES)
|
||||||
|
set(AUX_SERIAL ON)
|
||||||
|
set(AUX2_SERIAL OFF)
|
||||||
|
set(RGBLEDS YES)
|
||||||
|
set(FUNCTION_SWITCHES_WITH_RGB YES)
|
||||||
elseif(PCBREV STREQUAL ZORRO)
|
elseif(PCBREV STREQUAL ZORRO)
|
||||||
set(DEFAULT_INTERNAL_MODULE CROSSFIRE CACHE STRING "Default internal module")
|
set(DEFAULT_INTERNAL_MODULE CROSSFIRE CACHE STRING "Default internal module")
|
||||||
set(INTERNAL_MODULE_SERIAL YES)
|
set(INTERNAL_MODULE_SERIAL YES)
|
||||||
@@ -533,6 +553,15 @@ else()
|
|||||||
message(FATAL_ERROR "Unknown CPU_TYPE_FULL" )
|
message(FATAL_ERROR "Unknown CPU_TYPE_FULL" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(FUNCTION_SWITCHES)
|
||||||
|
add_definitions(-DFUNCTION_SWITCHES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FUNCTION_SWITCHES_WITH_RGB)
|
||||||
|
set(FUNCTION_SWITCHES YES)
|
||||||
|
add_definitions(-DFUNCTION_SWITCHES)
|
||||||
|
add_definitions(-DFUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_SERIAL_PASSTHROUGH)
|
if(ENABLE_SERIAL_PASSTHROUGH)
|
||||||
set(CLI ON "Enable CLI")
|
set(CLI ON "Enable CLI")
|
||||||
@@ -644,6 +673,17 @@ if(USE_RTC_CLOCK)
|
|||||||
add_definitions(-DRTCLOCK)
|
add_definitions(-DRTCLOCK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(RGBLEDS)
|
||||||
|
add_definitions(-DRGBLEDS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FLAVOUR STREQUAL gx12)
|
||||||
|
target_sources(board PRIVATE
|
||||||
|
drivers/pca95xx.cpp
|
||||||
|
${TARGET_SRC_DIR}/gx12/bsp_io.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(board PRIVATE ${TARGET_SRC_DIR}/gx12)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SRC ${SRC}
|
set(SRC ${SRC}
|
||||||
io/frsky_firmware_update.cpp
|
io/frsky_firmware_update.cpp
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "hal/abnormal_reboot.h"
|
#include "hal/abnormal_reboot.h"
|
||||||
#include "hal/usb_driver.h"
|
#include "hal/usb_driver.h"
|
||||||
#include "hal/gpio.h"
|
#include "hal/gpio.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "boards/generic_stm32/module_ports.h"
|
#include "boards/generic_stm32/module_ports.h"
|
||||||
@@ -198,12 +199,12 @@ void boardInit()
|
|||||||
delay_ms(20);
|
delay_ms(20);
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
// Support for FS Led to indicate battery charge level
|
// Support for FS Led to indicate battery charge level
|
||||||
if (getBatteryVoltage() >= 660) fsLedOn(0);
|
if (getBatteryVoltage() >= 660) setFSLedON(0);
|
||||||
if (getBatteryVoltage() >= 700) fsLedOn(1);
|
if (getBatteryVoltage() >= 700) setFSLedON(1);
|
||||||
if (getBatteryVoltage() >= 740) fsLedOn(2);
|
if (getBatteryVoltage() >= 740) setFSLedON(2);
|
||||||
if (getBatteryVoltage() >= 780) fsLedOn(3);
|
if (getBatteryVoltage() >= 780) setFSLedON(3);
|
||||||
if (getBatteryVoltage() >= 820) fsLedOn(4);
|
if (getBatteryVoltage() >= 820) setFSLedON(4);
|
||||||
if (getBatteryVoltage() >= 842) fsLedOn(5);
|
if (getBatteryVoltage() >= 842) setFSLedON(5);
|
||||||
#elif defined(STATUS_LEDS)
|
#elif defined(STATUS_LEDS)
|
||||||
// Use Status LED to indicate battery charge level instead
|
// Use Status LED to indicate battery charge level instead
|
||||||
if (getBatteryVoltage() <= 660) ledRed(); // low discharge
|
if (getBatteryVoltage() <= 660) ledRed(); // low discharge
|
||||||
@@ -216,6 +217,9 @@ void boardInit()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
delaysInit();
|
||||||
|
__enable_irq();
|
||||||
|
|
||||||
keysInit();
|
keysInit();
|
||||||
switchInit();
|
switchInit();
|
||||||
|
|
||||||
@@ -223,9 +227,6 @@ void boardInit()
|
|||||||
rotaryEncoderInit();
|
rotaryEncoderInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delaysInit();
|
|
||||||
__enable_irq();
|
|
||||||
|
|
||||||
#if defined(PWM_STICKS)
|
#if defined(PWM_STICKS)
|
||||||
sticksPwmDetect();
|
sticksPwmDetect();
|
||||||
#endif
|
#endif
|
||||||
@@ -296,6 +297,11 @@ void boardInit()
|
|||||||
#if defined(GUI)
|
#if defined(GUI)
|
||||||
lcdSetContrast(true);
|
lcdSetContrast(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(RADIO_GX12)
|
||||||
|
gpio_init(HALL_SYNC, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsp_io.h"
|
||||||
|
#include "hal/switch_driver.h"
|
||||||
|
#include "drivers/pca95xx.h"
|
||||||
|
#include "stm32_i2c_driver.h"
|
||||||
|
#include "timers_driver.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
|
||||||
|
#include <FreeRTOS/include/FreeRTOS.h>
|
||||||
|
#include <FreeRTOS/include/timers.h>
|
||||||
|
|
||||||
|
#include "myeeprom.h"
|
||||||
|
#include "bitfield.h"
|
||||||
|
|
||||||
|
struct bsp_io_expander {
|
||||||
|
pca95xx_t exp;
|
||||||
|
uint32_t mask;
|
||||||
|
uint32_t state;
|
||||||
|
};
|
||||||
|
|
||||||
|
static bsp_io_expander _io_switches;
|
||||||
|
static bsp_io_expander _io_fs_switches;
|
||||||
|
|
||||||
|
|
||||||
|
static void _init_io_expander(bsp_io_expander* io, uint32_t mask)
|
||||||
|
{
|
||||||
|
io->mask = mask;
|
||||||
|
io->state = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t _read_io_expander(bsp_io_expander* io)
|
||||||
|
{
|
||||||
|
uint16_t value = 0;
|
||||||
|
if (pca95xx_read(&io->exp, io->mask, &value) == 0) {
|
||||||
|
io->state = value;
|
||||||
|
}
|
||||||
|
return io->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _poll_switches(void *pvParameter1, uint32_t ulParameter2)
|
||||||
|
{
|
||||||
|
(void)ulParameter2;
|
||||||
|
bsp_io_expander* io = (bsp_io_expander*)pvParameter1;
|
||||||
|
_read_io_expander(io);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _io_int_handler(bsp_io_expander* io)
|
||||||
|
{
|
||||||
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
|
||||||
|
xTimerPendFunctionCallFromISR(_poll_switches, (void*)io, 0,
|
||||||
|
&xHigherPriorityTaskWoken);
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
} else {
|
||||||
|
_read_io_expander(io);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _io_int_handler() {
|
||||||
|
_io_int_handler(&_io_switches);
|
||||||
|
_io_int_handler(&_io_fs_switches);
|
||||||
|
}
|
||||||
|
|
||||||
|
int bsp_io_init()
|
||||||
|
{
|
||||||
|
timersInit();
|
||||||
|
|
||||||
|
if (i2c_init(I2C_Bus_2) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure expander 1
|
||||||
|
_init_io_expander(&_io_switches, 0xFC3F);
|
||||||
|
if (pca95xx_init(&_io_switches.exp, I2C_Bus_2, 0x74) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure expander 2
|
||||||
|
_init_io_expander(&_io_fs_switches, 0x3F);
|
||||||
|
if (pca95xx_init(&_io_fs_switches.exp, I2C_Bus_2, 0x75) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup expanders pin change interrupt
|
||||||
|
gpio_init_int(IO_INT_GPIO, GPIO_IN, GPIO_FALLING, _io_int_handler);
|
||||||
|
|
||||||
|
// setup expanders reset pin
|
||||||
|
gpio_init(IO_RESET_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
|
gpio_set(IO_RESET_GPIO);
|
||||||
|
|
||||||
|
bsp_io_read_switches();
|
||||||
|
bsp_io_read_fs_switches();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t bsp_io_read_switches()
|
||||||
|
{
|
||||||
|
return _read_io_expander(&_io_switches);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t bsp_io_read_fs_switches()
|
||||||
|
{
|
||||||
|
return _read_io_expander(&_io_fs_switches);
|
||||||
|
}
|
||||||
|
|
||||||
|
void boardInitSwitches()
|
||||||
|
{
|
||||||
|
bsp_io_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct bsp_io_sw_def {
|
||||||
|
uint32_t pin_high;
|
||||||
|
uint32_t pin_low;
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr uint32_t RGB_OFFSET = (1 << 16); // first after bspio pins
|
||||||
|
static uint16_t soft2POSLogicalState = 0xFFFF;
|
||||||
|
|
||||||
|
static const bsp_io_sw_def _switch_defs[] = {
|
||||||
|
{ SWITCH_A, RGB_OFFSET + 7 },
|
||||||
|
{ SWITCH_B_H, SWITCH_B_L },
|
||||||
|
{ SWITCH_C_H, SWITCH_C_L },
|
||||||
|
{ SWITCH_D, RGB_OFFSET + 6 },
|
||||||
|
{ SWITCH_E_H, SWITCH_E_L },
|
||||||
|
{ SWITCH_F_H, SWITCH_F_L },
|
||||||
|
{ SWITCH_G, 0 },
|
||||||
|
{ SWITCH_H, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static SwitchHwPos _get_switch_pos(uint8_t idx)
|
||||||
|
{
|
||||||
|
static uint32_t oldState = 0;
|
||||||
|
SwitchHwPos pos = SWITCH_HW_UP;
|
||||||
|
const bsp_io_sw_def* def = &_switch_defs[idx];
|
||||||
|
|
||||||
|
uint32_t state = _io_switches.state;
|
||||||
|
|
||||||
|
if (def->pin_low > RGB_OFFSET) {
|
||||||
|
// Potential soft 2pos
|
||||||
|
if ((SWITCH_CONFIG(idx) == SWITCH_TOGGLE)) {
|
||||||
|
if ((state & def->pin_high) == 0) {
|
||||||
|
pos = SWITCH_HW_DOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (((state & def->pin_high) == 0) && ((state & def->pin_high) != (oldState & def->pin_high))) {
|
||||||
|
soft2POSLogicalState ^= def->pin_high;
|
||||||
|
}
|
||||||
|
if ((soft2POSLogicalState & def->pin_high) == 0) {
|
||||||
|
pos = SWITCH_HW_DOWN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pos = SWITCH_HW_UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pos == SWITCH_HW_UP) {
|
||||||
|
rgbSetLedColor(def->pin_low - RGB_OFFSET, 0x0, 0x0, 0x0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgbSetLedColor(def->pin_low - RGB_OFFSET, 0xFF, 0xFF, 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!def->pin_low) {
|
||||||
|
// 2POS switch
|
||||||
|
if ((state & def->pin_high) == 0) {
|
||||||
|
pos = SWITCH_HW_DOWN;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bool hi = state & def->pin_high;
|
||||||
|
bool lo = state & def->pin_low;
|
||||||
|
|
||||||
|
if (hi && lo) {
|
||||||
|
pos = SWITCH_HW_MID;
|
||||||
|
} else if (!hi && lo) {
|
||||||
|
pos = SWITCH_HW_DOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx == switchGetMaxSwitches() - 1)
|
||||||
|
oldState = state;
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SwitchHwPos _get_fs_switch_pos(uint8_t idx)
|
||||||
|
{
|
||||||
|
uint32_t state = _io_fs_switches.state;
|
||||||
|
if ((state & (1 << idx)) == 0) {
|
||||||
|
return SWITCH_HW_DOWN;
|
||||||
|
} else {
|
||||||
|
return SWITCH_HW_UP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
||||||
|
{
|
||||||
|
if (cat == SWITCH_PHYSICAL) {
|
||||||
|
return _get_switch_pos(idx);
|
||||||
|
} else if (cat == SWITCH_FUNCTION){
|
||||||
|
return _get_fs_switch_pos(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_HW_UP;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "drivers/pca95xx.h"
|
||||||
|
|
||||||
|
// Port expander 1 (0x74)
|
||||||
|
#define SWITCH_H PCA95XX_PIN_0
|
||||||
|
#define SWITCH_D PCA95XX_PIN_1
|
||||||
|
|
||||||
|
#define SWITCH_F_H PCA95XX_PIN_3
|
||||||
|
#define SWITCH_F_L PCA95XX_PIN_2
|
||||||
|
|
||||||
|
#define SWITCH_C_L PCA95XX_PIN_4
|
||||||
|
#define SWITCH_C_H PCA95XX_PIN_5
|
||||||
|
|
||||||
|
#define SWITCH_B_H PCA95XX_PIN_10
|
||||||
|
#define SWITCH_B_L PCA95XX_PIN_11
|
||||||
|
|
||||||
|
#define SWITCH_E_H PCA95XX_PIN_12
|
||||||
|
#define SWITCH_E_L PCA95XX_PIN_13
|
||||||
|
|
||||||
|
#define SWITCH_A PCA95XX_PIN_14
|
||||||
|
#define SWITCH_G PCA95XX_PIN_15
|
||||||
|
|
||||||
|
#define IO_INT_GPIO GPIO_PIN(GPIOE, 14)
|
||||||
|
#define IO_RESET_GPIO GPIO_PIN(GPIOE, 15)
|
||||||
|
|
||||||
|
// Port expander 1 (0x75)
|
||||||
|
#define FSSWITCH_1 PCA95XX_PIN_0
|
||||||
|
#define FSSWITCH_2 PCA95XX_PIN_1
|
||||||
|
#define FSSWITCH_3 PCA95XX_PIN_2
|
||||||
|
#define FSSWITCH_4 PCA95XX_PIN_3
|
||||||
|
#define FSSWITCH_5 PCA95XX_PIN_4
|
||||||
|
#define FSSWITCH_6 PCA95XX_PIN_5
|
||||||
|
|
||||||
|
|
||||||
|
int bsp_io_init();
|
||||||
|
uint32_t bsp_io_read_switches();
|
||||||
|
uint32_t bsp_io_read_fs_switches();
|
||||||
+152
-326
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,14 @@ void lcdHardwareInit()
|
|||||||
|
|
||||||
NVIC_SetPriority(LCD_DMA_Stream_IRQn, 7);
|
NVIC_SetPriority(LCD_DMA_Stream_IRQn, 7);
|
||||||
NVIC_EnableIRQ(LCD_DMA_Stream_IRQn);
|
NVIC_EnableIRQ(LCD_DMA_Stream_IRQn);
|
||||||
|
|
||||||
|
#if defined(OLED_VCC_CS)
|
||||||
|
gpio_init(OLED_VCC_CS, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
|
|
||||||
|
// Coming from bootloader or EM, screen is already on
|
||||||
|
if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE())
|
||||||
|
gpio_set(OLED_VCC_CS);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SSD1309_LCD)
|
#if defined(SSD1309_LCD)
|
||||||
@@ -145,6 +153,10 @@ void lcdStart()
|
|||||||
lcdWriteCommand(0xA4); // Disable Entire Display On
|
lcdWriteCommand(0xA4); // Disable Entire Display On
|
||||||
lcdWriteCommand(0xA6); // Set Normal Display (not inverted)
|
lcdWriteCommand(0xA6); // Set Normal Display (not inverted)
|
||||||
lcdWriteCommand(0x2E); // Deactivate scroll
|
lcdWriteCommand(0x2E); // Deactivate scroll
|
||||||
|
#if defined(OLED_VCC_CS)
|
||||||
|
delay_ms(100);
|
||||||
|
gpio_set(OLED_VCC_CS);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(LCD_VERTICAL_INVERT)
|
#if defined(LCD_VERTICAL_INVERT)
|
||||||
// T12 and TX12 have the screen inverted.
|
// T12 and TX12 have the screen inverted.
|
||||||
@@ -353,7 +365,12 @@ void lcdOff()
|
|||||||
to re-init LCD without any delay
|
to re-init LCD without any delay
|
||||||
*/
|
*/
|
||||||
lcdWriteCommand(0xAE); // LCD sleep
|
lcdWriteCommand(0xAE); // LCD sleep
|
||||||
|
#if defined(OLED_VCC_CS)
|
||||||
|
gpio_clear(OLED_VCC_CS);
|
||||||
|
delay_ms(100);
|
||||||
|
#else
|
||||||
delay_ms(3); // Wait for caps to drain
|
delay_ms(3); // Wait for caps to drain
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdReset()
|
void lcdReset()
|
||||||
|
|||||||
@@ -20,11 +20,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hal/gpio.h"
|
#include "hal/gpio.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#if defined(LED_STRIP_GPIO)
|
||||||
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#define GET_RED(color) (((color) & 0xF80000) >>16)
|
||||||
|
#define GET_GREEN(color) (((color) & 0x000F800) >> 8)
|
||||||
|
#define GET_BLUE(color) (((color) & 0xF8))
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES) && !defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
static const uint32_t fsLeds[] = {FSLED_GPIO_PIN_1, FSLED_GPIO_PIN_2,
|
static const uint32_t fsLeds[] = {FSLED_GPIO_PIN_1, FSLED_GPIO_PIN_2,
|
||||||
FSLED_GPIO_PIN_3, FSLED_GPIO_PIN_4,
|
FSLED_GPIO_PIN_3, FSLED_GPIO_PIN_4,
|
||||||
FSLED_GPIO_PIN_5, FSLED_GPIO_PIN_6};
|
FSLED_GPIO_PIN_5, FSLED_GPIO_PIN_6};
|
||||||
@@ -44,14 +52,32 @@ void ledInit()
|
|||||||
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES) && !defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
for (size_t i = 0; i < DIM(fsLeds); i++) {
|
for (size_t i = 0; i < DIM(fsLeds); i++) {
|
||||||
gpio_init(fsLeds[i], GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
gpio_init(fsLeds[i], GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
// used to map switch number to led number in the rgbled chain
|
||||||
|
uint8_t ledMapping[] = {0, 1, 2, 3, 4, 5, 6};
|
||||||
|
|
||||||
|
void fsLedRGB(uint8_t index, uint32_t color)
|
||||||
|
{
|
||||||
|
rgbSetLedColor(ledMapping[index], GET_RED(color), \
|
||||||
|
GET_GREEN(color),GET_BLUE(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t getRGBColorIndex(uint32_t color)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < (sizeof(colorTable) / sizeof(colorTable[0])); i++) {
|
||||||
|
if (color == colorTable[i])
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
return 5; // Custom value set with Companion
|
||||||
|
}
|
||||||
|
#elif defined(FUNCTION_SWITCHES)
|
||||||
void fsLedOff(uint8_t index)
|
void fsLedOff(uint8_t index)
|
||||||
{
|
{
|
||||||
gpio_clear(fsLeds[index]);
|
gpio_clear(fsLeds[index]);
|
||||||
@@ -62,7 +88,7 @@ void fsLedOn(uint8_t index)
|
|||||||
gpio_set(fsLeds[index]);
|
gpio_set(fsLeds[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getFSLedState(uint8_t index)
|
bool fsLedState(uint8_t index)
|
||||||
{
|
{
|
||||||
return gpio_read(fsLeds[index]) ? true : false;
|
return gpio_read(fsLeds[index]) ? true : false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
#define USB_NAME "Radiomaster MT12"
|
#define USB_NAME "Radiomaster MT12"
|
||||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||||
#define USB_PRODUCT 'R', 'M', ' ', 'M', 'T', '1', '2', ' ' /* 8 Bytes */
|
#define USB_PRODUCT 'R', 'M', ' ', 'M', 'T', '1', '2', ' ' /* 8 Bytes */
|
||||||
|
#elif defined(RADIO_GX12)
|
||||||
|
#define USB_NAME "Radiomaster GX12"
|
||||||
|
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||||
|
#define USB_PRODUCT 'R', 'M', ' ', 'G', 'X', '1', '2', ' ' /* 8 Bytes */
|
||||||
#elif defined(RADIO_POCKET)
|
#elif defined(RADIO_POCKET)
|
||||||
#define USB_NAME "Radiomaster Pocket"
|
#define USB_NAME "Radiomaster Pocket"
|
||||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||||
|
|||||||
@@ -28,6 +28,10 @@
|
|||||||
#include "hal/usb_driver.h"
|
#include "hal/usb_driver.h"
|
||||||
|
|
||||||
#include "hal/watchdog_driver.h"
|
#include "hal/watchdog_driver.h"
|
||||||
|
#if defined(HALL_SYNC) && !defined(SIMU)
|
||||||
|
#include "stm32_gpio.h"
|
||||||
|
#include "hal/gpio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
RTOS_TASK_HANDLE mixerTaskId;
|
RTOS_TASK_HANDLE mixerTaskId;
|
||||||
RTOS_DEFINE_STACK(mixerTaskId, mixerStack, MIXER_STACK_SIZE);
|
RTOS_DEFINE_STACK(mixerTaskId, mixerStack, MIXER_STACK_SIZE);
|
||||||
@@ -224,6 +228,10 @@ void doMixerCalculations()
|
|||||||
|
|
||||||
tmr10ms_t tmr10ms = get_tmr10ms();
|
tmr10ms_t tmr10ms = get_tmr10ms();
|
||||||
|
|
||||||
|
#if defined(HALL_SYNC) && !defined(SIMU)
|
||||||
|
gpio_set(HALL_SYNC);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_LATENCY_MIXER_RF) || defined(DEBUG_LATENCY_RF_ONLY)
|
#if defined(DEBUG_LATENCY_MIXER_RF) || defined(DEBUG_LATENCY_RF_ONLY)
|
||||||
static tmr10ms_t lastLatencyToggle = 0;
|
static tmr10ms_t lastLatencyToggle = 0;
|
||||||
if (tmr10ms - lastLatencyToggle >= 10) {
|
if (tmr10ms - lastLatencyToggle >= 10) {
|
||||||
@@ -249,4 +257,8 @@ void doMixerCalculations()
|
|||||||
DEBUG_TIMER_START(debugTimerEvalMixes);
|
DEBUG_TIMER_START(debugTimerEvalMixes);
|
||||||
evalMixes(tick10ms);
|
evalMixes(tick10ms);
|
||||||
DEBUG_TIMER_STOP(debugTimerEvalMixes);
|
DEBUG_TIMER_STOP(debugTimerEvalMixes);
|
||||||
|
|
||||||
|
#if defined(HALL_SYNC) && !defined(SIMU)
|
||||||
|
gpio_clear(HALL_SYNC);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ ISTR(PREFLIGHT_POTSLIDER_CHECK);
|
|||||||
ISTR(PPMUNIT);
|
ISTR(PPMUNIT);
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
ISTR(FUNCTION_SWITCH_GROUPS);
|
ISTR(FUNCTION_SWITCH_GROUPS);
|
||||||
|
ISTR(FS_COLOR_LIST);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HELI)
|
#if defined(HELI)
|
||||||
@@ -167,6 +168,8 @@ const char STR_MS[] = TR_MS;
|
|||||||
const char STR_SWITCH[] = TR_SWITCH;
|
const char STR_SWITCH[] = TR_SWITCH;
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
const char STR_GROUPS[] = TR_GROUPS;
|
const char STR_GROUPS[] = TR_GROUPS;
|
||||||
|
const char STR_FS_ON_COLOR[] = TR_FS_ON_COLOR;
|
||||||
|
const char STR_FS_OFF_COLOR[] = TR_FS_OFF_COLOR;
|
||||||
const char STR_LAST[] = TR_LAST;
|
const char STR_LAST[] = TR_LAST;
|
||||||
const char STR_MORE_INFO[] = TR_MORE_INFO;
|
const char STR_MORE_INFO[] = TR_MORE_INFO;
|
||||||
const char STR_SWITCH_TYPE[] = TR_SWITCH_TYPE;
|
const char STR_SWITCH_TYPE[] = TR_SWITCH_TYPE;
|
||||||
|
|||||||
@@ -290,6 +290,9 @@ extern const char STR_MS[];
|
|||||||
extern const char STR_SWITCH[];
|
extern const char STR_SWITCH[];
|
||||||
extern const char STR_FUNCTION_SWITCHES[];
|
extern const char STR_FUNCTION_SWITCHES[];
|
||||||
extern const char STR_GROUP[];
|
extern const char STR_GROUP[];
|
||||||
|
extern const char STR_FS_ON_COLOR[];
|
||||||
|
extern const char STR_FS_OFF_COLOR[];
|
||||||
|
extern const char* const STR_FS_COLOR_LIST[];
|
||||||
extern const char STR_GROUP_ALWAYS_ON[];
|
extern const char STR_GROUP_ALWAYS_ON[];
|
||||||
extern const char STR_GROUPS[];
|
extern const char STR_GROUPS[];
|
||||||
extern const char STR_LAST[];
|
extern const char STR_LAST[];
|
||||||
|
|||||||
@@ -284,8 +284,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "开关"
|
#define TR_SWITCH "开关"
|
||||||
#define TR_FUNCTION_SWITCHES "可自定义开关"
|
#define TR_FUNCTION_SWITCHES "可自定义开关"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -298,8 +298,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Spínač"
|
#define TR_SWITCH "Spínač"
|
||||||
#define TR_FUNCTION_SWITCHES "Nastavitelné přepínače"
|
#define TR_FUNCTION_SWITCHES "Nastavitelné přepínače"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -291,13 +291,12 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Kontakt"
|
#define TR_SWITCH "Kontakt"
|
||||||
#define TR_FUNCTION_SWITCHES "Kontakter der kan tilpasses"
|
#define TR_FUNCTION_SWITCHES "Kontakter der kan tilpasses"
|
||||||
#define TR_GROUP "Gruppe"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Altid til"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP "Gruppe"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUP_ALWAYS_ON "Altid til"
|
#define TR_GROUPS "Always on groups"
|
||||||
#define TR_GROUPS "Altid til gruppe"
|
#define TR_LAST "Last"
|
||||||
#define TR_LAST "Sidste"
|
#define TR_MORE_INFO "More info"
|
||||||
#define TR_MORE_INFO "Mere info"
|
|
||||||
#define TR_SWITCH_TYPE "Type"
|
#define TR_SWITCH_TYPE "Type"
|
||||||
#define TR_SWITCH_STARTUP "Start"
|
#define TR_SWITCH_STARTUP "Start"
|
||||||
#define TR_SWITCH_GROUP "Gruppe"
|
#define TR_SWITCH_GROUP "Gruppe"
|
||||||
|
|||||||
@@ -289,10 +289,11 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Schalt.", "Schalter")
|
#define TR_SWITCH TR("Schalt.", "Schalter")
|
||||||
#define TR_FUNCTION_SWITCHES "Anpassbare Schalter"
|
#define TR_FUNCTION_SWITCHES "Anpassbare Schalter"
|
||||||
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_ON_COLOR TR("ON:","ON Color")
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_FS_OFF_COLOR TR("OFF:","OFF Color")
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
#define TR_LAST "Last"
|
#define TR_LAST "Last"
|
||||||
#define TR_MORE_INFO "More info"
|
#define TR_MORE_INFO "More info"
|
||||||
|
|||||||
@@ -288,8 +288,11 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Switch"
|
#define TR_SWITCH "Switch"
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable Switches"
|
#define TR_FUNCTION_SWITCHES "Customizable Switches"
|
||||||
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
|
#define TR_FS_ON_COLOR TR("ON:","ON Color")
|
||||||
|
#define TR_FS_OFF_COLOR TR("OFF:","OFF Color")
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
#define TR_LAST "Last"
|
#define TR_LAST "Last"
|
||||||
#define TR_MORE_INFO "More info"
|
#define TR_MORE_INFO "More info"
|
||||||
|
|||||||
@@ -286,8 +286,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Interr.", "Interruptor")
|
#define TR_SWITCH TR("Interr.", "Interruptor")
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -299,8 +299,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Switch"
|
#define TR_SWITCH "Switch"
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -294,6 +294,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Inter", "Interrupteur")
|
#define TR_SWITCH TR("Inter", "Interrupteur")
|
||||||
#define TR_FUNCTION_SWITCHES "Inters paramétrables"
|
#define TR_FUNCTION_SWITCHES "Inters paramétrables"
|
||||||
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -292,8 +292,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "מתג"
|
#define TR_SWITCH "מתג"
|
||||||
#define TR_FUNCTION_SWITCHES "מפסקים בהתאמה אישית"
|
#define TR_FUNCTION_SWITCHES "מפסקים בהתאמה אישית"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -288,8 +288,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Inter."
|
#define TR_SWITCH "Inter."
|
||||||
#define TR_FUNCTION_SWITCHES "Interruttori personalizzabili"
|
#define TR_FUNCTION_SWITCHES "Interruttori personalizzabili"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -287,8 +287,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "スイッチ"
|
#define TR_SWITCH "スイッチ"
|
||||||
#define TR_FUNCTION_SWITCHES "カスタマイズ スイッチ"
|
#define TR_FUNCTION_SWITCHES "カスタマイズ スイッチ"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -285,8 +285,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Schak.", "Schakelaar")
|
#define TR_SWITCH TR("Schak.", "Schakelaar")
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -285,9 +285,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Przełą"
|
#define TR_SWITCH "Przełą"
|
||||||
#define TR_FUNCTION_SWITCHES "Ustawiane przełączniki"
|
#define TR_FUNCTION_SWITCHES "Ustawiane przełączniki"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
#define TR_LAST "Last"
|
#define TR_LAST "Last"
|
||||||
|
|||||||
@@ -291,8 +291,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Chave"
|
#define TR_SWITCH "Chave"
|
||||||
#define TR_FUNCTION_SWITCHES "Chaves customizáveis"
|
#define TR_FUNCTION_SWITCHES "Chaves customizáveis"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -290,8 +290,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Тумблер"
|
#define TR_SWITCH "Тумблер"
|
||||||
#define TR_FUNCTION_SWITCHES "Настр тумблеры"
|
#define TR_FUNCTION_SWITCHES "Настр тумблеры"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -300,6 +300,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Brytare"
|
#define TR_SWITCH "Brytare"
|
||||||
#define TR_FUNCTION_SWITCHES "Anpassningsbara brytare"
|
#define TR_FUNCTION_SWITCHES "Anpassningsbara brytare"
|
||||||
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP "Grupp"
|
#define TR_GROUP "Grupp"
|
||||||
#define TR_GROUP_ALWAYS_ON "Alltid på"
|
#define TR_GROUP_ALWAYS_ON "Alltid på"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -289,8 +289,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "開關"
|
#define TR_SWITCH "開關"
|
||||||
#define TR_FUNCTION_SWITCHES "可自定義開關"
|
#define TR_FUNCTION_SWITCHES "可自定義開關"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -290,8 +290,7 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Перемикач"
|
#define TR_SWITCH "Перемикач"
|
||||||
#define TR_FUNCTION_SWITCHES "Користувацькі перемикачі"
|
#define TR_FUNCTION_SWITCHES "Користувацькі перемикачі"
|
||||||
#define TR_GROUP "Group"
|
#define TR_FS_COLOR_LIST "White","Red","Green","Yellow","Orange","Blue","Pink","Off","Custom"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
|
||||||
#define TR_GROUP "Group"
|
#define TR_GROUP "Group"
|
||||||
#define TR_GROUP_ALWAYS_ON "Always on"
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_GROUPS "Always on groups"
|
#define TR_GROUPS "Always on groups"
|
||||||
|
|||||||
@@ -164,6 +164,11 @@ def main():
|
|||||||
cmake_options["PCBREV"] = "MT12"
|
cmake_options["PCBREV"] = "MT12"
|
||||||
firmware_options = options_radiomaster_mt12
|
firmware_options = options_radiomaster_mt12
|
||||||
maxsize = 65536 * 8 * 2
|
maxsize = 65536 * 8 * 2
|
||||||
|
elif board_name == "gx12":
|
||||||
|
cmake_options["PCB"] = "X7"
|
||||||
|
cmake_options["PCBREV"] = "GX12"
|
||||||
|
firmware_options = options_radiomaster_gx12
|
||||||
|
maxsize = 65536 * 8 * 2
|
||||||
elif board_name == "t8":
|
elif board_name == "t8":
|
||||||
cmake_options["PCB"] = "X7"
|
cmake_options["PCB"] = "X7"
|
||||||
cmake_options["PCBREV"] = "T8"
|
cmake_options["PCBREV"] = "T8"
|
||||||
|
|||||||
@@ -259,6 +259,18 @@ options_radiomaster_boxer = {
|
|||||||
"internalelrs": ("INTERNAL_MODULE_ELRS", "YES", "NO"),
|
"internalelrs": ("INTERNAL_MODULE_ELRS", "YES", "NO"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options_radiomaster_gx12 = {
|
||||||
|
"noheli": ("HELI", "NO", "YES"),
|
||||||
|
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
|
||||||
|
"nogvars": ("GVARS", "NO", "YES"),
|
||||||
|
"faimode": ("FAI", "YES", None),
|
||||||
|
"faichoice": ("FAI", "CHOICE", None),
|
||||||
|
"nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"),
|
||||||
|
"flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None),
|
||||||
|
"afhds3": ("AFHDS3", "YES", "NO"),
|
||||||
|
"internalelrs": ("INTERNAL_MODULE_ELRS", "YES", "NO"),
|
||||||
|
}
|
||||||
|
|
||||||
options_radiomaster_pocket = {
|
options_radiomaster_pocket = {
|
||||||
"noheli": ("HELI", "NO", "YES"),
|
"noheli": ("HELI", "NO", "YES"),
|
||||||
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
|
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
from switch_config import switch_cfg_by_target
|
from switch_config import switch_cfg_by_target
|
||||||
|
|
||||||
class Switch:
|
|
||||||
|
|
||||||
TYPE_2POS = '2POS'
|
class Switch:
|
||||||
TYPE_3POS = '3POS'
|
TYPE_2POS = "2POS"
|
||||||
TYPE_ADC = 'ADC'
|
TYPE_3POS = "3POS"
|
||||||
|
TYPE_ADC = "ADC"
|
||||||
|
|
||||||
def __init__(self, name, sw_type, flags):
|
def __init__(self, name, sw_type, flags):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = sw_type
|
self.type = sw_type
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
self.inverted = False
|
||||||
|
self.default = None
|
||||||
|
self.display = []
|
||||||
|
|
||||||
|
|
||||||
class Switch2POS(Switch):
|
class Switch2POS(Switch):
|
||||||
def __init__(self, name, gpio, pin, flags=0):
|
def __init__(self, name, gpio, pin, flags=0):
|
||||||
@@ -17,6 +21,7 @@ class Switch2POS(Switch):
|
|||||||
self.gpio = gpio
|
self.gpio = gpio
|
||||||
self.pin = pin
|
self.pin = pin
|
||||||
|
|
||||||
|
|
||||||
class Switch3POS(Switch):
|
class Switch3POS(Switch):
|
||||||
def __init__(self, name, gpio_high, pin_high, gpio_low, pin_low, flags=0):
|
def __init__(self, name, gpio_high, pin_high, gpio_low, pin_low, flags=0):
|
||||||
super(Switch3POS, self).__init__(name, Switch.TYPE_3POS, flags)
|
super(Switch3POS, self).__init__(name, Switch.TYPE_3POS, flags)
|
||||||
@@ -25,22 +30,38 @@ class Switch3POS(Switch):
|
|||||||
self.gpio_low = gpio_low
|
self.gpio_low = gpio_low
|
||||||
self.pin_low = pin_low
|
self.pin_low = pin_low
|
||||||
|
|
||||||
|
|
||||||
class SwitchADC(Switch):
|
class SwitchADC(Switch):
|
||||||
def __init__(self, name, adc_input, flags=0):
|
def __init__(self, name, adc_input, flags=0):
|
||||||
super(SwitchADC, self).__init__(name, Switch.TYPE_ADC, flags)
|
super(SwitchADC, self).__init__(name, Switch.TYPE_ADC, flags)
|
||||||
self.adc_input = adc_input
|
self.adc_input = adc_input
|
||||||
|
|
||||||
|
|
||||||
|
class SwitchCustom(Switch):
|
||||||
|
def __init__(self, name, type, flags=0):
|
||||||
|
super(SwitchCustom, self).__init__(name, type, flags)
|
||||||
|
|
||||||
|
|
||||||
def AZ_seq():
|
def AZ_seq():
|
||||||
return [chr(i) for i in range(ord('A'), ord('Z') + 1)]
|
return [chr(i) for i in range(ord("A"), ord("Z") + 1)]
|
||||||
|
|
||||||
|
|
||||||
def eprint(*args, **kwargs):
|
def eprint(*args, **kwargs):
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
|
|
||||||
print(*args, file=stderr, **kwargs)
|
print(*args, file=stderr, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def prefixsearch(dictionary, prefix):
|
||||||
|
for k in dictionary.keys():
|
||||||
|
if k.startswith(prefix):
|
||||||
|
return k[len(prefix) :]
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
# switches from A to Z
|
# switches from A to Z
|
||||||
def parse_switches(target, hw_defs, adc_parser):
|
def parse_switches(target, hw_defs, adc_parser):
|
||||||
|
|
||||||
switches = []
|
switches = []
|
||||||
|
|
||||||
def find_switch(name):
|
def find_switch(name):
|
||||||
@@ -50,20 +71,20 @@ def parse_switches(target, hw_defs, adc_parser):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
for s in AZ_seq():
|
for s in AZ_seq():
|
||||||
|
name = f"S{s}"
|
||||||
|
|
||||||
name = f'S{s}'
|
reg = f"SWITCHES_GPIO_REG_{s}"
|
||||||
|
reg_high = f"{reg}_H"
|
||||||
|
reg_low = f"{reg}_L"
|
||||||
|
|
||||||
reg = f'SWITCHES_GPIO_REG_{s}'
|
pin = f"SWITCHES_GPIO_PIN_{s}"
|
||||||
reg_high = f'{reg}_H'
|
pin_high = f"{pin}_H"
|
||||||
reg_low = f'{reg}_L'
|
pin_low = f"{pin}_L"
|
||||||
|
|
||||||
pin = f'SWITCHES_GPIO_PIN_{s}'
|
inverted = f"SWITCHES_{s}_INVERTED"
|
||||||
pin_high = f'{pin}_H'
|
|
||||||
pin_low = f'{pin}_L'
|
|
||||||
|
|
||||||
inverted = f'SWITCHES_{s}_INVERTED'
|
adc_input_name = f"SW{s}"
|
||||||
|
custom = f"SWITCHES_{s}_"
|
||||||
adc_input_name = f'SW{s}'
|
|
||||||
|
|
||||||
switch = None
|
switch = None
|
||||||
if reg in hw_defs:
|
if reg in hw_defs:
|
||||||
@@ -78,10 +99,13 @@ def parse_switches(target, hw_defs, adc_parser):
|
|||||||
reg_low = hw_defs[reg_low]
|
reg_low = hw_defs[reg_low]
|
||||||
pin_low = hw_defs[pin_low]
|
pin_low = hw_defs[pin_low]
|
||||||
switch = Switch3POS(name, reg_high, pin_high, reg_low, pin_low)
|
switch = Switch3POS(name, reg_high, pin_high, reg_low, pin_low)
|
||||||
else:
|
elif adc_parser.find_input(adc_input_name):
|
||||||
# ADC switch
|
# ADC switch
|
||||||
if adc_parser.find_input(adc_input_name):
|
switch = SwitchADC(name, adc_input_name)
|
||||||
switch = SwitchADC(name, adc_input_name)
|
else:
|
||||||
|
type = prefixsearch(hw_defs, custom)
|
||||||
|
if type is not None:
|
||||||
|
switch = SwitchCustom(name, type)
|
||||||
|
|
||||||
if switch:
|
if switch:
|
||||||
if inverted in hw_defs:
|
if inverted in hw_defs:
|
||||||
@@ -89,18 +113,22 @@ def parse_switches(target, hw_defs, adc_parser):
|
|||||||
|
|
||||||
cfg = switch_cfg_by_target(target, name)
|
cfg = switch_cfg_by_target(target, name)
|
||||||
if cfg:
|
if cfg:
|
||||||
switch.default = cfg.get('default')
|
switch.default = cfg.get("default")
|
||||||
switch.display = cfg.get('display')
|
switch.display = cfg.get("display")
|
||||||
#eprint(switch.default)
|
# eprint(switch.default)
|
||||||
|
|
||||||
switches.append(switch)
|
switches.append(switch)
|
||||||
|
|
||||||
for i in range(1, 6 + 1):
|
for i in range(1, 6 + 1):
|
||||||
f_sw_marker = f'FUNCTION_SWITCH_{i}'
|
f_sw_marker = f"FUNCTION_SWITCH_{i}"
|
||||||
if f_sw_marker in hw_defs:
|
if f_sw_marker in hw_defs:
|
||||||
switch = find_switch(hw_defs[f_sw_marker])
|
switch = find_switch(hw_defs[f_sw_marker])
|
||||||
if switch:
|
if switch:
|
||||||
switch.type = 'FSWITCH'
|
switch.type = "FSWITCH"
|
||||||
switch.name = f'SW{i}'
|
switch.name = f"SW{i}"
|
||||||
|
else:
|
||||||
|
switch = SwitchCustom(f"SW{i}", Switch.TYPE_2POS)
|
||||||
|
switch.type = "FSWITCH"
|
||||||
|
switches.append(switch)
|
||||||
|
|
||||||
return switches
|
return switches
|
||||||
|
|||||||
@@ -1,34 +1,32 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# These methods are used to build helper indexes on JSON structures
|
# These methods are used to build helper indexes on JSON structures
|
||||||
#
|
#
|
||||||
def build_adc_index(adc_inputs):
|
def build_adc_index(adc_inputs):
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
index = {}
|
index = {}
|
||||||
for adc_input in adc_inputs['inputs']:
|
for adc_input in adc_inputs["inputs"]:
|
||||||
name = adc_input['name']
|
name = adc_input["name"]
|
||||||
index[name] = i
|
index[name] = i
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
|
||||||
def append_to_index(d, key, val):
|
def append_to_index(d, key, val):
|
||||||
if key not in d:
|
if key not in d:
|
||||||
d[key] = []
|
d[key] = []
|
||||||
|
|
||||||
d[key].append(val)
|
d[key].append(val)
|
||||||
|
|
||||||
def build_adc_gpio_port_index(adc_inputs):
|
|
||||||
|
|
||||||
|
def build_adc_gpio_port_index(adc_inputs):
|
||||||
i = 0
|
i = 0
|
||||||
gpios = {}
|
gpios = {}
|
||||||
for adc_input in adc_inputs['inputs']:
|
for adc_input in adc_inputs["inputs"]:
|
||||||
|
if adc_input["adc"] == "SPI":
|
||||||
if adc_input['adc'] == 'SPI':
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
gpio = adc_input['gpio']
|
gpio = adc_input["gpio"]
|
||||||
if gpio is None:
|
if gpio is None:
|
||||||
i = i + 1
|
i = i + 1
|
||||||
continue
|
continue
|
||||||
@@ -36,57 +34,60 @@ def build_adc_gpio_port_index(adc_inputs):
|
|||||||
if gpio not in gpios:
|
if gpio not in gpios:
|
||||||
gpios[gpio] = []
|
gpios[gpio] = []
|
||||||
|
|
||||||
pin = {
|
pin = {"pin": adc_input["pin"], "idx": i}
|
||||||
'pin': adc_input['pin'],
|
|
||||||
'idx': i
|
|
||||||
}
|
|
||||||
|
|
||||||
gpios[gpio].append(pin)
|
gpios[gpio].append(pin)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
return gpios
|
return gpios
|
||||||
|
|
||||||
def build_switch_gpio_port_index(switches):
|
|
||||||
|
|
||||||
i = 0
|
def build_switch_gpio_port_index(switches):
|
||||||
gpios = {}
|
gpios = {}
|
||||||
for switch in switches:
|
for switch in switches:
|
||||||
sw_type = switch['type']
|
sw_type = switch["type"]
|
||||||
|
|
||||||
if sw_type == '2POS' or sw_type == 'FSWITCH':
|
if sw_type == "2POS" or sw_type == "FSWITCH":
|
||||||
append_to_index(gpios, switch['gpio'], switch['pin'])
|
gpio = switch.get("gpio")
|
||||||
|
pin = switch.get("pin")
|
||||||
|
if gpio is not None and pin is not None:
|
||||||
|
append_to_index(gpios, gpio, pin)
|
||||||
|
|
||||||
elif sw_type == '3POS':
|
elif sw_type == "3POS":
|
||||||
|
gpio_high = switch.get("gpio_high")
|
||||||
|
pin_high = switch.get("pin_high")
|
||||||
|
if gpio_high is not None and pin_high is not None:
|
||||||
|
append_to_index(gpios, gpio_high, pin_high)
|
||||||
|
|
||||||
append_to_index(gpios, switch['gpio_high'], switch['pin_high'])
|
gpio_low = switch.get("gpio_low")
|
||||||
append_to_index(gpios, switch['gpio_low'], switch['pin_low'])
|
pin_low = switch.get("pin_low")
|
||||||
|
if gpio_low is not None and pin_low is not None:
|
||||||
|
append_to_index(gpios, gpio_low, pin_low)
|
||||||
|
|
||||||
return gpios
|
return gpios
|
||||||
|
|
||||||
|
|
||||||
def build_trim_gpio_port_index(trims):
|
def build_trim_gpio_port_index(trims):
|
||||||
|
|
||||||
def index_contact(gpios, contact):
|
def index_contact(gpios, contact):
|
||||||
gpio = contact['gpio']
|
gpio = contact["gpio"]
|
||||||
pin = contact['pin']
|
pin = contact["pin"]
|
||||||
if gpio and pin:
|
if gpio and pin:
|
||||||
append_to_index(gpios, contact['gpio'], contact['pin'])
|
append_to_index(gpios, contact["gpio"], contact["pin"])
|
||||||
|
|
||||||
i = 0
|
|
||||||
gpios = {}
|
gpios = {}
|
||||||
for trim in trims:
|
for trim in trims:
|
||||||
dec = trim.get('dec')
|
dec = trim.get("dec")
|
||||||
inc = trim.get('inc')
|
inc = trim.get("inc")
|
||||||
if dec and inc:
|
if dec and inc:
|
||||||
index_contact(gpios, dec)
|
index_contact(gpios, dec)
|
||||||
index_contact(gpios, inc)
|
index_contact(gpios, inc)
|
||||||
|
|
||||||
return gpios
|
return gpios
|
||||||
|
|
||||||
def build_key_gpio_port_index(keys):
|
|
||||||
|
|
||||||
i = 0
|
def build_key_gpio_port_index(keys):
|
||||||
gpios = {}
|
gpios = {}
|
||||||
for key in keys:
|
for key in keys:
|
||||||
append_to_index(gpios, key['gpio'], key['pin'])
|
append_to_index(gpios, key["gpio"], key["pin"])
|
||||||
|
|
||||||
return gpios
|
return gpios
|
||||||
|
|||||||
@@ -343,6 +343,59 @@ LEGACY_NAMES = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"targets": {"gx12"},
|
||||||
|
"inputs": {
|
||||||
|
"LH": {
|
||||||
|
"yaml": "Rud",
|
||||||
|
"lua": "rud",
|
||||||
|
"description": "Rudder"
|
||||||
|
},
|
||||||
|
"LV": {
|
||||||
|
"yaml": "Ele",
|
||||||
|
"lua": "ele",
|
||||||
|
"description": "Elevator"
|
||||||
|
},
|
||||||
|
"RV": {
|
||||||
|
"yaml": "Thr",
|
||||||
|
"lua": "thr",
|
||||||
|
"description": "Throttle"
|
||||||
|
},
|
||||||
|
"RH": {
|
||||||
|
"yaml": "Ail",
|
||||||
|
"lua": "ail",
|
||||||
|
"description": "Aileron"
|
||||||
|
},
|
||||||
|
"P1": {
|
||||||
|
"yaml": "POT1",
|
||||||
|
"lua": "p1",
|
||||||
|
"label": "P1",
|
||||||
|
"short_label": "1",
|
||||||
|
"description": "Potentiometer 1"
|
||||||
|
},
|
||||||
|
"P2": {
|
||||||
|
"yaml": "POT2",
|
||||||
|
"lua": "p2",
|
||||||
|
"label": "P2",
|
||||||
|
"short_label": "2",
|
||||||
|
"description": "Potentiometer 2"
|
||||||
|
},
|
||||||
|
"SL1": {
|
||||||
|
"yaml": "SLIDER1",
|
||||||
|
"lua": "s1",
|
||||||
|
"label": "S1",
|
||||||
|
"short_label": "S1",
|
||||||
|
"description": "Left slider"
|
||||||
|
},
|
||||||
|
"SL2": {
|
||||||
|
"yaml": "SLIDER2",
|
||||||
|
"lua": "s2",
|
||||||
|
"label": "S2",
|
||||||
|
"short_label": "S2",
|
||||||
|
"description": "Right slider"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"targets": {"mt12"},
|
"targets": {"mt12"},
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
|||||||
@@ -4,7 +4,14 @@ POT_CONFIG = {
|
|||||||
"boxer": {
|
"boxer": {
|
||||||
"P1": {"default": "POT_CENTER"},
|
"P1": {"default": "POT_CENTER"},
|
||||||
"P2": {"default": "POT_CENTER"},
|
"P2": {"default": "POT_CENTER"},
|
||||||
"P3": {"default": "MULTIPOS"}
|
"S1": {"default": "SLIDER"},
|
||||||
|
"S2": {"default": "SLIDER"}
|
||||||
|
},
|
||||||
|
"gx12": {
|
||||||
|
"P1": {"default": "POT_CENTER"},
|
||||||
|
"P2": {"default": "POT_CENTER"},
|
||||||
|
"SL1": {"default": "SLIDER"},
|
||||||
|
"SL2": {"default": "SLIDER"}
|
||||||
},
|
},
|
||||||
"el18": {
|
"el18": {
|
||||||
"P1": {"default": "POT_CENTER"},
|
"P1": {"default": "POT_CENTER"},
|
||||||
|
|||||||
@@ -11,15 +11,18 @@ static const stm32_switch_t _switch_defs[] = {
|
|||||||
{% if switch.type == '2POS' %}
|
{% if switch.type == '2POS' %}
|
||||||
{
|
{
|
||||||
"{{ switch.name }}",
|
"{{ switch.name }}",
|
||||||
{{ switch.gpio }}, {{ switch.pin }},
|
{{ switch.gpio or "nullptr" }},
|
||||||
|
{{ switch.pin or 0 }},
|
||||||
nullptr, 0,
|
nullptr, 0,
|
||||||
SWITCH_HW_2POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
SWITCH_HW_2POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
||||||
},
|
},
|
||||||
{% elif switch.type == '3POS' %}
|
{% elif switch.type == '3POS' %}
|
||||||
{
|
{
|
||||||
"{{ switch.name }}",
|
"{{ switch.name }}",
|
||||||
{{ switch.gpio_high }}, {{ switch.pin_high }},
|
{{ switch.gpio_high or "nullptr" }},
|
||||||
{{ switch.gpio_low }}, {{ switch.pin_low }},
|
{{ switch.pin_high or 0 }},
|
||||||
|
{{ switch.gpio_low or "nullptr" }},
|
||||||
|
{{ switch.pin_low or 0 }},
|
||||||
SWITCH_HW_3POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
SWITCH_HW_3POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
||||||
},
|
},
|
||||||
{% elif switch.type == 'ADC' %}
|
{% elif switch.type == 'ADC' %}
|
||||||
@@ -34,7 +37,8 @@ static const stm32_switch_t _switch_defs[] = {
|
|||||||
{% for switch in function_switches %}
|
{% for switch in function_switches %}
|
||||||
{
|
{
|
||||||
"{{ switch.name }}",
|
"{{ switch.name }}",
|
||||||
{{ switch.gpio }}, {{ switch.pin }},
|
{{ switch.gpio or "nullptr" }},
|
||||||
|
{{ switch.pin or 0 }},
|
||||||
nullptr, 0,
|
nullptr, 0,
|
||||||
SWITCH_HW_2POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
SWITCH_HW_2POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,11 +5,25 @@ SWITCH_CONFIG = {
|
|||||||
# left side
|
# left side
|
||||||
"SA": {"default": "2POS", "display": [0, 0]},
|
"SA": {"default": "2POS", "display": [0, 0]},
|
||||||
"SB": {"default": "3POS", "display": [0, 1]},
|
"SB": {"default": "3POS", "display": [0, 1]},
|
||||||
"SE": {"default": "2POS", "display": [0, 2]},
|
"SE": {"default": "3POS", "display": [0, 2]},
|
||||||
|
"SG": {"default": "2POS", "display": [0, 3]},
|
||||||
# right side
|
# right side
|
||||||
"SC": {"default": "3POS", "display": [1, 0]},
|
"SC": {"default": "3POS", "display": [1, 0]},
|
||||||
"SD": {"default": "2POS", "display": [1, 1]},
|
"SD": {"default": "2POS", "display": [1, 1]},
|
||||||
"SF": {"default": "TOGGLE", "display": [1, 2]},
|
"SF": {"default": "TOGGLE", "display": [1, 2]},
|
||||||
|
"SH": {"default": "2POS", "display": [1, 3]},
|
||||||
|
},
|
||||||
|
"gx12": {
|
||||||
|
# left side
|
||||||
|
"SA": {"default": "TOGGLE", "display": [0, 0]},
|
||||||
|
"SB": {"default": "3POS", "display": [0, 1]},
|
||||||
|
"SE": {"default": "3POS", "display": [0, 2]},
|
||||||
|
"SG": {"default": "TOGGLE", "display": [0, 3]},
|
||||||
|
# right side
|
||||||
|
"SC": {"default": "3POS", "display": [1, 1]},
|
||||||
|
"SD": {"default": "TOGGLE", "display": [1, 0]},
|
||||||
|
"SF": {"default": "3POS", "display": [1, 2]},
|
||||||
|
"SH": {"default": "TOGGLE", "display": [1, 3]},
|
||||||
},
|
},
|
||||||
"commando8": {
|
"commando8": {
|
||||||
# left side
|
# left side
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ get_target_build_options() {
|
|||||||
tx12mk2)
|
tx12mk2)
|
||||||
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2"
|
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2"
|
||||||
;;
|
;;
|
||||||
|
gx12)
|
||||||
|
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=GX12"
|
||||||
|
;;
|
||||||
boxer)
|
boxer)
|
||||||
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER"
|
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER"
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ cd build
|
|||||||
declare -a simulator_plugins=(x9lite x9lites
|
declare -a simulator_plugins=(x9lite x9lites
|
||||||
x7 x7access
|
x7 x7access
|
||||||
t8 t12 t12max tx12 tx12mk2
|
t8 t12 t12max tx12 tx12mk2
|
||||||
zorro commando8 boxer pocket mt12
|
zorro commando8 boxer pocket mt12 gx12
|
||||||
tlite tpro tprov2 tpros bumblebee lr3pro t14
|
tlite tpro tprov2 tpros bumblebee lr3pro t14
|
||||||
x9d x9dp x9dp2019 x9e
|
x9d x9dp x9dp2019 x9e
|
||||||
xlite xlites
|
xlite xlites
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|||||||
|
|
||||||
: "${SRCDIR:=$(dirname "$(pwd)/$0")/..}"
|
: "${SRCDIR:=$(dirname "$(pwd)/$0")/..}"
|
||||||
|
|
||||||
: ${FLAVOR:="nv14;el18;t12;t12max;t15;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;bumblebee;t20;t20v2;t14;lr3pro;mt12;tx12;tx12mk2;boxer;tx16s;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites;f16;v14;v12"}
|
: ${FLAVOR:="nv14;el18;t12;t12max;t15;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;bumblebee;t20;t20v2;t14;lr3pro;mt12;gx12;tx12;tx12mk2;boxer;tx16s;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites;f16;v14;v12"}
|
||||||
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}
|
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}
|
||||||
|
|
||||||
# wipe build directory clean
|
# wipe build directory clean
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ if [[ -n ${GCC_ARM} ]] ; then
|
|||||||
export PATH=${GCC_ARM}:$PATH
|
export PATH=${GCC_ARM}:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
: ${FLAVOR:="t15;tx16s;nv14;pl18;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16"}
|
: ${FLAVOR:="t15;tx16s;nv14;pl18;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16;gx12"}
|
||||||
: ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
|
: ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
|
||||||
|
|
||||||
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDISABLE_COMPANION=YES -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}
|
: ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDISABLE_COMPANION=YES -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
export BRANCH_NAME="main" # main|2.9|...
|
export BRANCH_NAME="main" # main|2.9|...
|
||||||
export RADIO_TYPE="tx16s" # tx16s|x10|x10express|x12s|x9d|x9dp|x9lite|x9lites|x7|x7access|t12|t12max|tx12|tx12mk2|mt12|boxer|t8|zorro|pocket|tlite|tpro|t20|t20v2|t14|lr3pro|xlite|xlites|x9dp2019|x9e|x9e-hall|t15|t16|t18|nv14|commando8
|
export RADIO_TYPE="tx16s" # tx16s|x10|x10express|x12s|x9d|x9dp|x9lite|x9lites|x7|x7access|t12|t12max|tx12|tx12mk2|mt12|gx12|boxer|t8|zorro|pocket|tlite|tpro|t20|t20v2|t14|lr3pro|xlite|xlites|x9dp2019|x9e|x9e-hall|t15|t16|t18|nv14|commando8
|
||||||
|
|
||||||
export BUILD_OPTIONS="-DDEFAULT_MODE=2 -DGVARS=YES"
|
export BUILD_OPTIONS="-DDEFAULT_MODE=2 -DGVARS=YES"
|
||||||
|
|
||||||
@@ -33,6 +33,9 @@ case $RADIO_TYPE in
|
|||||||
mt12)
|
mt12)
|
||||||
BUILD_OPTIONS+=" -DPCB=X7 -DPCBREV=MT12 -DINTERNAL_MODULE_MULTI=ON"
|
BUILD_OPTIONS+=" -DPCB=X7 -DPCBREV=MT12 -DINTERNAL_MODULE_MULTI=ON"
|
||||||
;;
|
;;
|
||||||
|
gx12)
|
||||||
|
BUILD_OPTIONS+=" -DPCB=X7 -DPCBREV=GX12 -DINTERNAL_MODULE_MULTI=ON"
|
||||||
|
;;
|
||||||
tx12)
|
tx12)
|
||||||
BUILD_OPTIONS+=" -DPCB=X7 -DPCBREV=TX12"
|
BUILD_OPTIONS+=" -DPCB=X7 -DPCBREV=TX12"
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user