From 02660c763ae1388e02fd7606b795269e522d8e10 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 19 Oct 2019 23:08:51 +0200 Subject: [PATCH 001/188] mixer scheduler --- radio/src/CMakeLists.txt | 1 + radio/src/gui/gui_common.h | 3 +- radio/src/mixer_scheduler.cpp | 79 +++++++++++ radio/src/mixer_scheduler.h | 84 +++++++++++ radio/src/opentx.h | 1 - radio/src/pulses/dsm2.cpp | 6 +- radio/src/pulses/multi.cpp | 2 - radio/src/pulses/pulses.cpp | 109 ++++++++++---- radio/src/pulses/pulses.h | 9 +- radio/src/pulses/pxx.h | 12 +- radio/src/pulses/sbus.cpp | 2 - radio/src/rtos.h | 32 ++++- .../common/arm/stm32/heartbeat_driver.cpp | 3 + .../arm/stm32/intmodule_serial_driver.cpp | 37 ----- .../arm/stm32/mixer_scheduler_driver.cpp | 81 +++++++++++ radio/src/targets/horus/CMakeLists.txt | 1 + radio/src/targets/horus/board.cpp | 1 + radio/src/targets/horus/board.h | 5 +- radio/src/targets/horus/extmodule_driver.cpp | 44 ++++-- radio/src/targets/horus/hal.h | 7 + radio/src/targets/taranis/CMakeLists.txt | 1 + radio/src/targets/taranis/board.cpp | 3 +- radio/src/targets/taranis/board.h | 2 +- .../src/targets/taranis/extmodule_driver.cpp | 39 +++-- radio/src/targets/taranis/hal.h | 7 + radio/src/tasks.cpp | 89 ++++++------ radio/src/telemetry/crossfire.cpp | 20 +++ radio/src/telemetry/crossfire.h | 6 +- radio/src/telemetry/multi.cpp | 133 ++---------------- radio/src/telemetry/multi.h | 22 --- radio/src/telemetry/telemetry.cpp | 86 +++++++++++ radio/src/telemetry/telemetry.h | 31 ++++ 32 files changed, 644 insertions(+), 314 deletions(-) create mode 100644 radio/src/mixer_scheduler.cpp create mode 100644 radio/src/mixer_scheduler.h create mode 100644 radio/src/targets/common/arm/stm32/mixer_scheduler_driver.cpp diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 47a1fed2a..39ea7e52e 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -378,6 +378,7 @@ set(SRC strhelpers.cpp switches.cpp mixer.cpp + mixer_scheduler.cpp stamp.cpp timers.cpp trainer.cpp diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index dd473eee8..3894bf633 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -185,6 +185,7 @@ inline uint8_t MODULE_CHANNELS_ROWS(int moduleIdx) } #if defined(MULTIMODULE) + inline uint8_t MULTI_DISABLE_CHAN_MAP_ROW(uint8_t moduleIdx) { if (!isModuleMultimodule(moduleIdx)) @@ -276,7 +277,7 @@ inline uint8_t MULTIMODULE_HASOPTIONS(uint8_t moduleIdx) #define MULTIMODULE_MODULE_ROWS(moduleIdx) (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) && !IS_RX_MULTI(moduleIdx)) ? (uint8_t) 0 : HIDDEN_ROW, (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) && !IS_RX_MULTI(moduleIdx)) ? (uint8_t) 0 : HIDDEN_ROW, MULTI_DISABLE_CHAN_MAP_ROW(moduleIdx), // AUTOBIND, DISABLE TELEM, DISABLE CN.MAP #define MULTIMODULE_TYPE_ROW(moduleIdx) isModuleMultimodule(moduleIdx) ? MULTIMODULE_RFPROTO_COLUMNS(moduleIdx) : HIDDEN_ROW, -#define MULTIMODULE_STATUS_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? TITLE_ROW : HIDDEN_ROW, (isModuleMultimodule(moduleIdx) && getMultiSyncStatus(moduleIdx).isValid()) ? TITLE_ROW : HIDDEN_ROW, +#define MULTIMODULE_STATUS_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? TITLE_ROW : HIDDEN_ROW, (isModuleMultimodule(moduleIdx) && getModuleSyncStatus(moduleIdx).isValid()) ? TITLE_ROW : HIDDEN_ROW, #define MULTIMODULE_MODE_ROWS(moduleIdx) (g_model.moduleData[moduleIdx].multi.customProto) ? (uint8_t) 3 : MULTIMODULE_HAS_SUBTYPE(moduleIdx) ? (uint8_t)2 : (uint8_t)1 #define MULTIMODULE_TYPE_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? (uint8_t) 0 : HIDDEN_ROW, #define MULTIMODULE_SUBTYPE_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? MULTIMODULE_RFPROTO_COLUMNS(moduleIdx) : HIDDEN_ROW, diff --git a/radio/src/mixer_scheduler.cpp b/radio/src/mixer_scheduler.cpp new file mode 100644 index 000000000..b29c821c8 --- /dev/null +++ b/radio/src/mixer_scheduler.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" +#include "mixer_scheduler.h" + +#if !defined(SIMU) + +// Global trigger flag +RTOS_FLAG_HANDLE mixerFlag; + +// Mixer schedule +struct MixerSchedule { + + // period in us + volatile uint16_t period; +}; + +static MixerSchedule mixerSchedules[NUM_MODULES]; + +uint16_t getMixerSchedulerPeriod() +{ + if (mixerSchedules[INTERNAL_MODULE].period) { + return mixerSchedules[INTERNAL_MODULE].period; + } + else if (mixerSchedules[EXTERNAL_MODULE].period) { + return mixerSchedules[EXTERNAL_MODULE].period; + } + + return MIXER_SCHEDULER_DEFAULT_PERIOD_US; +} + +void mixerSchedulerInit() +{ + RTOS_CREATE_FLAG(mixerFlag); + memset(mixerSchedules, 0, sizeof(mixerSchedules)); +} + +void mixerSchedulerSetPeriod(uint8_t moduleIdx, uint16_t periodUs) +{ + if ((periodUs > 0) && (periodUs < MIN_REFRESH_RATE)) { + periodUs = MIN_REFRESH_RATE; + } + else if ((periodUs > 0) && (periodUs > MAX_REFRESH_RATE)) { + periodUs = MAX_REFRESH_RATE; + } + + mixerSchedules[moduleIdx].period = periodUs; +} + +bool mixerSchedulerWaitForTrigger(uint8_t timeoutMs) +{ + RTOS_CLEAR_FLAG(mixerFlag); + return RTOS_WAIT_FLAG(mixerFlag, timeoutMs); +} + +void mixerSchedulerISRTrigger() +{ + RTOS_ISR_SET_FLAG(mixerFlag); +} + +#endif diff --git a/radio/src/mixer_scheduler.h b/radio/src/mixer_scheduler.h new file mode 100644 index 000000000..ccded9a5e --- /dev/null +++ b/radio/src/mixer_scheduler.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _MIXER_SCHEDULER_H_ +#define _MIXER_SCHEDULER_H_ + +#define MIXER_SCHEDULER_DEFAULT_PERIOD_US 4000u // 4ms + +#define MIN_REFRESH_RATE 4000 /* us */ +#define MAX_REFRESH_RATE 25000 /* us */ + +#if !defined(SIMU) + +// Call once to initialize the mixer scheduler +void mixerSchedulerInit(); + +// Configure and start the scheduler timer +void mixerSchedulerStart(); + +// Stop the scheduler timer +void mixerSchedulerStop(); + +// Set the timer counter to 0 +void mixerSchedulerResetTimer(); + +// Set the scheduling period for a given module +void mixerSchedulerSetPeriod(uint8_t moduleIdx, uint16_t periodUs); + +// Wait for the scheduler timer to trigger +// returns true if timeout, false otherwise +bool mixerSchedulerWaitForTrigger(uint8_t timeoutMs); + +// Enable the timer trigger +void mixerSchedulerEnableTrigger(); + +// Disable the timer trigger +void mixerSchedulerDisableTrigger(); + +// Fetch the current scheduling period +uint16_t getMixerSchedulerPeriod(); + +// Trigger mixer from an ISR +void mixerSchedulerISRTrigger(); + +#else + +#define mixerSchedulerInit() +#define mixerSchedulerStart() +#define mixerSchedulerStop() +#define mixerSchedulerResetTimer() +#define mixerSchedulerSetPeriod(m,p) + +static inline bool mixerSchedulerWaitForTrigger(uint8_t timeout) +{ + simuSleep(timeout); + return false; +} + +#define mixerSchedulerEnableTrigger() +#define mixerSchedulerDisableTrigger() + +#define getMixerSchedulerPeriod() (MIXER_SCHEDULER_DEFAULT_PERIOD_US) +#define mixerSchedulerISRTrigger() + +#endif + +#endif diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 52a51719b..394a0734f 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -483,7 +483,6 @@ extern uint32_t nextMixerTime[NUM_MODULES]; void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms); void evalMixes(uint8_t tick10ms); void doMixerCalculations(); -void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms); void checkTrims(); extern uint8_t currentBacklightBright; diff --git a/radio/src/pulses/dsm2.cpp b/radio/src/pulses/dsm2.cpp index 3612f60db..34a10b3d6 100644 --- a/radio/src/pulses/dsm2.cpp +++ b/radio/src/pulses/dsm2.cpp @@ -76,7 +76,6 @@ void _send_1(uint8_t v) *extmodulePulsesData.dsm2.ptr++ = v - 1; extmodulePulsesData.dsm2.index += 1; - extmodulePulsesData.dsm2.rest -= v; } void sendByteDsm2(uint8_t b) // max 10 changes 0 10 10 10 10 1 @@ -101,9 +100,9 @@ void sendByteDsm2(uint8_t b) // max 10 changes 0 10 10 10 10 1 void putDsm2Flush() { if (extmodulePulsesData.dsm2.index & 1) - *extmodulePulsesData.dsm2.ptr++ = extmodulePulsesData.dsm2.rest; + *extmodulePulsesData.dsm2.ptr++ = 60000; else - *(extmodulePulsesData.dsm2.ptr - 1) = extmodulePulsesData.dsm2.rest; + *(extmodulePulsesData.dsm2.ptr - 1) = 60000; } #endif @@ -119,7 +118,6 @@ void setupPulsesDSM2() extmodulePulsesData.dsm2.serialBitCount = 0 ; #else extmodulePulsesData.dsm2.index = 0; - extmodulePulsesData.dsm2.rest = DSM2_PERIOD * 2000; #endif extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses; diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index dcc7c7f9c..4f61caf72 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -209,10 +209,8 @@ void setupPulsesMultiExternalModule() extmodulePulsesData.dsm2.serialByte = 0 ; extmodulePulsesData.dsm2.serialBitCount = 0 ; #else - extmodulePulsesData.dsm2.rest = getMultiSyncStatus(EXTERNAL_MODULE).getAdjustedRefreshRate(); extmodulePulsesData.dsm2.index = 0; #endif - extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses; setupPulsesMulti(EXTERNAL_MODULE); diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index d6833bfe9..1681157bc 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -21,6 +21,7 @@ #include "opentx.h" #include "io/frsky_pxx2.h" #include "pulses/pxx2.h" +#include "mixer_scheduler.h" uint8_t s_pulses_paused = 0; ModuleState moduleState[NUM_MODULES]; @@ -62,7 +63,7 @@ void getModuleSyncStatusString(uint8_t moduleIdx, char * statusText) *statusText = 0; #if defined(MULTIMODULE) if (isModuleMultimodule(moduleIdx)) { - getMultiSyncStatus(moduleIdx).getRefreshString(statusText); + getModuleSyncStatus(moduleIdx).getRefreshString(statusText); } #endif #if defined(AFHDS3) @@ -225,12 +226,14 @@ void enablePulsesExternalModule(uint8_t protocol) #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: extmodulePxx1PulsesStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX_PULSES_PERIOD); break; #endif #if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML) case PROTOCOL_CHANNELS_PXX1_SERIAL: extmodulePxx1SerialStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD); break; #endif @@ -238,59 +241,69 @@ void enablePulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_DSM2_LP45: case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: - extmoduleSerialStart(DSM2_BAUDRATE, DSM2_PERIOD * 2000, false); + extmoduleSerialStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, DSM2_PERIOD); break; #endif #if defined(CROSSFIRE) case PROTOCOL_CHANNELS_CROSSFIRE: EXTERNAL_MODULE_ON(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD); break; #endif #if defined(GHOST) case PROTOCOL_CHANNELS_GHOST: EXTERNAL_MODULE_ON(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD); break; #endif #if defined(PXX2) && defined(EXTMODULE_USART) case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: extmoduleInvertedSerialStart(PXX2_HIGHSPEED_BAUDRATE); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_PERIOD); break; case PROTOCOL_CHANNELS_PXX2_LOWSPEED: extmoduleInvertedSerialStart(PXX2_LOWSPEED_BAUDRATE); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_PERIOD); break; #endif #if defined(MULTIMODULE) case PROTOCOL_CHANNELS_MULTIMODULE: - extmoduleSerialStart(MULTIMODULE_BAUDRATE, MULTIMODULE_PERIOD * 2000, true); + extmoduleSerialStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD); break; #endif #if defined(SBUS) case PROTOCOL_CHANNELS_SBUS: - extmoduleSerialStart(SBUS_BAUDRATE, SBUS_PERIOD_HALF_US, false); + extmoduleSerialStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD); break; #endif #if defined(PPM) case PROTOCOL_CHANNELS_PPM: extmodulePpmStart(); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE)); break; #endif #if defined(AFHDS3) case PROTOCOL_CHANNELS_AFHDS3: extmodulePulsesData.afhds3.init(EXTERNAL_MODULE); - extmoduleSerialStart(AFHDS3_BAUDRATE, AFHDS3_COMMAND_TIMEOUT * 2000, false); + extmoduleSerialStart(/*AFHDS3_BAUDRATE, AFHDS3_COMMAND_TIMEOUT * 2000, false*/); + mixerSchedulerSetPeriod(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT * 1000 /* us */); break; #endif - default: + // external module stopped, set period to 50ms (necessary for USB Joystick, for instance) + mixerSchedulerSetPeriod(EXTERNAL_MODULE, 50000/*us*/); break; } } @@ -301,14 +314,12 @@ bool setupPulsesExternalModule(uint8_t protocol) #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE); - scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX_PULSES_PERIOD); return true; #endif #if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML) case PROTOCOL_CHANNELS_PXX1_SERIAL: extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE); - scheduleNextMixerCalculation(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD); return true; #endif @@ -316,14 +327,12 @@ bool setupPulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: case PROTOCOL_CHANNELS_PXX2_LOWSPEED: extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE); - scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_PERIOD); return true; #endif #if defined(SBUS) case PROTOCOL_CHANNELS_SBUS: setupPulsesSbus(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD); return true; #endif @@ -332,47 +341,61 @@ bool setupPulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: setupPulsesDSM2(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, DSM2_PERIOD); return true; #endif #if defined(CROSSFIRE) case PROTOCOL_CHANNELS_CROSSFIRE: + { + ModuleSyncStatus& status = getModuleSyncStatus(EXTERNAL_MODULE); + if (status.isValid()) + mixerSchedulerSetPeriod(EXTERNAL_MODULE, status.getAdjustedRefreshRate()); + else + mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD); setupPulsesCrossfire(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, CROSSFIRE_PERIOD); return true; + } #endif #if defined(GHOST) case PROTOCOL_CHANNELS_GHOST: + { + ModuleSyncStatus& status = getModuleSyncStatus(EXTERNAL_MODULE); + if (status.isValid()) + mixerSchedulerSetPeriod(EXTERNAL_MODULE, status.getAdjustedRefreshRate()); + else + mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD); setupPulsesGhost(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, GHOST_PERIOD); return true; + } #endif #if defined(MULTIMODULE) case PROTOCOL_CHANNELS_MULTIMODULE: + { + ModuleSyncStatus& status = getModuleSyncStatus(EXTERNAL_MODULE); + if (status.isValid()) + mixerSchedulerSetPeriod(EXTERNAL_MODULE, status.getAdjustedRefreshRate()); + else + mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD); setupPulsesMultiExternalModule(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, MULTIMODULE_PERIOD); return true; + } #endif #if defined(PPM) case PROTOCOL_CHANNELS_PPM: setupPulsesPPMExternalModule(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE)); return true; #endif #if defined(AFHDS3) case PROTOCOL_CHANNELS_AFHDS3: extmodulePulsesData.afhds3.setupFrame(); - scheduleNextMixerCalculation(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT); return true; #endif default: - scheduleNextMixerCalculation(EXTERNAL_MODULE, 50/*ms*/); return false; } } @@ -386,12 +409,24 @@ static void enablePulsesInternalModule(uint8_t protocol) #if defined(PXX1) && !defined(INTMODULE_USART) case PROTOCOL_CHANNELS_PXX1_PULSES: intmodulePxx1PulsesStart(); +#if defined(INTMODULE_HEARTBEAT) + // use backup trigger (1 ms later) + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1000/*us*/); +#else + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); +#endif break; #endif #if defined(PXX1) && defined(INTMODULE_USART) case PROTOCOL_CHANNELS_PXX1_SERIAL: intmodulePxx1SerialStart(); +#if defined(INTMODULE_HEARTBEAT) + // use backup trigger (1 ms later) + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1000/*us*/); +#else + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); +#endif break; #endif @@ -399,6 +434,13 @@ static void enablePulsesInternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: intmoduleSerialStart(PXX2_HIGHSPEED_BAUDRATE, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b); resetAccessAuthenticationCount(); + +#if defined(INTMODULE_HEARTBEAT) + // use backup trigger (1 ms later) + mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 1000/*us*/); +#else + mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD); +#endif break; #endif @@ -406,17 +448,20 @@ static void enablePulsesInternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_MULTIMODULE: intmodulePulsesData.multi.initFrame(); intmoduleSerialStart(MULTIMODULE_BAUDRATE, true, USART_Parity_Even, USART_StopBits_2, USART_WordLength_9b); - intmoduleTimerStart(MULTIMODULE_PERIOD); + mixerSchedulerSetPeriod(INTERNAL_MODULE, MULTIMODULE_PERIOD); break; #endif #if defined(INTERNAL_MODULE_PPM) case PROTOCOL_CHANNELS_PPM: intmodulePpmStart(); + mixerSchedulerSetPeriod(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE)); break; #endif default: + // internal module stopped, set internal period to 0 and start the scheduler + mixerSchedulerSetPeriod(INTERNAL_MODULE, 0); break; } } @@ -427,18 +472,18 @@ bool setupPulsesInternalModule(uint8_t protocol) #if defined(HARDWARE_INTERNAL_MODULE) && defined(PXX1) && !defined(INTMODULE_USART) case PROTOCOL_CHANNELS_PXX1_PULSES: intmodulePulsesData.pxx.setupFrame(INTERNAL_MODULE); - scheduleNextMixerCalculation(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); +#if defined(INTMODULE_HEARTBEAT) + mixerSchedulerResetTimer(); + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1000 /* backup */); +#else + mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); +#endif return true; #endif #if defined(PXX1) && defined(INTMODULE_USART) case PROTOCOL_CHANNELS_PXX1_SERIAL: intmodulePulsesData.pxx_uart.setupFrame(INTERNAL_MODULE); -#if defined(INTMODULE_HEARTBEAT) - scheduleNextMixerCalculation(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1 /* backup */); -#else - scheduleNextMixerCalculation(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); -#endif return true; #endif @@ -447,15 +492,16 @@ bool setupPulsesInternalModule(uint8_t protocol) { bool result = intmodulePulsesData.pxx2.setupFrame(INTERNAL_MODULE); if (moduleState[INTERNAL_MODULE].mode == MODULE_MODE_SPECTRUM_ANALYSER || moduleState[INTERNAL_MODULE].mode == MODULE_MODE_POWER_METER) { - scheduleNextMixerCalculation(INTERNAL_MODULE, PXX2_TOOLS_PERIOD); + mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_TOOLS_PERIOD); } else { #if defined(INTMODULE_HEARTBEAT) - scheduleNextMixerCalculation(INTERNAL_MODULE, PXX2_PERIOD + 1 /* backup */); + mixerSchedulerResetTimer(); + mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 1000 /* backup */); #else - scheduleNextMixerCalculation(INTERNAL_MODULE, PXX2_PERIOD); + mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD); #endif - } + } return result; } #endif @@ -463,19 +509,20 @@ bool setupPulsesInternalModule(uint8_t protocol) #if defined(PCBTARANIS) && defined(INTERNAL_MODULE_PPM) case PROTOCOL_CHANNELS_PPM: setupPulsesPPMInternalModule(); - scheduleNextMixerCalculation(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE)); + // probably useless, as the interval did not change since "enable" function + mixerSchedulerSetPeriod(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE)); return true; #endif #if defined(INTERNAL_MODULE_MULTI) case PROTOCOL_CHANNELS_MULTIMODULE: setupPulsesMultiInternalModule(); - scheduleNextMixerCalculation(INTERNAL_MODULE, MULTIMODULE_PERIOD); + mixerSchedulerSetPeriod(INTERNAL_MODULE, MULTIMODULE_PERIOD); return true; #endif default: - scheduleNextMixerCalculation(INTERNAL_MODULE, 10 /*ms*/); // used for USB sim for example + mixerSchedulerSetPeriod(INTERNAL_MODULE, 10000 /*us*/); // used for USB sim for example return false; } } diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 84ecee015..4a1fafe65 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -216,21 +216,20 @@ typedef Dsm2SerialPulsesData Dsm2PulsesData; PACK(struct Dsm2TimerPulsesData { pulse_duration_t pulses[MAX_PULSES_TRANSITIONS]; pulse_duration_t * ptr; - uint16_t rest; uint8_t index; }); typedef Dsm2TimerPulsesData Dsm2PulsesData; #endif #define PPM_PERIOD_HALF_US(module) ((g_model.moduleData[module].ppm.frameLength * 5 + 225) * 200) /*half us*/ -#define PPM_PERIOD(module) (PPM_PERIOD_HALF_US(module) / 2000) /*ms*/ +#define PPM_PERIOD(module) (PPM_PERIOD_HALF_US(module) / 2) /*us*/ #define DSM2_BAUDRATE 125000 -#define DSM2_PERIOD 22 /*ms*/ +#define DSM2_PERIOD 22000 /*us*/ #define SBUS_BAUDRATE 100000 #define SBUS_PERIOD_HALF_US ((g_model.moduleData[EXTERNAL_MODULE].sbus.refreshRate * 5 + 225) * 200) /*half us*/ -#define SBUS_PERIOD (SBUS_PERIOD_HALF_US / 2000) /*ms*/ +#define SBUS_PERIOD (SBUS_PERIOD_HALF_US / 2) /*us*/ #define MULTIMODULE_BAUDRATE 100000 -#define MULTIMODULE_PERIOD 7 /*ms*/ +#define MULTIMODULE_PERIOD 7000 /*us*/ #define CROSSFIRE_FRAME_MAXLEN 64 PACK(struct CrossfirePulsesData { diff --git a/radio/src/pulses/pxx.h b/radio/src/pulses/pxx.h index 5d0bfaf05..ae84d77b2 100644 --- a/radio/src/pulses/pxx.h +++ b/radio/src/pulses/pxx.h @@ -29,20 +29,20 @@ #define PXX2_LOWSPEED_BAUDRATE 230400 #define PXX2_HIGHSPEED_BAUDRATE 450000 -#define PXX2_PERIOD 4 // 4ms -#define PXX2_TOOLS_PERIOD 1 // 1ms +#define PXX2_PERIOD 4000/*us*/ +#define PXX2_TOOLS_PERIOD 1000/*us*/ #define PXX2_FRAME_MAXLENGTH 64 -#define PXX_PULSES_PERIOD 9/*ms*/ -#define EXTMODULE_PXX1_SERIAL_PERIOD 4/*ms*/ +#define PXX_PULSES_PERIOD 9000/*us*/ +#define EXTMODULE_PXX1_SERIAL_PERIOD 4000/*us*/ #define EXTMODULE_PXX1_SERIAL_BAUDRATE 420000 #if defined(PXX_FREQUENCY_HIGH) #define INTMODULE_PXX1_SERIAL_BAUDRATE 450000 - #define INTMODULE_PXX1_SERIAL_PERIOD 4/*ms*/ + #define INTMODULE_PXX1_SERIAL_PERIOD 4000/*us*/ #else #define INTMODULE_PXX1_SERIAL_BAUDRATE 115200 - #define INTMODULE_PXX1_SERIAL_PERIOD 9/*ms*/ + #define INTMODULE_PXX1_SERIAL_PERIOD 9000/*us*/ #endif // Used by the Sky9x family boards diff --git a/radio/src/pulses/sbus.cpp b/radio/src/pulses/sbus.cpp index a881730fc..e44abd642 100644 --- a/radio/src/pulses/sbus.cpp +++ b/radio/src/pulses/sbus.cpp @@ -55,7 +55,6 @@ static void _send_level(uint8_t v) *extmodulePulsesData.dsm2.ptr++ = v - 1; extmodulePulsesData.dsm2.index+=1; - extmodulePulsesData.dsm2.rest -=v; } void sendByteSbus(uint8_t b) // max 11 changes 0 10 10 10 10 P 1 @@ -113,7 +112,6 @@ void setupPulsesSbus() extmodulePulsesData.dsm2.serialByte = 0; extmodulePulsesData.dsm2.serialBitCount = 0; #else - extmodulePulsesData.dsm2.rest = SBUS_PERIOD_HALF_US; extmodulePulsesData.dsm2.index = 0; #endif diff --git a/radio/src/rtos.h b/radio/src/rtos.h index 6e42ebf30..a5dbd11b9 100644 --- a/radio/src/rtos.h +++ b/radio/src/rtos.h @@ -36,7 +36,9 @@ extern "C++" { typedef pthread_t RTOS_TASK_HANDLE; typedef pthread_mutex_t RTOS_MUTEX_HANDLE; + typedef uint32_t RTOS_FLAG_HANDLE; + typedef sem_t * RTOS_EVENT_HANDLE; extern uint64_t simuTimerMicros(void); @@ -76,16 +78,26 @@ extern "C++" { pthread_mutex_unlock(&mutex); } - static inline void RTOS_CREATE_FLAG(uint32_t &flag) + static inline void RTOS_CREATE_FLAG(RTOS_FLAG_HANDLE flag) { - flag = 0; // TODO: real flags (use semaphores?) } - static inline void RTOS_SET_FLAG(uint32_t &flag) + static inline void RTOS_SET_FLAG(RTOS_FLAG_HANDLE flag) { - flag = 1; } + static inline void RTOS_CLEAR_FLAG(RTOS_FLAG_HANDLE flag) + { + } + + static inline bool RTOS_WAIT_FLAG(RTOS_FLAG_HANDLE flag, uint32_t timeout) + { + simuSleep(timeout); + return false; + } + + #define RTOS_ISR_SET_FLAG RTOS_SET_FLAG + template class FakeTaskStack { @@ -146,6 +158,7 @@ template { return (uint32_t)(simuTimerMicros() / 1000); } + #elif defined(RTOS_COOS) #ifdef __cplusplus extern "C" { @@ -230,7 +243,18 @@ template #define RTOS_CREATE_FLAG(flag) flag = CoCreateFlag(false, false) #define RTOS_SET_FLAG(flag) (void)CoSetFlag(flag) + #define RTOS_CLEAR_FLAG(flag) (void)CoClearFlag(flag) + #define RTOS_WAIT_FLAG(flag,timeout) (CoWaitForSingleFlag(flag,timeout) == E_TIMEOUT) + static inline void RTOS_ISR_SET_FLAG(RTOS_FLAG_HANDLE flag) + { + CoEnterISR(); + CoSchedLock(); + isr_SetFlag(flag); + CoSchedUnlock(); + CoExitISR(); + } + #ifdef __cplusplus template class TaskStack diff --git a/radio/src/targets/common/arm/stm32/heartbeat_driver.cpp b/radio/src/targets/common/arm/stm32/heartbeat_driver.cpp index 25544c33a..269b40854 100644 --- a/radio/src/targets/common/arm/stm32/heartbeat_driver.cpp +++ b/radio/src/targets/common/arm/stm32/heartbeat_driver.cpp @@ -19,6 +19,7 @@ */ #include "opentx.h" +#include "mixer_scheduler.h" #if defined(INTMODULE_HEARTBEAT_GPIO) volatile HeartbeatCapture heartbeatCapture; @@ -77,6 +78,8 @@ void check_intmodule_heartbeat() heartbeatCapture.count++; #endif EXTI_ClearITPendingBit(INTMODULE_HEARTBEAT_EXTI_LINE); + + mixerSchedulerISRTrigger(); } } #endif diff --git a/radio/src/targets/common/arm/stm32/intmodule_serial_driver.cpp b/radio/src/targets/common/arm/stm32/intmodule_serial_driver.cpp index 56b71d97c..794c49765 100755 --- a/radio/src/targets/common/arm/stm32/intmodule_serial_driver.cpp +++ b/radio/src/targets/common/arm/stm32/intmodule_serial_driver.cpp @@ -45,12 +45,6 @@ void intmoduleStop() USART_DeInit(INTMODULE_USART); GPIO_ResetBits(INTMODULE_GPIO, INTMODULE_TX_GPIO_PIN | INTMODULE_RX_GPIO_PIN); - -#if defined(INTERNAL_MODULE_MULTI) - // stop pulses timer - INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; - INTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; -#endif } void intmodulePxx1SerialStart() @@ -103,28 +97,6 @@ void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable, uint16_t parity, } } -#if defined(INTERNAL_MODULE_MULTI) -void intmoduleTimerStart(uint32_t periodMs) -{ - // Timer - INTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; - INTMODULE_TIMER->PSC = INTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz) - INTMODULE_TIMER->ARR = periodMs * 2000; - INTMODULE_TIMER->CCR2 = (periodMs - 1) * 2000; - INTMODULE_TIMER->CCER = TIM_CCER_CC3E; - INTMODULE_TIMER->CCMR2 = 0; - INTMODULE_TIMER->EGR = 1; // Restart - - INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_0; // Toggle CC1 o/p - INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt - INTMODULE_TIMER->CR1 |= TIM_CR1_CEN; - - NVIC_EnableIRQ(INTMODULE_TIMER_IRQn); - NVIC_SetPriority(INTMODULE_TIMER_IRQn, 7); -} -#endif - #define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE) extern "C" void INTMODULE_USART_IRQHandler(void) { @@ -217,12 +189,3 @@ void intmoduleSendNextFrame() #endif } } - -#if defined(INTERNAL_MODULE_MULTI) -extern "C" void INTMODULE_TIMER_IRQHandler() -{ - INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // clear flag - setupPulsesInternalModule(); - intmoduleSendNextFrame(); -} -#endif diff --git a/radio/src/targets/common/arm/stm32/mixer_scheduler_driver.cpp b/radio/src/targets/common/arm/stm32/mixer_scheduler_driver.cpp new file mode 100644 index 000000000..7f7b23a1c --- /dev/null +++ b/radio/src/targets/common/arm/stm32/mixer_scheduler_driver.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" +#include "mixer_scheduler.h" + +#if !defined(SIMU) + +// Start scheduler with default period +void mixerSchedulerStart() +{ + MIXER_SCHEDULER_TIMER->CR1 &= ~TIM_CR1_CEN; + + MIXER_SCHEDULER_TIMER->CR1 = TIM_CR1_URS; // do not generate interrupt on soft update + MIXER_SCHEDULER_TIMER->PSC = MIXER_SCHEDULER_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz) + MIXER_SCHEDULER_TIMER->CCER = 0; + MIXER_SCHEDULER_TIMER->CCMR1 = 0; + MIXER_SCHEDULER_TIMER->ARR = 2 * getMixerSchedulerPeriod() - 1; + MIXER_SCHEDULER_TIMER->EGR = TIM_EGR_UG; // reset timer + + NVIC_EnableIRQ(MIXER_SCHEDULER_TIMER_IRQn); + NVIC_SetPriority(MIXER_SCHEDULER_TIMER_IRQn, 8); + + MIXER_SCHEDULER_TIMER->SR &= TIM_SR_UIF; // clear interrupt flag + MIXER_SCHEDULER_TIMER->DIER |= TIM_DIER_UIE; // enable interrupt + MIXER_SCHEDULER_TIMER->CR1 |= TIM_CR1_CEN; +} + +void mixerSchedulerStop() +{ + MIXER_SCHEDULER_TIMER->CR1 &= ~TIM_CR1_CEN; + NVIC_DisableIRQ(MIXER_SCHEDULER_TIMER_IRQn); +} + +void mixerSchedulerResetTimer() +{ + mixerSchedulerDisableTrigger(); + MIXER_SCHEDULER_TIMER->CNT = 0; + mixerSchedulerEnableTrigger(); +} + +void mixerSchedulerEnableTrigger() +{ + MIXER_SCHEDULER_TIMER->DIER |= TIM_DIER_UIE; // enable interrupt +} + +void mixerSchedulerDisableTrigger() +{ + MIXER_SCHEDULER_TIMER->DIER &= ~TIM_DIER_UIE; // disable interrupt +} + +extern "C" void MIXER_SCHEDULER_TIMER_IRQHandler(void) +{ + MIXER_SCHEDULER_TIMER->SR &= ~TIM_SR_UIF; // clear flag + mixerSchedulerDisableTrigger(); + + // set next period + MIXER_SCHEDULER_TIMER->ARR = 2 * getMixerSchedulerPeriod() - 1; + + // trigger mixer start + mixerSchedulerISRTrigger(); +} + +#endif diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index fbf963b71..460a24701 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -240,6 +240,7 @@ set(TARGET_SRC led_driver.cpp extmodule_driver.cpp trainer_driver.cpp + ../common/arm/stm32/mixer_scheduler_driver.cpp ../common/arm/stm32/heartbeat_driver.cpp ../common/arm/stm32/timers_driver.cpp ../common/arm/stm32/intmodule_serial_driver.cpp diff --git a/radio/src/targets/horus/board.cpp b/radio/src/targets/horus/board.cpp index cb379e6fe..0f3f9df4a 100644 --- a/radio/src/targets/horus/board.cpp +++ b/radio/src/targets/horus/board.cpp @@ -137,6 +137,7 @@ void boardInit() INTMODULE_RCC_APB1Periph | EXTMODULE_RCC_APB1Periph | I2C_RCC_APB1Periph | + MIXER_SCHEDULER_TIMER_RCC_APB1Periph | GPS_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph, ENABLE); diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 38daec33c..f1c47ab9f 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -180,14 +180,11 @@ void init_intmodule_heartbeat(); void check_intmodule_heartbeat(); void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable, uint16_t parity, uint16_t stopBits, uint16_t wordLength); -#if defined(INTERNAL_MODULE_MULTI) -void intmoduleTimerStart(uint32_t periodMs); -#endif void intmoduleSendByte(uint8_t byte); void intmoduleSendBuffer(const uint8_t * data, uint8_t size); void intmoduleSendNextFrame(); -void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us, bool inverted); +void extmoduleSerialStart(); void extmoduleInvertedSerialStart(uint32_t baudrate); void extmoduleSendBuffer(const uint8_t * data, uint8_t size); void extmoduleSendNextFrame(); diff --git a/radio/src/targets/horus/extmodule_driver.cpp b/radio/src/targets/horus/extmodule_driver.cpp index 47a40ae02..e73d5c3d3 100644 --- a/radio/src/targets/horus/extmodule_driver.cpp +++ b/radio/src/targets/horus/extmodule_driver.cpp @@ -143,7 +143,7 @@ void extmodulePxx1PulsesStart() } #endif -void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us, bool inverted) +void extmoduleSerialStart() { EXTERNAL_MODULE_ON(); @@ -176,10 +176,9 @@ void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us, bool i EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0; #endif - EXTMODULE_TIMER->ARR = period_half_us; - EXTMODULE_TIMER->CCR2 = period_half_us - 4000; + EXTMODULE_TIMER->ARR = 40000; // dummy value until the DMA request kicks in EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_UDE | TIM_DIER_CC2IE; + EXTMODULE_TIMER->DIER |= TIM_DIER_UDE; EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; NVIC_EnableIRQ(EXTMODULE_TIMER_DMA_STREAM_IRQn); @@ -342,23 +341,36 @@ void extmoduleSendNextFrame() #if defined(DSM2) case PROTOCOL_CHANNELS_SBUS: -#if defined(PCBX10) || PCBREV >= 13 - EXTMODULE_TIMER->CCER = TIM_CCER_CC3E | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? TIM_CCER_CC3P : 0); // reverse polarity for Sbus if needed -#else - EXTMODULE_TIMER->CCER = TIM_CCER_CC1E | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? TIM_CCER_CC1P : 0); // reverse polarity for Sbus if needed -#endif - // no break case PROTOCOL_CHANNELS_DSM2_LP45: case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: case PROTOCOL_CHANNELS_MULTIMODULE: - EXTMODULE_TIMER->CCR2 = *(extmodulePulsesData.dsm2.ptr - 1) - 4000; // 2mS in advance + + if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN) + return; + + if (PROTOCOL_CHANNELS_SBUS == moduleState[EXTERNAL_MODULE].protocol) { +#if defined(PCBX10) || PCBREV >= 13 + EXTMODULE_TIMER->CCER = TIM_CCER_CC3E | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? TIM_CCER_CC3P : 0); // reverse polarity for Sbus if needed +#else + EXTMODULE_TIMER->CCER = TIM_CCER_CC1E | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? TIM_CCER_CC1P : 0); // reverse polarity for Sbus if needed +#endif + } + + // disable timer + EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; + + // send DMA request EXTMODULE_TIMER_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA EXTMODULE_TIMER_DMA_STREAM->CR |= EXTMODULE_TIMER_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | EXTMODULE_TIMER_DMA_SIZE | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; EXTMODULE_TIMER_DMA_STREAM->PAR = CONVERT_PTR_UINT(&EXTMODULE_TIMER->ARR); EXTMODULE_TIMER_DMA_STREAM->M0AR = CONVERT_PTR_UINT(extmodulePulsesData.dsm2.pulses); EXTMODULE_TIMER_DMA_STREAM->NDTR = extmodulePulsesData.dsm2.ptr - extmodulePulsesData.dsm2.pulses; EXTMODULE_TIMER_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA + + // re-init timer + EXTMODULE_TIMER->EGR = 1; + EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; break; #endif @@ -419,14 +431,20 @@ extern "C" void EXTMODULE_TIMER_DMA_IRQHandler() DMA_ClearITPendingBit(EXTMODULE_TIMER_DMA_STREAM, EXTMODULE_TIMER_DMA_FLAG_TC); - EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + switch (moduleState[EXTERNAL_MODULE].protocol) { + case PROTOCOL_CHANNELS_PXX1_PULSES: + case PROTOCOL_CHANNELS_PPM: + EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; + } } extern "C" void EXTMODULE_TIMER_IRQHandler() { EXTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // Stop this interrupt EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; + if (setupPulsesExternalModule()) extmoduleSendNextFrame(); } diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 479dd88c5..35a135cf4 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -902,6 +902,13 @@ #define TIMER_2MHz_RCC_APB1Periph RCC_APB1Periph_TIM7 #define TIMER_2MHz_TIMER TIM7 +// Mixer scheduler timer +#define MIXER_SCHEDULER_TIMER_RCC_APB1Periph RCC_APB1Periph_TIM13 +#define MIXER_SCHEDULER_TIMER TIM13 +#define MIXER_SCHEDULER_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#define MIXER_SCHEDULER_TIMER_IRQn TIM8_UP_TIM13_IRQn +#define MIXER_SCHEDULER_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler + // Bluetooth #define STORAGE_BLUETOOTH #if defined(BLUETOOTH) diff --git a/radio/src/targets/taranis/CMakeLists.txt b/radio/src/targets/taranis/CMakeLists.txt index 506f237cd..955a0994c 100644 --- a/radio/src/targets/taranis/CMakeLists.txt +++ b/radio/src/targets/taranis/CMakeLists.txt @@ -401,6 +401,7 @@ set(TARGET_SRC ../common/arm/stm32/audio_dac_driver.cpp ../common/arm/stm32/adc_driver.cpp ../common/arm/stm32/heartbeat_driver.cpp + ../common/arm/stm32/mixer_scheduler_driver.cpp ) if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES) diff --git a/radio/src/targets/taranis/board.cpp b/radio/src/targets/taranis/board.cpp index b038fc0f7..7d8561636 100644 --- a/radio/src/targets/taranis/board.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -110,6 +110,7 @@ void boardInit() AUX_SERIAL_RCC_APB1Periph | INTMODULE_RCC_APB1Periph | TRAINER_MODULE_RCC_APB1Periph | + MIXER_SCHEDULER_TIMER_RCC_APB1Periph | BT_RCC_APB1Periph | GYRO_RCC_APB1Periph, ENABLE); @@ -339,4 +340,4 @@ void initJackDetect(void) GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(JACK_DETECT_GPIO, &GPIO_InitStructure); } -#endif \ No newline at end of file +#endif diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index d9092fcdc..29fd50432 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -143,7 +143,7 @@ void intmoduleSendByte(uint8_t byte); void intmoduleSendBuffer(const uint8_t * data, uint8_t size); void intmoduleSendNextFrame(); -void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us, bool inverted); +void extmoduleSerialStart(); void extmoduleInvertedSerialStart(uint32_t baudrate); void extmoduleSendBuffer(const uint8_t * data, uint8_t size); void extmoduleSendNextFrame(); diff --git a/radio/src/targets/taranis/extmodule_driver.cpp b/radio/src/targets/taranis/extmodule_driver.cpp index 4287c0f75..7a7927a41 100644 --- a/radio/src/targets/taranis/extmodule_driver.cpp +++ b/radio/src/targets/taranis/extmodule_driver.cpp @@ -83,7 +83,7 @@ void extmodulePpmStart() NVIC_SetPriority(EXTMODULE_TIMER_CC_IRQn, 7); } -void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us, bool inverted) +void extmoduleSerialStart() { EXTERNAL_MODULE_ON(); @@ -99,16 +99,17 @@ void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us, bool i EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS from 30MHz - EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | (inverted ? 0 : EXTMODULE_TIMER_OUTPUT_POLARITY); + + EXTMODULE_TIMER->CCR3 = 0; + EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | EXTMODULE_TIMER_OUTPUT_POLARITY; EXTMODULE_TIMER->BDTR = TIM_BDTR_MOE; // Enable outputs EXTMODULE_TIMER->CCR1 = 0; EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0; // Force O/P high EXTMODULE_TIMER->EGR = 1; // Restart EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0; - EXTMODULE_TIMER->ARR = period_half_us; - EXTMODULE_TIMER->CCR2 = 40000; // The first frame will be sent in 20ms + EXTMODULE_TIMER->ARR = 40000; // dummy value until the DMA request kicks in EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_UDE | TIM_DIER_CC2IE; + EXTMODULE_TIMER->DIER |= TIM_DIER_UDE; EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; NVIC_EnableIRQ(EXTMODULE_TIMER_DMA_STREAM_IRQn); @@ -300,19 +301,33 @@ void extmoduleSendNextFrame() #endif #if defined(SBUS) || defined(DSM2) || defined(MULTIMODULE) case PROTOCOL_CHANNELS_SBUS: - EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? 0 : EXTMODULE_TIMER_OUTPUT_POLARITY); // reverse polarity for Sbus if needed // no break case PROTOCOL_CHANNELS_DSM2_LP45: case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: case PROTOCOL_CHANNELS_MULTIMODULE: - EXTMODULE_TIMER->CCR2 = *(extmodulePulsesData.dsm2.ptr - 1) - 4000; // 2mS in advance + + if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN) + return; + + if (PROTOCOL_CHANNELS_SBUS == moduleState[EXTERNAL_MODULE].protocol) { + EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? EXTMODULE_TIMER_OUTPUT_POLARITY : 0); // reverse polarity for Sbus if needed + } + + // disable timer + EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; + + // send DMA request EXTMODULE_TIMER_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA EXTMODULE_TIMER_DMA_STREAM->CR |= EXTMODULE_TIMER_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; EXTMODULE_TIMER_DMA_STREAM->PAR = CONVERT_PTR_UINT(&EXTMODULE_TIMER->ARR); EXTMODULE_TIMER_DMA_STREAM->M0AR = CONVERT_PTR_UINT(extmodulePulsesData.dsm2.pulses); EXTMODULE_TIMER_DMA_STREAM->NDTR = extmodulePulsesData.dsm2.ptr - extmodulePulsesData.dsm2.pulses; EXTMODULE_TIMER_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA + + // re-init timer + EXTMODULE_TIMER->EGR = 1; + EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; break; #endif @@ -373,14 +388,20 @@ extern "C" void EXTMODULE_TIMER_DMA_STREAM_IRQHandler() DMA_ClearITPendingBit(EXTMODULE_TIMER_DMA_STREAM, EXTMODULE_TIMER_DMA_FLAG_TC); - EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + switch (moduleState[EXTERNAL_MODULE].protocol) { + case PROTOCOL_CHANNELS_PXX1_PULSES: + case PROTOCOL_CHANNELS_PPM: + EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; + } } extern "C" void EXTMODULE_TIMER_CC_IRQHandler() { EXTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // Stop this interrupt EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; + if (setupPulsesExternalModule()) { extmoduleSendNextFrame(); } diff --git a/radio/src/targets/taranis/hal.h b/radio/src/targets/taranis/hal.h index b7160cbf9..aebff4c88 100644 --- a/radio/src/targets/taranis/hal.h +++ b/radio/src/targets/taranis/hal.h @@ -2024,4 +2024,11 @@ #define TIMER_2MHz_RCC_APB1Periph RCC_APB1Periph_TIM7 #define TIMER_2MHz_TIMER TIM7 +// Mixer scheduler timer +#define MIXER_SCHEDULER_TIMER_RCC_APB1Periph RCC_APB1Periph_TIM13 +#define MIXER_SCHEDULER_TIMER TIM13 +#define MIXER_SCHEDULER_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#define MIXER_SCHEDULER_TIMER_IRQn TIM8_UP_TIM13_IRQn +#define MIXER_SCHEDULER_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler + #endif // _HAL_H_ diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index 16e120784..e4c209edd 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -19,6 +19,7 @@ */ #include "opentx.h" +#include "mixer_scheduler.h" RTOS_TASK_HANDLE menusTaskId; RTOS_DEFINE_STACK(menusStack, MENUS_STACK_SIZE); @@ -75,13 +76,29 @@ bool isForcePowerOffRequested() bool isModuleSynchronous(uint8_t moduleIdx) { - uint8_t protocol = moduleState[moduleIdx].protocol; - if (protocol == PROTOCOL_CHANNELS_PXX2_HIGHSPEED || protocol == PROTOCOL_CHANNELS_PXX2_LOWSPEED || protocol == PROTOCOL_CHANNELS_CROSSFIRE || protocol == PROTOCOL_CHANNELS_GHOST || protocol == PROTOCOL_CHANNELS_NONE) - return true; -#if defined(INTMODULE_USART) || defined(EXTMODULE_USART) - if (protocol == PROTOCOL_CHANNELS_PXX1_SERIAL) - return true; + switch(moduleState[moduleIdx].protocol) { + + case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: + case PROTOCOL_CHANNELS_PXX2_LOWSPEED: + case PROTOCOL_CHANNELS_CROSSFIRE: + case PROTOCOL_CHANNELS_GHOST: + case PROTOCOL_CHANNELS_AFHDS3: + case PROTOCOL_CHANNELS_NONE: + +#if defined(MULTIMODULE) + case PROTOCOL_CHANNELS_MULTIMODULE: #endif +#if defined(INTMODULE_USART) || defined(EXTMODULE_USART) + case PROTOCOL_CHANNELS_PXX1_SERIAL: +#endif +#if defined(DSM2) + case PROTOCOL_CHANNELS_SBUS: + case PROTOCOL_CHANNELS_DSM2_LP45: + case PROTOCOL_CHANNELS_DSM2_DSM2: + case PROTOCOL_CHANNELS_DSM2_DSMX: +#endif + return true; + } return false; } @@ -100,12 +117,17 @@ void sendSynchronousPulses(uint8_t runMask) } } +//#define DEBUG_MIXER_SCHEDULER + uint32_t nextMixerTime[NUM_MODULES]; TASK_FUNCTION(mixerTask) { s_pulses_paused = true; + mixerSchedulerInit(); + mixerSchedulerStart(); + while (true) { #if defined(SBUS_TRAINER) // SBUS trainer @@ -120,7 +142,16 @@ TASK_FUNCTION(mixerTask) bluetooth.wakeup(); #endif - RTOS_WAIT_TICKS(1); + // run mixer at least every 30ms + bool timeout = mixerSchedulerWaitForTrigger(30); + +#if defined(DEBUG_MIXER_SCHEDULER) + GPIO_SetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN); + GPIO_ResetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN); +#endif + + // re-enable trigger + mixerSchedulerEnableTrigger(); #if defined(SIMU) if (pwrCheck() == e_power_off) { @@ -132,23 +163,6 @@ TASK_FUNCTION(mixerTask) } #endif - uint32_t now = RTOS_GET_MS(); - uint8_t runMask = 0; - - if (now >= nextMixerTime[0]) { - runMask |= (1 << 0); - } - -#if NUM_MODULES >= 2 - if (now >= nextMixerTime[1]) { - runMask |= (1 << 1); - } -#endif - - if (!runMask) { - continue; // go back to sleep - } - if (!s_pulses_paused) { uint16_t t0 = getTmr2MHz(); @@ -183,29 +197,18 @@ TASK_FUNCTION(mixerTask) if (t0 > maxMixerDuration) maxMixerDuration = t0; - sendSynchronousPulses(runMask); + // TODO: + // - check the cause of timeouts when switching + // between protocols with multi-proto RF + if (timeout) + serialPrint("mix sched timeout!"); + + // TODO: fix runMask + sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); } } } -void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms) -{ - // Schedule next mixer calculation time, - - if (isModuleSynchronous(module)) { - nextMixerTime[module] += period_ms / RTOS_MS_PER_TICK; - if (nextMixerTime[module] < RTOS_GET_TIME()) { - // we are late ... let's add some small delay - nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK); - } - } - else { - // for now assume mixer calculation takes 2 ms. - nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK); - } - - DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage); -} #define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms diff --git a/radio/src/telemetry/crossfire.cpp b/radio/src/telemetry/crossfire.cpp index b46cc2b44..672dd56f0 100644 --- a/radio/src/telemetry/crossfire.cpp +++ b/radio/src/telemetry/crossfire.cpp @@ -184,6 +184,26 @@ void processCrossfireTelemetryFrame() break; } + case RADIO_ID: + if (telemetryRxBuffer[3] == 0xEA // radio address + && telemetryRxBuffer[5] == 0x10 // timing correction frame + ) { + + uint32_t update_interval; + int32_t offset; + if (getCrossfireTelemetryValue<4>(6, (int32_t&)update_interval) && getCrossfireTelemetryValue<4>(10, offset)) { + + // values are in 10th of micro-seconds + update_interval /= 10; + offset /= 10; + + TRACE("[XF] Rate: %d, Lag: %d", update_interval, offset); + getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset + SAFE_SYNC_LAG); + } + } + break; + + #if defined(LUA) default: if (luaInputTelemetryFifo && luaInputTelemetryFifo->hasSpace(telemetryRxBufferCount-2) ) { diff --git a/radio/src/telemetry/crossfire.h b/radio/src/telemetry/crossfire.h index 9855b78f4..9940986f9 100644 --- a/radio/src/telemetry/crossfire.h +++ b/radio/src/telemetry/crossfire.h @@ -99,15 +99,15 @@ const uint32_t CROSSFIRE_BAUDRATES[] = { 115200, }; const uint8_t CROSSFIRE_PERIODS[] = { - 4, + 4, 16, }; #if SPORT_MAX_BAUDRATE < 400000 #define CROSSFIRE_BAUDRATE CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate] -#define CROSSFIRE_PERIOD CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate] +#define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate]*1000) #else #define CROSSFIRE_BAUDRATE 400000 -#define CROSSFIRE_PERIOD 4 // 4ms +#define CROSSFIRE_PERIOD 6666 /* us; 150 Hz */ #endif #define CROSSFIRE_TELEM_MIRROR_BAUDRATE 115200 diff --git a/radio/src/telemetry/multi.cpp b/radio/src/telemetry/multi.cpp index b1b86eb0a..eb5f6fc08 100644 --- a/radio/src/telemetry/multi.cpp +++ b/radio/src/telemetry/multi.cpp @@ -63,7 +63,6 @@ enum MultiBufferState : uint8_t #if defined(INTERNAL_MODULE_MULTI) static MultiModuleStatus multiModuleStatus[NUM_MODULES] = {MultiModuleStatus(), MultiModuleStatus()}; -static MultiModuleSyncStatus multiSyncStatus[NUM_MODULES] = {MultiModuleSyncStatus(), MultiModuleSyncStatus()}; static uint8_t multiBindStatus[NUM_MODULES] = {MULTI_NORMAL_OPERATION, MULTI_NORMAL_OPERATION}; static MultiBufferState multiTelemetryBufferState[NUM_MODULES]; @@ -74,11 +73,6 @@ MultiModuleStatus &getMultiModuleStatus(uint8_t module) return multiModuleStatus[module]; } -MultiModuleSyncStatus &getMultiSyncStatus(uint8_t module) -{ - return multiSyncStatus[module]; -} - uint8_t getMultiBindStatus(uint8_t module) { return multiBindStatus[module]; @@ -111,7 +105,6 @@ uint8_t intTelemetryRxBufferCount; #else // !INTERNAL_MODULE_MULTI static MultiModuleStatus multiModuleStatus; -static MultiModuleSyncStatus multiSyncStatus; static uint8_t multiBindStatus = MULTI_NORMAL_OPERATION; static MultiBufferState multiTelemetryBufferState; @@ -122,11 +115,6 @@ MultiModuleStatus& getMultiModuleStatus(uint8_t) return multiModuleStatus; } -MultiModuleSyncStatus& getMultiSyncStatus(uint8_t) -{ - return multiSyncStatus; -} - uint8_t getMultiBindStatus(uint8_t) { return multiBindStatus; @@ -254,24 +242,17 @@ static void processMultiStatusPacket(const uint8_t * data, uint8_t module, uint8 static void processMultiSyncPacket(const uint8_t * data, uint8_t module) { - MultiModuleSyncStatus &status = getMultiSyncStatus(module); + ModuleSyncStatus &status = getModuleSyncStatus(module); - status.lastUpdate = get_tmr10ms(); - status.interval = data[4]; - status.target = data[5]; -#if !defined(PPM_PIN_SERIAL) - auto oldlag = status.inputLag; - (void) oldlag; -#endif + uint16_t refreshRate = data[0] << 8 | data[1]; + int16_t inputLag = data[2] << 8 | data[3]; - status.calcAdjustedRefreshRate(data[0] << 8 | data[1], data[2] << 8 | data[3]); + // if (inputLag > refreshRate/2) + // inputLag -= refreshRate; -#if !defined(PPM_PIN_SERIAL) - TRACE("MP ADJ: rest: %d, lag %04d, diff: %04d target: %d, interval: %d, Refresh: %d, intAdjRefresh: %d, adjRefresh %d\r\n", - module == EXTERNAL_MODULE ? extmodulePulsesData.dsm2.rest : 0, - status.inputLag, oldlag - status.inputLag, status.target, status.interval, status.refreshRate, status.adjustedRefreshRate / 50, - status.getAdjustedRefreshRate()); -#endif + status.update(refreshRate, inputLag); + + serialPrint("MP ADJ: R %d, L %04d", refreshRate, inputLag); } #if defined(PCBTARANIS) || defined(PCBHORUS) @@ -434,104 +415,6 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module) } } -#define MIN_REFRESH_RATE 5500 - -void MultiModuleSyncStatus::calcAdjustedRefreshRate(uint16_t newRefreshRate, uint16_t newInputLag) -{ - // Check how far off we are from our target, positive means we are too slow, negative we are too fast - int lagDifference = newInputLag - inputLag; - - // The refresh rate that we target - // Below is least common multiple of MIN_REFRESH_RATE and requested rate - uint16_t targetRefreshRate = (uint16_t) (newRefreshRate * ((MIN_REFRESH_RATE / (newRefreshRate - 1)) + 1)); - - // Overflow, reverse sample - if (lagDifference < -targetRefreshRate / 2) - lagDifference = -lagDifference; - - - // Reset adjusted refresh if rate has changed - if (newRefreshRate != refreshRate) { - refreshRate = newRefreshRate; - adjustedRefreshRate = targetRefreshRate; - if (adjustedRefreshRate >= 30000) - adjustedRefreshRate /= 2; - - // Our refresh rate in ps - adjustedRefreshRate *= 1000; - return; - } - - // Caluclate how many samples went into the reported input Lag (*10) - int numsamples = interval * 10000 / targetRefreshRate; - - // Convert lagDifference to ps - lagDifference = lagDifference * 1000; - - // Calculate the time we intentionally were late/early - if (inputLag > target * 10 + 30) - lagDifference += numsamples * 500; - else if (inputLag < target * 10 - 30) - lagDifference -= numsamples * 500; - - // Caculate the time in ps each frame is to slow (positive), fast(negative) - int perframeps = lagDifference * 10 / numsamples; - - if (perframeps > 20000) - perframeps = 20000; - - if (perframeps < -20000) - perframeps = -20000; - - adjustedRefreshRate = (adjustedRefreshRate + perframeps); - - // Safeguards - if (adjustedRefreshRate < MIN_REFRESH_RATE * 1000) - adjustedRefreshRate = MIN_REFRESH_RATE * 1000; - if (adjustedRefreshRate > 30 * 1000 * 1000) - adjustedRefreshRate = 30 * 1000 * 1000; - - inputLag = newInputLag; -} - -static uint8_t counter; - -const uint16_t MultiModuleSyncStatus::getAdjustedRefreshRate() -{ - if (!isValid() || refreshRate == 0) - return 18000; - - counter = (uint8_t) (counter + 1 % 10); - uint16_t rate = (uint16_t) ((adjustedRefreshRate + counter * 50) / 500); - // Check how far off we are from our target, positive means we are too slow, negative we are too fast - if (inputLag > target * 10 + 30) - return (uint16_t) (rate - 1); - else if (inputLag < target * 10 - 30) - return (uint16_t) (rate + 1); - else - return rate; -} - -void MultiModuleSyncStatus::getRefreshString(char * statusText) -{ - if (!isValid()) { - return; - } - - char * tmp = statusText; -#if defined(DEBUG) - *tmp++ = 'L'; - tmp = strAppendUnsigned(tmp, inputLag, 5); - tmp = strAppend(tmp, "us R "); - tmp = strAppendUnsigned(tmp, (uint32_t) (adjustedRefreshRate / 1000), 5); - tmp = strAppend(tmp, "us"); -#else - tmp = strAppend(tmp, "Sync at "); - tmp = strAppendUnsigned(tmp, (uint32_t) (adjustedRefreshRate / 1000000)); - tmp = strAppend(tmp, " ms"); -#endif -} - void MultiModuleStatus::getStatusString(char * statusText) const { if (!isValid()) { diff --git a/radio/src/telemetry/multi.h b/radio/src/telemetry/multi.h index e9b9ada15..ca9d3fc79 100644 --- a/radio/src/telemetry/multi.h +++ b/radio/src/telemetry/multi.h @@ -94,28 +94,6 @@ void processMultiTelemetryData(uint8_t data, uint8_t module); #define MULTI_SCANNER_MAX_CHANNEL 249 -// This should be put into the Module definition if other modules gain this functionality -struct MultiModuleSyncStatus { - uint32_t adjustedRefreshRate = 9000 * 1000; // in ps - tmr10ms_t lastUpdate; - uint16_t refreshRate; - uint16_t inputLag; - uint8_t interval; - uint8_t target; - - inline bool isValid() const - { - return (get_tmr10ms() - lastUpdate < 100); - } - - void getRefreshString(char * refreshText); - const uint16_t getAdjustedRefreshRate(); - void calcAdjustedRefreshRate(uint16_t newRefreshRate, uint16_t newInputLag); -}; - -MultiModuleSyncStatus& getMultiSyncStatus(uint8_t module); - - struct MultiModuleStatus { uint8_t major; diff --git a/radio/src/telemetry/telemetry.cpp b/radio/src/telemetry/telemetry.cpp index 70c4fdc74..21e1e6d9b 100644 --- a/radio/src/telemetry/telemetry.cpp +++ b/radio/src/telemetry/telemetry.cpp @@ -21,6 +21,7 @@ #include "opentx.h" #include "multi.h" #include "pulses/afhds3.h" +#include "mixer_scheduler.h" uint8_t telemetryStreaming = 0; uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1) @@ -374,3 +375,88 @@ OutputTelemetryBuffer outputTelemetryBuffer __DMA; #if defined(LUA) Fifo * luaInputTelemetryFifo = NULL; #endif + +#if defined(HARDWARE_INTERNAL_MODULE) + +static ModuleSyncStatus moduleSyncStatus[NUM_MODULES]; + +ModuleSyncStatus &getModuleSyncStatus(uint8_t moduleIdx) +{ + return moduleSyncStatus[moduleIdx]; +} + +#else + +static ModuleSyncStatus moduleSyncStatus; + +ModuleSyncStatus &getModuleSyncStatus(uint8_t moduleIdx) +{ + return moduleSyncStatus; +} + +#endif + +ModuleSyncStatus::ModuleSyncStatus() +{ + memset(this, 0, sizeof(ModuleSyncStatus)); +} + +void ModuleSyncStatus::update(uint16_t newRefreshRate, uint16_t newInputLag) +{ + if (!newRefreshRate) + return; + + if (newRefreshRate < MIN_REFRESH_RATE) + newRefreshRate = newRefreshRate * (MIN_REFRESH_RATE / (newRefreshRate + 1)); + else if (newRefreshRate > MAX_REFRESH_RATE) + newRefreshRate = MAX_REFRESH_RATE; + + refreshRate = newRefreshRate; + inputLag = newInputLag; + currentLag = newInputLag; + lastUpdate = get_tmr10ms(); +} + +uint16_t ModuleSyncStatus::getAdjustedRefreshRate() +{ + int16_t lag = currentLag - SAFE_SYNC_LAG; + int32_t newRefreshRate = refreshRate; + + if (lag == 0) { + return refreshRate; + } + + newRefreshRate += lag; + + if (newRefreshRate < MIN_REFRESH_RATE) { + newRefreshRate = MIN_REFRESH_RATE; + } + else if (newRefreshRate > MAX_REFRESH_RATE) { + newRefreshRate = MAX_REFRESH_RATE; + } + + TRACE("[SYNC] rate = %dus",newRefreshRate); + + currentLag -= newRefreshRate - refreshRate; + return (uint16_t)newRefreshRate; +} + +void ModuleSyncStatus::getRefreshString(char * statusText) +{ + if (!isValid()) { + return; + } + + char * tmp = statusText; +#if defined(DEBUG) + *tmp++ = 'L'; + tmp = strAppendUnsigned(tmp, inputLag, 5); + tmp = strAppend(tmp, "us R "); + tmp = strAppendUnsigned(tmp, (uint32_t) (refreshRate / 1000), 5); + tmp = strAppend(tmp, "us"); +#else + tmp = strAppend(tmp, "Sync at "); + tmp = strAppendUnsigned(tmp, (uint32_t) (refreshRate / 1000000)); + tmp = strAppend(tmp, " ms"); +#endif +} diff --git a/radio/src/telemetry/telemetry.h b/radio/src/telemetry/telemetry.h index 6599db749..18f4f98a6 100644 --- a/radio/src/telemetry/telemetry.h +++ b/radio/src/telemetry/telemetry.h @@ -289,4 +289,35 @@ extern Fifo * luaInputTelemetryFifo; void processPXX2Frame(uint8_t module, const uint8_t *frame); +// Module pulse synchronization +#define SAFE_SYNC_LAG 800 /* us */ + +struct ModuleSyncStatus +{ + // feedback input: last received values + uint16_t refreshRate; // in us + int16_t inputLag; // in us + + tmr10ms_t lastUpdate; // in 10ms + int16_t currentLag; // in us + + inline bool isValid() { + // 2 seconds + return (get_tmr10ms() - lastUpdate < 200); + } + + // Set feedback from RF module + void update(uint16_t newRefreshRate, uint16_t newInputLag); + + // Get computed settings for scheduler + uint16_t getAdjustedRefreshRate(); + + // Status string for the UI + void getRefreshString(char* refreshText); + + ModuleSyncStatus(); +}; + +ModuleSyncStatus& getModuleSyncStatus(uint8_t moduleIdx); + #endif // _TELEMETRY_H_ From 63438b06d76735f7ae176767f8d563268773761e Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 10:06:37 +0200 Subject: [PATCH 002/188] restored 250Hz default rate for crossfire at 400kbps --- radio/src/telemetry/crossfire.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/telemetry/crossfire.h b/radio/src/telemetry/crossfire.h index 9940986f9..376b1fec4 100644 --- a/radio/src/telemetry/crossfire.h +++ b/radio/src/telemetry/crossfire.h @@ -107,7 +107,7 @@ const uint8_t CROSSFIRE_PERIODS[] = { #define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate]*1000) #else #define CROSSFIRE_BAUDRATE 400000 -#define CROSSFIRE_PERIOD 6666 /* us; 150 Hz */ +#define CROSSFIRE_PERIOD 4000 /* us; 250 Hz */ #endif #define CROSSFIRE_TELEM_MIRROR_BAUDRATE 115200 From 8247a05438bae4992a0cbbea6db3c5ae0b8c8de5 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 10:41:20 +0200 Subject: [PATCH 003/188] debugging crsfshot... --- radio/src/pulses/pulses.cpp | 2 +- radio/src/telemetry/telemetry.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 1681157bc..d21c58853 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -522,7 +522,7 @@ bool setupPulsesInternalModule(uint8_t protocol) #endif default: - mixerSchedulerSetPeriod(INTERNAL_MODULE, 10000 /*us*/); // used for USB sim for example + //mixerSchedulerSetPeriod(INTERNAL_MODULE, 10000 /*us*/); // used for USB sim for example return false; } } diff --git a/radio/src/telemetry/telemetry.cpp b/radio/src/telemetry/telemetry.cpp index 21e1e6d9b..44906b9d7 100644 --- a/radio/src/telemetry/telemetry.cpp +++ b/radio/src/telemetry/telemetry.cpp @@ -415,6 +415,8 @@ void ModuleSyncStatus::update(uint16_t newRefreshRate, uint16_t newInputLag) inputLag = newInputLag; currentLag = newInputLag; lastUpdate = get_tmr10ms(); + + TRACE("[SYNC] update rate = %dus; lag = %dus",refreshRate,currentLag); } uint16_t ModuleSyncStatus::getAdjustedRefreshRate() @@ -435,9 +437,9 @@ uint16_t ModuleSyncStatus::getAdjustedRefreshRate() newRefreshRate = MAX_REFRESH_RATE; } - TRACE("[SYNC] rate = %dus",newRefreshRate); - currentLag -= newRefreshRate - refreshRate; + TRACE("[SYNC] mod rate = %dus; lag = %dus",newRefreshRate,currentLag); + return (uint16_t)newRefreshRate; } From ef3b669d38c1742b95cc0327935fba244ff22e94 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 11:16:00 +0200 Subject: [PATCH 004/188] fixed Ghost sync feedback --- radio/src/telemetry/ghost.cpp | 13 +++++++++++++ radio/src/telemetry/ghost.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/radio/src/telemetry/ghost.cpp b/radio/src/telemetry/ghost.cpp index 098e9c990..2095a3710 100755 --- a/radio/src/telemetry/ghost.cpp +++ b/radio/src/telemetry/ghost.cpp @@ -132,6 +132,19 @@ void processGhostTelemetryFrame() uint8_t id = telemetryRxBuffer[2]; switch(id) { + case GHST_DL_OPENTX_SYNC: + { + uint32_t update_interval = getTelemetryValue_s32(3); + int32_t offset = getTelemetryValue_s32(7); + + // values are in units of 100ns + update_interval /= 10; + offset /= 10; + + getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset + SAFE_SYNC_LAG); + } + break; + case GHST_DL_LINK_STAT: { #if defined(BLUETOOTH) diff --git a/radio/src/telemetry/ghost.h b/radio/src/telemetry/ghost.h index 0a3195835..9cdd48a39 100755 --- a/radio/src/telemetry/ghost.h +++ b/radio/src/telemetry/ghost.h @@ -113,7 +113,7 @@ enum GhostTelemetryBaudrates }; #endif #define GHOST_BAUDRATE 400000 -#define GHOST_PERIOD 4 +#define GHOST_PERIOD 4000 /* us */ enum GhostLineFlags { From 92f27a853ae16c194ccc302bc6b2a4a03e5be748 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 12:07:09 +0200 Subject: [PATCH 005/188] moved sync pulse sending to *before* periodic mixer processing This should enable a more stable pulse sending to the module. --- radio/src/opentx.cpp | 13 +++++++++++++ radio/src/opentx.h | 1 + radio/src/tasks.cpp | 11 ++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 73b39c407..bebb5b317 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1426,6 +1426,19 @@ void doMixerCalculations() DEBUG_TIMER_START(debugTimerEvalMixes); evalMixes(tick10ms); DEBUG_TIMER_STOP(debugTimerEvalMixes); +} + +void doMixerPeriodicUpdates() +{ + static tmr10ms_t lastTMR = 0; + + tmr10ms_t tmr10ms = get_tmr10ms(); + + uint8_t tick10ms = (tmr10ms >= lastTMR ? tmr10ms - lastTMR : 1); + // handle tick10ms overrun + // correct overflow handling costs a lot of code; happens only each 11 min; + // therefore forget the exact calculation and use only 1 instead; good compromise + lastTMR = tmr10ms; DEBUG_TIMER_START(debugTimerMixes10ms); if (tick10ms) { diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 394a0734f..6d028ff06 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -483,6 +483,7 @@ extern uint32_t nextMixerTime[NUM_MODULES]; void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms); void evalMixes(uint8_t tick10ms); void doMixerCalculations(); +void doMixerPeriodicUpdates(); void checkTrims(); extern uint8_t currentBacklightBright; diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index e4c209edd..431ed7e52 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -168,12 +168,20 @@ TASK_FUNCTION(mixerTask) DEBUG_TIMER_START(debugTimerMixer); RTOS_LOCK_MUTEX(mixerMutex); + doMixerCalculations(); + + // TODO: fix runMask + sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); + + doMixerPeriodicUpdates(); + DEBUG_TIMER_START(debugTimerMixerCalcToUsage); DEBUG_TIMER_SAMPLE(debugTimerMixerIterval); RTOS_UNLOCK_MUTEX(mixerMutex); DEBUG_TIMER_STOP(debugTimerMixer); + #if defined(STM32) && !defined(SIMU) if (getSelectedUsbMode() == USB_JOYSTICK_MODE) { usbJoystickUpdate(); @@ -202,9 +210,6 @@ TASK_FUNCTION(mixerTask) // between protocols with multi-proto RF if (timeout) serialPrint("mix sched timeout!"); - - // TODO: fix runMask - sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); } } } From dd4c91ce4f86b6018ea1b8af400e591c7697f3f3 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 12:17:05 +0200 Subject: [PATCH 006/188] removed SAFE_SYNC_LAG --- radio/src/telemetry/crossfire.cpp | 2 +- radio/src/telemetry/ghost.cpp | 2 +- radio/src/telemetry/telemetry.cpp | 2 +- radio/src/telemetry/telemetry.h | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/radio/src/telemetry/crossfire.cpp b/radio/src/telemetry/crossfire.cpp index 672dd56f0..173ea38f4 100644 --- a/radio/src/telemetry/crossfire.cpp +++ b/radio/src/telemetry/crossfire.cpp @@ -198,7 +198,7 @@ void processCrossfireTelemetryFrame() offset /= 10; TRACE("[XF] Rate: %d, Lag: %d", update_interval, offset); - getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset + SAFE_SYNC_LAG); + getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset); } } break; diff --git a/radio/src/telemetry/ghost.cpp b/radio/src/telemetry/ghost.cpp index 2095a3710..1a3cef9d4 100755 --- a/radio/src/telemetry/ghost.cpp +++ b/radio/src/telemetry/ghost.cpp @@ -141,7 +141,7 @@ void processGhostTelemetryFrame() update_interval /= 10; offset /= 10; - getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset + SAFE_SYNC_LAG); + getModuleSyncStatus(EXTERNAL_MODULE).update(update_interval, offset); } break; diff --git a/radio/src/telemetry/telemetry.cpp b/radio/src/telemetry/telemetry.cpp index 44906b9d7..03878eee6 100644 --- a/radio/src/telemetry/telemetry.cpp +++ b/radio/src/telemetry/telemetry.cpp @@ -421,7 +421,7 @@ void ModuleSyncStatus::update(uint16_t newRefreshRate, uint16_t newInputLag) uint16_t ModuleSyncStatus::getAdjustedRefreshRate() { - int16_t lag = currentLag - SAFE_SYNC_LAG; + int16_t lag = currentLag; int32_t newRefreshRate = refreshRate; if (lag == 0) { diff --git a/radio/src/telemetry/telemetry.h b/radio/src/telemetry/telemetry.h index 18f4f98a6..28f66da2c 100644 --- a/radio/src/telemetry/telemetry.h +++ b/radio/src/telemetry/telemetry.h @@ -290,8 +290,6 @@ extern Fifo * luaInputTelemetryFifo; void processPXX2Frame(uint8_t module, const uint8_t *frame); // Module pulse synchronization -#define SAFE_SYNC_LAG 800 /* us */ - struct ModuleSyncStatus { // feedback input: last received values From 931743af44b8cc266691776d0c5813db7abdd104 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 15:44:20 +0200 Subject: [PATCH 007/188] init_intmodule_heartbeat --- radio/src/pulses/pulses.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index d21c58853..3fc1868ac 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -411,6 +411,7 @@ static void enablePulsesInternalModule(uint8_t protocol) intmodulePxx1PulsesStart(); #if defined(INTMODULE_HEARTBEAT) // use backup trigger (1 ms later) + init_intmodule_heartbeat(); mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1000/*us*/); #else mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); @@ -423,6 +424,7 @@ static void enablePulsesInternalModule(uint8_t protocol) intmodulePxx1SerialStart(); #if defined(INTMODULE_HEARTBEAT) // use backup trigger (1 ms later) + init_intmodule_heartbeat(); mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD + 1000/*us*/); #else mixerSchedulerSetPeriod(INTERNAL_MODULE, INTMODULE_PXX1_SERIAL_PERIOD); @@ -437,6 +439,7 @@ static void enablePulsesInternalModule(uint8_t protocol) #if defined(INTMODULE_HEARTBEAT) // use backup trigger (1 ms later) + init_intmodule_heartbeat(); mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 1000/*us*/); #else mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD); From e00224fea192e133898d887c6c1cf7f325c935b1 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 19:19:23 +0200 Subject: [PATCH 008/188] fix SBUS rate adjustment --- radio/src/pulses/pulses.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 3fc1868ac..f6bb81176 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -333,6 +333,9 @@ bool setupPulsesExternalModule(uint8_t protocol) #if defined(SBUS) case PROTOCOL_CHANNELS_SBUS: setupPulsesSbus(); + + // SBUS_PERIOD is not a constant! It can be set from UI + mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD); return true; #endif From e2fb0522cd8e473457676977b660afc1f00bda7e Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 22:33:03 +0200 Subject: [PATCH 009/188] fixed pxx1 driver --- radio/src/pulses/pxx.h | 2 +- .../src/targets/taranis/extmodule_driver.cpp | 32 ++++++++++++------- radio/src/tasks.cpp | 2 ++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/radio/src/pulses/pxx.h b/radio/src/pulses/pxx.h index ae84d77b2..b9536d723 100644 --- a/radio/src/pulses/pxx.h +++ b/radio/src/pulses/pxx.h @@ -108,7 +108,7 @@ class PwmPxxBitTransport: public PulsesBuffer { void addTail() { // rest min value is 18000 - 200 * 48 = 8400 (4.2ms) - *(ptr - 1) += rest; + *(ptr - 1) = 60000;//+= rest; } }; diff --git a/radio/src/targets/taranis/extmodule_driver.cpp b/radio/src/targets/taranis/extmodule_driver.cpp index 7a7927a41..b8139ad6a 100644 --- a/radio/src/targets/taranis/extmodule_driver.cpp +++ b/radio/src/targets/taranis/extmodule_driver.cpp @@ -98,7 +98,7 @@ void extmoduleSerialStart() GPIO_Init(EXTMODULE_TX_GPIO, &GPIO_InitStructure); EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; - EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS from 30MHz + EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2 MHz) EXTMODULE_TIMER->CCR3 = 0; EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | EXTMODULE_TIMER_OUTPUT_POLARITY; @@ -215,16 +215,17 @@ void extmodulePxx1PulsesStart() EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz) + + EXTMODULE_TIMER->CCR3 = 0; EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | EXTMODULE_TIMER_OUTPUT_POLARITY; // polarity, default low EXTMODULE_TIMER->BDTR = TIM_BDTR_MOE; // Enable outputs EXTMODULE_TIMER->CCR1 = 18; EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0; // Force O/P high EXTMODULE_TIMER->EGR = 1; // Restart - EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2; - EXTMODULE_TIMER->ARR = 45000; - EXTMODULE_TIMER->CCR2 = 40000; // The first frame will be sent in 20ms + EXTMODULE_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2; // 0 TOGGLE / 2 PWM1 + EXTMODULE_TIMER->ARR = 40000; EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_UDE | TIM_DIER_CC2IE; + EXTMODULE_TIMER->DIER |= TIM_DIER_UDE; EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; NVIC_EnableIRQ(EXTMODULE_TIMER_DMA_STREAM_IRQn); @@ -258,13 +259,23 @@ void extmoduleSendNextFrame() #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: - EXTMODULE_TIMER->CCR2 = extmodulePulsesData.pxx.getLast() - 4000; // 2mS in advance + + if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN) + return; + + // disable timer + EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; + EXTMODULE_TIMER_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA EXTMODULE_TIMER_DMA_STREAM->CR |= EXTMODULE_TIMER_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; EXTMODULE_TIMER_DMA_STREAM->PAR = CONVERT_PTR_UINT(&EXTMODULE_TIMER->ARR); EXTMODULE_TIMER_DMA_STREAM->M0AR = CONVERT_PTR_UINT(extmodulePulsesData.pxx.getData()); EXTMODULE_TIMER_DMA_STREAM->NDTR = extmodulePulsesData.pxx.getSize(); EXTMODULE_TIMER_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA + + // re-init timer + EXTMODULE_TIMER->EGR = 1; + EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; break; #endif @@ -389,11 +400,10 @@ extern "C" void EXTMODULE_TIMER_DMA_STREAM_IRQHandler() DMA_ClearITPendingBit(EXTMODULE_TIMER_DMA_STREAM, EXTMODULE_TIMER_DMA_FLAG_TC); switch (moduleState[EXTERNAL_MODULE].protocol) { - case PROTOCOL_CHANNELS_PXX1_PULSES: - case PROTOCOL_CHANNELS_PPM: - EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt - break; + case PROTOCOL_CHANNELS_PPM: + EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; } } diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index 431ed7e52..8346b2ceb 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -91,6 +91,8 @@ bool isModuleSynchronous(uint8_t moduleIdx) #if defined(INTMODULE_USART) || defined(EXTMODULE_USART) case PROTOCOL_CHANNELS_PXX1_SERIAL: #endif + // case PROTOCOL_CHANNELS_PPM: + case PROTOCOL_CHANNELS_PXX1_PULSES: #if defined(DSM2) case PROTOCOL_CHANNELS_SBUS: case PROTOCOL_CHANNELS_DSM2_LP45: From 47f38dc5b79d35218047d52417704655a143d9ec Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 23:04:43 +0200 Subject: [PATCH 010/188] potential fix for internal PXX1 --- .../taranis/intmodule_pulses_driver.cpp | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/radio/src/targets/taranis/intmodule_pulses_driver.cpp b/radio/src/targets/taranis/intmodule_pulses_driver.cpp index e71768eac..7b8c40578 100644 --- a/radio/src/targets/taranis/intmodule_pulses_driver.cpp +++ b/radio/src/targets/taranis/intmodule_pulses_driver.cpp @@ -42,21 +42,31 @@ void intmoduleSendNextFrame() #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: { - uint32_t last = intmodulePulsesData.pxx.getLast(); - if (heartbeatCapture.valid) { - if (getTmr2MHz() - heartbeatCapture.timestamp > HEARBEAT_OFFSET) - last -= 21; - else - last += 19; - intmodulePulsesData.pxx.setLast(last); - } - INTMODULE_TIMER->CCR2 = last - 4000; // 2mS in advance + // uint32_t last = intmodulePulsesData.pxx.getLast(); + // if (heartbeatCapture.valid) { + // if (getTmr2MHz() - heartbeatCapture.timestamp > HEARBEAT_OFFSET) + // last -= 21; + // else + // last += 19; + // intmodulePulsesData.pxx.setLast(last); + // } + if (INTMODULE_DMA_STREAM->CR & DMA_SxCR_EN) + return; + + //disable timer + INTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; + + //INTMODULE_TIMER->CCR2 = last - 4000; // 2mS in advance INTMODULE_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA INTMODULE_DMA_STREAM->CR |= INTMODULE_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; INTMODULE_DMA_STREAM->PAR = CONVERT_PTR_UINT(&INTMODULE_TIMER->ARR); INTMODULE_DMA_STREAM->M0AR = CONVERT_PTR_UINT(intmodulePulsesData.pxx.getData()); INTMODULE_DMA_STREAM->NDTR = intmodulePulsesData.pxx.getSize(); INTMODULE_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA + + // re-init timer + EXTMODULE_TIMER->EGR = 1; + EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; break; } #endif @@ -97,17 +107,16 @@ void intmodulePxx1PulsesStart() INTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; INTMODULE_TIMER->PSC = INTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz) - INTMODULE_TIMER->ARR = 18000; + INTMODULE_TIMER->CCER = TIM_CCER_CC3E | TIM_CCER_CC3NE; INTMODULE_TIMER->BDTR = TIM_BDTR_MOE; // Enable outputs INTMODULE_TIMER->CCR3 = 16; INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_2 | TIM_CCMR2_OC3M_0; // Force O/P high INTMODULE_TIMER->EGR = 1; // Restart - INTMODULE_TIMER->DIER |= TIM_DIER_UDE; // Enable DMA on update INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_2; + INTMODULE_TIMER->ARR = 40000; INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - INTMODULE_TIMER->CCR2 = 16000; // The first frame will be sent in 20ms - INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + INTMODULE_TIMER->DIER |= TIM_DIER_UDE; // Enable DMA on update INTMODULE_TIMER->CR1 |= TIM_CR1_CEN; NVIC_EnableIRQ(INTMODULE_DMA_STREAM_IRQn); @@ -157,8 +166,12 @@ extern "C" void INTMODULE_DMA_STREAM_IRQHandler() DMA_ClearITPendingBit(INTMODULE_DMA_STREAM, INTMODULE_DMA_FLAG_TC); - INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + switch (moduleState[INTERNAL_MODULE].protocol) { + case PROTOCOL_CHANNELS_PPM: + INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; + } } extern "C" void INTMODULE_TIMER_CC_IRQHandler() From 02c7d5004ab9e2f007efff05bba1a5ec9a5fbc6b Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 8 Sep 2020 23:04:43 +0200 Subject: [PATCH 011/188] fixed internal PXX1 re-enable for DMA request --- radio/src/targets/taranis/intmodule_pulses_driver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/targets/taranis/intmodule_pulses_driver.cpp b/radio/src/targets/taranis/intmodule_pulses_driver.cpp index 7b8c40578..9dad13fd1 100644 --- a/radio/src/targets/taranis/intmodule_pulses_driver.cpp +++ b/radio/src/targets/taranis/intmodule_pulses_driver.cpp @@ -65,8 +65,8 @@ void intmoduleSendNextFrame() INTMODULE_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA // re-init timer - EXTMODULE_TIMER->EGR = 1; - EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; + INTMODULE_TIMER->EGR = 1; + INTMODULE_TIMER->CR1 |= TIM_CR1_CEN; break; } #endif From 3f3747c0c75856046d7ede0b53412766a46a2cbc Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 10 Sep 2020 21:00:19 +0200 Subject: [PATCH 012/188] pxx1 internal module: add pre-load register enable (required for pwm mode) --- radio/src/targets/taranis/intmodule_pulses_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/taranis/intmodule_pulses_driver.cpp b/radio/src/targets/taranis/intmodule_pulses_driver.cpp index 9dad13fd1..588e1a448 100644 --- a/radio/src/targets/taranis/intmodule_pulses_driver.cpp +++ b/radio/src/targets/taranis/intmodule_pulses_driver.cpp @@ -113,7 +113,7 @@ void intmodulePxx1PulsesStart() INTMODULE_TIMER->CCR3 = 16; INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_2 | TIM_CCMR2_OC3M_0; // Force O/P high INTMODULE_TIMER->EGR = 1; // Restart - INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_2; + INTMODULE_TIMER->CCMR2 = TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_2 | TIM_CCMR2_OC3PE; INTMODULE_TIMER->ARR = 40000; INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag INTMODULE_TIMER->DIER |= TIM_DIER_UDE; // Enable DMA on update From 3c98a9907eeb12b80b80e0cdf589fcbcd43fb700 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 12 Sep 2020 11:10:36 +0200 Subject: [PATCH 013/188] fixed extmodule serial polarity --- radio/src/targets/taranis/extmodule_driver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/src/targets/taranis/extmodule_driver.cpp b/radio/src/targets/taranis/extmodule_driver.cpp index b8139ad6a..4bc47698e 100644 --- a/radio/src/targets/taranis/extmodule_driver.cpp +++ b/radio/src/targets/taranis/extmodule_driver.cpp @@ -321,13 +321,13 @@ void extmoduleSendNextFrame() if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN) return; + // disable timer + EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; + if (PROTOCOL_CHANNELS_SBUS == moduleState[EXTERNAL_MODULE].protocol) { EXTMODULE_TIMER->CCER = EXTMODULE_TIMER_OUTPUT_ENABLE | (GET_SBUS_POLARITY(EXTERNAL_MODULE) ? EXTMODULE_TIMER_OUTPUT_POLARITY : 0); // reverse polarity for Sbus if needed } - // disable timer - EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN; - // send DMA request EXTMODULE_TIMER_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA EXTMODULE_TIMER_DMA_STREAM->CR |= EXTMODULE_TIMER_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; From 87b63402fd2772285868de3f5fc6bc34261e86ae Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 12 Sep 2020 13:19:59 +0200 Subject: [PATCH 014/188] set minimum period to 1750us This should allow 500Hz refresh rate + some headroom for sync. --- radio/src/mixer_scheduler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/mixer_scheduler.h b/radio/src/mixer_scheduler.h index ccded9a5e..601f3fcd7 100644 --- a/radio/src/mixer_scheduler.h +++ b/radio/src/mixer_scheduler.h @@ -23,7 +23,7 @@ #define MIXER_SCHEDULER_DEFAULT_PERIOD_US 4000u // 4ms -#define MIN_REFRESH_RATE 4000 /* us */ +#define MIN_REFRESH_RATE 1750 /* us */ #define MAX_REFRESH_RATE 25000 /* us */ #if !defined(SIMU) From 1c33efac9f6e68fd00989ec7e5cc8966a71c8969 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 12 Sep 2020 21:59:48 +0200 Subject: [PATCH 015/188] fixed AFHDS3 taranis external module --- radio/src/pulses/afhds3.h | 13 +------------ radio/src/targets/taranis/extmodule_driver.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/radio/src/pulses/afhds3.h b/radio/src/pulses/afhds3.h index fab057854..5eef56a4b 100644 --- a/radio/src/pulses/afhds3.h +++ b/radio/src/pulses/afhds3.h @@ -94,9 +94,6 @@ struct Data void reset() { -#if !(defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)) - total = 0; -#endif pulsesSize = 0; } #if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO) @@ -118,7 +115,6 @@ struct Data return; } pulses[pulsesSize++] = v; - total += v; } void sendByte(uint8_t b) { @@ -149,14 +145,7 @@ struct Data //add remaining time of frame void flush() { - uint16_t diff = AFHDS3_FRAME_HALF_US - total; - pulses[pulsesSize - 1] += diff; - //ensure 2 ms break - if (pulses[pulsesSize - 1] < 4000) - { - pulses[pulsesSize - 1] = 4050; - } - total += diff; + pulses[pulsesSize - 1] = 60000; } const uint16_t* getData() diff --git a/radio/src/targets/taranis/extmodule_driver.cpp b/radio/src/targets/taranis/extmodule_driver.cpp index 4bc47698e..b856cb309 100644 --- a/radio/src/targets/taranis/extmodule_driver.cpp +++ b/radio/src/targets/taranis/extmodule_driver.cpp @@ -297,15 +297,21 @@ void extmoduleSendNextFrame() #if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO) extmoduleSendBuffer(extmodulePulsesData.afhds3.getData(), extmodulePulsesData.afhds3.getSize()); #else + if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN) + return; + const uint16_t* dataPtr = extmodulePulsesData.afhds3.getData(); uint32_t dataSize = extmodulePulsesData.afhds3.getSize(); - EXTMODULE_TIMER->CCR2 = dataPtr[dataSize -1] - 4000; // 2mS in advance EXTMODULE_TIMER_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA EXTMODULE_TIMER_DMA_STREAM->CR |= EXTMODULE_TIMER_DMA_CHANNEL | DMA_SxCR_DIR_0 | DMA_SxCR_MINC | DMA_SxCR_PSIZE_0 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PL_0 | DMA_SxCR_PL_1; EXTMODULE_TIMER_DMA_STREAM->PAR = CONVERT_PTR_UINT(&EXTMODULE_TIMER->ARR); EXTMODULE_TIMER_DMA_STREAM->M0AR = CONVERT_PTR_UINT(dataPtr); EXTMODULE_TIMER_DMA_STREAM->NDTR = dataSize; EXTMODULE_TIMER_DMA_STREAM->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE; // Enable DMA + + // re-init timer + EXTMODULE_TIMER->EGR = TIM_PSCReloadMode_Immediate; + EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; #endif } break; From 860b50faae0ddc1f603a8a542f21e27659d6294b Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 21 Dec 2020 19:28:05 +0100 Subject: [PATCH 016/188] Improve build files --- tools/boards.py | 69 +++++++++++++++++++++++++++++++++++++++++++++ tools/build-imrc.py | 65 ++++++++++++++++++++++++++++++++++++++++++ tools/build-tbs.py | 57 ++----------------------------------- 3 files changed, 136 insertions(+), 55 deletions(-) create mode 100755 tools/boards.py create mode 100755 tools/build-imrc.py diff --git a/tools/boards.py b/tools/boards.py new file mode 100755 index 000000000..72e367cb3 --- /dev/null +++ b/tools/boards.py @@ -0,0 +1,69 @@ +#!/usr/bin/python3 + +boards = { + "XLITE": { + "PCB": "XLITE", + }, + "XLITES": { + "PCB": "XLITES", + }, + "X9LITE": { + "PCB": "X9LITE", + }, + "X9LITES": { + "PCB": "X9LITES", + }, + "X9D": { + "PCB": "X9D", + }, + "X9D+": { + "PCB": "X9D+", + }, + "X9D+2019": { + "PCB": "X9D+", + "PCBREV": "2019", + }, + "X9E": { + "PCB": "X9E", + }, + "X7": { + "PCB": "X7", + }, + "X7ACCESS": { + "PCB": "X7", + "PCBREV": "ACCESS", + }, + "X10": { + "PCB": "X10", + }, + "X10EXPRESS": { + "PCB": "X10", + "PCBREV": "EXPRESS", + }, + "X12S": { + "PCB": "X12S", + }, + "T16": { + "PCB": "X10", + "PCBREV": "T16", + "INTERNAL_MODULE_MULTI": "YES" + }, + "T18": { + "PCB": "X10", + "PCBREV": "T18", + "INTERNAL_MODULE_MULTI": "YES" + }, + "TX16S": { + "PCB": "X10", + "PCBREV": "TX16S", + "INTERNAL_MODULE_MULTI": "YES" + }, + "T12": { + "PCB": "X7", + "PCBREV": "T12", + }, + "TX12": { + "PCB": "X7", + "PCBREV": "TX12", + }, +} diff --git a/tools/build-imrc.py b/tools/build-imrc.py new file mode 100755 index 000000000..b739a3fc6 --- /dev/null +++ b/tools/build-imrc.py @@ -0,0 +1,65 @@ +#!/usr/bin/python3 + +import argparse +import datetime +import os +from builtins import NotADirectoryError +import shutil +import tempfile + +from boards import * + +translations = [ + "EN" +] + + +def timestamp(): + return datetime.datetime.now().strftime("%Y%m%d") + + +def build(board, translation, srcdir): + cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in boards[board].items()]) + cwd = os.getcwd() + if not os.path.exists("output"): + os.mkdir("output") + path = tempfile.mkdtemp() + os.chdir(path) + command = "cmake %s -DTRANSLATIONS=%s -DIMRC_RELEASE=YES -DGHOST=YES -DTEST_BUILD_WARNING=YES %s" % (cmake_options, translation, srcdir) + print(command) + os.system(command) + os.system("make firmware -j16") + os.chdir(cwd) + index = 0 + while 1: + suffix = "" if index == 0 else "_%d" % index + filename = "output/ghost_firm_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix) + if not os.path.exists(filename): + shutil.copy("%s/firmware.bin" % path, filename) + break + index += 1 + shutil.rmtree(path) + + +def dir_path(string): + if os.path.isdir(string): + return string + else: + raise NotADirectoryError(string) + + +def main(): + parser = argparse.ArgumentParser(description="Build Ghost firmware") + parser.add_argument("-b", "--boards", action="append", help="Destination boards", required=True) + parser.add_argument("-t", "--translations", action="append", help="Translations", required=True) + parser.add_argument("srcdir", type=dir_path) + + args = parser.parse_args() + + for board in (boards.keys() if "ALL" in args.boards else args.boards): + for translation in (translations if "ALL" in args.translations else args.translations): + build(board, translation, args.srcdir) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tools/build-tbs.py b/tools/build-tbs.py index 3c5cb2d1c..a7a0bfc23 100755 --- a/tools/build-tbs.py +++ b/tools/build-tbs.py @@ -7,60 +7,7 @@ from builtins import NotADirectoryError import shutil import tempfile - -boards = { - "XLITE": { - "PCB": "XLITE", - }, - "XLITES": { - "PCB": "XLITES", - }, - "X9LITE": { - "PCB": "X9LITE", - }, - "X9LITES": { - "PCB": "X9LITES", - }, - "X9D": { - "PCB": "X9D+", - }, - "X9D+": { - "PCB": "X9D+", - }, - "X9D+2019": { - "PCB": "X9D+", - "PCBREV": "2019", - }, - "X9E": { - "PCB": "X9E", - }, - "X7": { - "PCB": "X7", - }, - "X7ACCESS": { - "PCB": "X7", - "PCBREV": "ACCESS", - }, - "X10": { - "PCB": "X10", - }, - "X10EXPRESS": { - "PCB": "X10", - "PCBREV": "EXPRESS", - }, - "X12S": { - "PCB": "X12S", - }, - "T16": { - "PCB": "X10", - "PCBREV": "T16", - "INTERNAL_MODULE_MULTI": "YES" - }, - "T12": { - "PCB": "X7", - "PCBREV": "T12", - }, -} +from boards import * translations = [ "EN" @@ -86,7 +33,7 @@ def build(board, translation, srcdir): index = 0 while 1: suffix = "" if index == 0 else "_%d" % index - filename = "output/firmware_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix) + filename = "output/tbs_firm_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix) if not os.path.exists(filename): shutil.copy("%s/firmware.bin" % path, filename) break From e9c9fcda14a08356db7369e452e863d8bbeb9b19 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 22 Dec 2020 08:53:10 +0100 Subject: [PATCH 017/188] Improve build files --- tools/build-tbs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-tbs.py b/tools/build-tbs.py index a7a0bfc23..729855df0 100755 --- a/tools/build-tbs.py +++ b/tools/build-tbs.py @@ -28,7 +28,7 @@ def build(board, translation, srcdir): command = "cmake %s -DTRANSLATIONS=%s -DTBS_RELEASE=YES -DTEST_BUILD_WARNING=YES %s" % (cmake_options, translation, srcdir) print(command) os.system(command) - os.system("make firmware -j6") + os.system("make firmware -j16") os.chdir(cwd) index = 0 while 1: From d188b50a06f3e569d90403c3d2a39e53f8c052b0 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 20 Dec 2020 09:43:29 +0100 Subject: [PATCH 018/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index da2a9413c..aa39c5bd1 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2052,3 +2052,5 @@ Robert Rubio Dennis G Miller Leonardo Garcia Osuna Antonio Carrasco Pastor +Musa Pinar +Jens Moder From 78b86e61d5eb38972130260408de82fc76594334 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 20 Dec 2020 19:28:57 +0100 Subject: [PATCH 019/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index aa39c5bd1..8d764caac 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2054,3 +2054,4 @@ Leonardo Garcia Osuna Antonio Carrasco Pastor Musa Pinar Jens Moder +Josef de Beer From f3ffdbff0a76365ed1c310e4ac51abd48ffdfad4 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 21 Dec 2020 12:14:18 +0100 Subject: [PATCH 020/188] Fix hardcoded string --- radio/src/gui/480x272/view_about.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/gui/480x272/view_about.cpp b/radio/src/gui/480x272/view_about.cpp index 3f5e14660..ea3561188 100644 --- a/radio/src/gui/480x272/view_about.cpp +++ b/radio/src/gui/480x272/view_about.cpp @@ -128,7 +128,7 @@ bool menuAboutView(event_t event) break; case ABOUT_HARDWARE: - lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, "FrSky", INVERS); + lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_HARDWARE_1, INVERS); lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_HARDWARE_2); lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_HARDWARE_3); break; From d712a17f62f9e337cef178da5fba1449995cf6e1 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 22 Dec 2020 10:07:37 +0100 Subject: [PATCH 021/188] Handle more module combination --- radio/src/mixer_scheduler.cpp | 7 +++++-- radio/src/tasks.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/radio/src/mixer_scheduler.cpp b/radio/src/mixer_scheduler.cpp index b29c821c8..82dfb7086 100644 --- a/radio/src/mixer_scheduler.cpp +++ b/radio/src/mixer_scheduler.cpp @@ -37,13 +37,16 @@ static MixerSchedule mixerSchedules[NUM_MODULES]; uint16_t getMixerSchedulerPeriod() { +#if defined(INTERNAL_MODULE) if (mixerSchedules[INTERNAL_MODULE].period) { return mixerSchedules[INTERNAL_MODULE].period; } - else if (mixerSchedules[EXTERNAL_MODULE].period) { +#endif +#if defined(EXTERNAL_MODULE) + if (mixerSchedules[EXTERNAL_MODULE].period) { return mixerSchedules[EXTERNAL_MODULE].period; } - +#endif return MIXER_SCHEDULER_DEFAULT_PERIOD_US; } diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index 8346b2ceb..f85c6a6b2 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -174,7 +174,14 @@ TASK_FUNCTION(mixerTask) doMixerCalculations(); // TODO: fix runMask - sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); + uint8_t runMask = 0; +#if defined(INTERNAL_MODULE) + runMask != (1 << INTERNAL_MODULE) +#endif +#if defined(EXTERNAL_MODULE) + runMask != (1 << EXTERNAL_MODULE) +#endif + sendSynchronousPulses(runMask); doMixerPeriodicUpdates(); From 803701bfb26d62356a1e125b02eec8f325508661 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 20 Dec 2020 09:43:29 +0100 Subject: [PATCH 022/188] Update CREDITS.txt --- CREDITS.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CREDITS.txt b/CREDITS.txt index 8d764caac..aa39c5bd1 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2054,4 +2054,3 @@ Leonardo Garcia Osuna Antonio Carrasco Pastor Musa Pinar Jens Moder -Josef de Beer From a6617d621fb141944a808f0745d0163790c35b71 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 20 Dec 2020 19:28:57 +0100 Subject: [PATCH 023/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index aa39c5bd1..8d764caac 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2054,3 +2054,4 @@ Leonardo Garcia Osuna Antonio Carrasco Pastor Musa Pinar Jens Moder +Josef de Beer From 70c1d77648faf107aceb3a063e5c442aaa494ee0 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 23 Dec 2020 20:24:20 +0100 Subject: [PATCH 024/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8d764caac..10e2bb105 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2055,3 +2055,4 @@ Antonio Carrasco Pastor Musa Pinar Jens Moder Josef de Beer +Chad Mofford From e64c292d73056a98765dbfc7f7b90eaf58ef7048 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 25 Dec 2020 18:55:26 +0100 Subject: [PATCH 025/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 10e2bb105..174d95b34 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2056,3 +2056,4 @@ Musa Pinar Jens Moder Josef de Beer Chad Mofford +Pim Pouw From 6daeb7477f3974200f24470752dacec935d640de Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 28 Dec 2020 11:31:11 +0100 Subject: [PATCH 026/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 174d95b34..e229ec8e1 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2057,3 +2057,4 @@ Jens Moder Josef de Beer Chad Mofford Pim Pouw +Kenth Jonsson From 749e8c547d9d5c6b1112590d5ed2385194059cc1 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 29 Dec 2020 16:07:10 +0100 Subject: [PATCH 027/188] Fix multi telemetry not working when CRSF or Ghost had been selected --- radio/src/telemetry/telemetry.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/src/telemetry/telemetry.cpp b/radio/src/telemetry/telemetry.cpp index 03878eee6..5c5b1181c 100644 --- a/radio/src/telemetry/telemetry.cpp +++ b/radio/src/telemetry/telemetry.cpp @@ -291,6 +291,7 @@ void telemetryInit(uint8_t protocol) #if defined(LUA) outputTelemetryBuffer.reset(); #endif + telemetryPortSetDirectionInput(); } else if (protocol == PROTOCOL_TELEMETRY_SPEKTRUM) { // Spektrum's own small race RX (SPM4648) uses 125000 8N1, use the same since there is no real standard From d583f7536c2bc11d41399f0f46f3bdb07e67bf39 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 29 Dec 2020 16:31:13 +0100 Subject: [PATCH 028/188] Fix compilation --- radio/src/targets/sky9x/board.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/src/targets/sky9x/board.h b/radio/src/targets/sky9x/board.h index 2d098a45f..0a6aef20d 100644 --- a/radio/src/targets/sky9x/board.h +++ b/radio/src/targets/sky9x/board.h @@ -398,6 +398,9 @@ void telemetryPortInit(uint32_t baudrate, uint8_t mode); inline void telemetryPortSetDirectionOutput() { } +inline void telemetryPortSetDirectionInput() +{ +} uint32_t telemetryTransmitPending(); void telemetryTransmitBuffer(const uint8_t * buffer, uint32_t size); void rxPdcUsart( void (*pChProcess)(uint8_t x) ); From 31c20fc8eba55359e1af92f0650374f67c35c5cd Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 8 Jan 2021 17:53:38 +0100 Subject: [PATCH 029/188] Fix synced --- radio/src/mixer_scheduler.cpp | 4 ++-- radio/src/tasks.cpp | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/radio/src/mixer_scheduler.cpp b/radio/src/mixer_scheduler.cpp index 82dfb7086..8132fe2f0 100644 --- a/radio/src/mixer_scheduler.cpp +++ b/radio/src/mixer_scheduler.cpp @@ -37,12 +37,12 @@ static MixerSchedule mixerSchedules[NUM_MODULES]; uint16_t getMixerSchedulerPeriod() { -#if defined(INTERNAL_MODULE) +#if defined(HARDWARE_INTERNAL_MODULE) if (mixerSchedules[INTERNAL_MODULE].period) { return mixerSchedules[INTERNAL_MODULE].period; } #endif -#if defined(EXTERNAL_MODULE) +#if 1 //defined(HARDWARE_EXTERNAL_MODULE) if (mixerSchedules[EXTERNAL_MODULE].period) { return mixerSchedules[EXTERNAL_MODULE].period; } diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index f85c6a6b2..8346b2ceb 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -174,14 +174,7 @@ TASK_FUNCTION(mixerTask) doMixerCalculations(); // TODO: fix runMask - uint8_t runMask = 0; -#if defined(INTERNAL_MODULE) - runMask != (1 << INTERNAL_MODULE) -#endif -#if defined(EXTERNAL_MODULE) - runMask != (1 << EXTERNAL_MODULE) -#endif - sendSynchronousPulses(runMask); + sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); doMixerPeriodicUpdates(); From 87c9cfa610da2db7480bb9ba5a2b6dce51f75080 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 10 Jan 2021 08:23:48 +0100 Subject: [PATCH 030/188] Update --- tools/build-imrc.py | 2 +- tools/build-tbs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build-imrc.py b/tools/build-imrc.py index b739a3fc6..e0c8cf061 100755 --- a/tools/build-imrc.py +++ b/tools/build-imrc.py @@ -25,7 +25,7 @@ def build(board, translation, srcdir): os.mkdir("output") path = tempfile.mkdtemp() os.chdir(path) - command = "cmake %s -DTRANSLATIONS=%s -DIMRC_RELEASE=YES -DGHOST=YES -DTEST_BUILD_WARNING=YES %s" % (cmake_options, translation, srcdir) + command = "cmake %s -DTRANSLATIONS=%s -DIMRC_RELEASE=YES -DGHOST=YES %s" % (cmake_options, translation, srcdir) print(command) os.system(command) os.system("make firmware -j16") diff --git a/tools/build-tbs.py b/tools/build-tbs.py index 729855df0..4d469c608 100755 --- a/tools/build-tbs.py +++ b/tools/build-tbs.py @@ -25,7 +25,7 @@ def build(board, translation, srcdir): os.mkdir("output") path = tempfile.mkdtemp() os.chdir(path) - command = "cmake %s -DTRANSLATIONS=%s -DTBS_RELEASE=YES -DTEST_BUILD_WARNING=YES %s" % (cmake_options, translation, srcdir) + command = "cmake %s -DTRANSLATIONS=%s -DTBS_RELEASE=YES %s" % (cmake_options, translation, srcdir) print(command) os.system(command) os.system("make firmware -j16") From 99ff3f9f8c37a63b0f787123845ad57eb8c35c49 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 10 Jan 2021 09:35:44 +0100 Subject: [PATCH 031/188] Add 'synced' to firmware options display --- radio/src/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/src/options.h b/radio/src/options.h index acadfd129..bc50f70fd 100644 --- a/radio/src/options.h +++ b/radio/src/options.h @@ -23,6 +23,7 @@ #define OPENTX_OPTIONS_H static const char * const options[] = { + "synced", #if defined(AUTOUPDATE) "autoupdate", #endif From e1e097d4294a3ce4e478d4ec4ef487caf48197e0 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 26 Jan 2021 11:50:47 +0100 Subject: [PATCH 032/188] Disable commit-tests for AR9X, 9XPRO and SKY9X in synced branch for now --- tools/commit-tests.sh | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/commit-tests.sh b/tools/commit-tests.sh index be5940308..9ecd88769 100755 --- a/tools/commit-tests.sh +++ b/tools/commit-tests.sh @@ -58,32 +58,32 @@ COMMON_OPTIONS+=${EXTRA_OPTIONS} mkdir build || true cd build -if [[ " SKY9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then - # OpenTX on Sky9x - rm -rf ./* - cmake "${COMMON_OPTIONS}" -DPCB=SKY9X -DHELI=YES DLUA=YES -DTELEMETRY=FRSKY -DPPM_LIMITS_SYMETRICAL=YES -DVARIO=YES -DAUTOSWITCH=YES -DAUTOSOURCE=YES -DAUDIO=YES -DGPS=YES -DPPM_CENTER_ADJUSTABLE=YES -DFLIGHT_MODES=YES -DOVERRIDE_CHANNEL_FUNCTION=YES -DFRSKY_STICKS=YES -DGVARS=YES "${SRCDIR}" - make -j"${CORES}" ${FIRMARE_TARGET} - make -j"${CORES}" libsimulator - make -j"${CORES}" tests-radio -fi - -if [[ " AR9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then - # OpenTX on AR9X - rm -rf ./* - cmake "${COMMON_OPTIONS}" -DPCB=AR9X -DHELI=YES -DGVARS=YES "${SRCDIR}" - make -j"${CORES}" ${FIRMARE_TARGET} - make -j"${CORES}" libsimulator - make -j"${CORES}" tests-radio -fi - -if [[ " 9XRPRO ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then - # OpenTX on Sky9x - rm -rf ./* - cmake "${COMMON_OPTIONS}" -DPCB=9XRPRO -DHELI=YES -DGVARS=YES "${SRCDIR}" - make -j"${CORES}" ${FIRMARE_TARGET} - make -j"${CORES}" libsimulator - make -j"${CORES}" tests-radio -fi +#if [[ " SKY9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then +# # OpenTX on Sky9x +# rm -rf ./* +# cmake "${COMMON_OPTIONS}" -DPCB=SKY9X -DHELI=YES DLUA=YES -DTELEMETRY=FRSKY -DPPM_LIMITS_SYMETRICAL=YES -DVARIO=YES -DAUTOSWITCH=YES -DAUTOSOURCE=YES -DAUDIO=YES -DGPS=YES -DPPM_CENTER_ADJUSTABLE=YES -DFLIGHT_MODES=YES -DOVERRIDE_CHANNEL_FUNCTION=YES -DFRSKY_STICKS=YES -DGVARS=YES "${SRCDIR}" +# make -j"${CORES}" ${FIRMARE_TARGET} +# make -j"${CORES}" libsimulator +# make -j"${CORES}" tests-radio +#fi +# +#if [[ " AR9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then +# # OpenTX on AR9X +# rm -rf ./* +# cmake "${COMMON_OPTIONS}" -DPCB=AR9X -DHELI=YES -DGVARS=YES "${SRCDIR}" +# make -j"${CORES}" ${FIRMARE_TARGET} +# make -j"${CORES}" libsimulator +# make -j"${CORES}" tests-radio +#fi +# +#if [[ " 9XRPRO ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then +# # OpenTX on Sky9x +# rm -rf ./* +# cmake "${COMMON_OPTIONS}" -DPCB=9XRPRO -DHELI=YES -DGVARS=YES "${SRCDIR}" +# make -j"${CORES}" ${FIRMARE_TARGET} +# make -j"${CORES}" libsimulator +# make -j"${CORES}" tests-radio +#fi if [[ " X9LITE ALL " =~ \ ${FLAVOR}\ ]] ; then # OpenTX on X9LITE From 2aeb5f7ae6c5a0b24dc944b94b42f3ced6b03fa5 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 1 Feb 2021 08:49:21 +0100 Subject: [PATCH 033/188] Ensure module are on after model change --- radio/src/pulses/pulses.cpp | 8 ++++++++ radio/src/pulses/pulses.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index ed56f8b61..7f0650afa 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -484,6 +484,10 @@ bool setupPulsesInternalModule() { uint8_t protocol = getRequiredProtocol(INTERNAL_MODULE); + if(protocol != PROTOCOL_CHANNELS_NONE) { + INTERNAL_MODULE_ON(); + } + heartbeat |= (HEART_TIMER_PULSES << INTERNAL_MODULE); if (moduleState[INTERNAL_MODULE].protocol != protocol) { @@ -502,6 +506,10 @@ bool setupPulsesExternalModule() { uint8_t protocol = getRequiredProtocol(EXTERNAL_MODULE); + if(protocol != PROTOCOL_CHANNELS_NONE) { + EXTERNAL_MODULE_ON(); + } + heartbeat |= (HEART_TIMER_PULSES << EXTERNAL_MODULE); if (moduleState[EXTERNAL_MODULE].protocol != protocol) { diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 84ecee015..6f37f2a60 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -353,7 +353,9 @@ inline void startPulses() setupPulsesInternalModule(); #endif +#if defined(HARDWARE_EXTERNAL_MODULE) setupPulsesExternalModule(); +#endif #if defined(HARDWARE_EXTRA_MODULE) extramodulePpmStart(); From f1e957e466eb5c771f6f3fd6aa3d8c43098cfda0 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 3 Feb 2021 10:42:04 +0100 Subject: [PATCH 034/188] Improve --- radio/src/pulses/pulses.cpp | 20 ++++++++++++-------- radio/src/pulses/pulses.h | 4 ++++ radio/src/storage/storage_common.cpp | 8 ++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 7f0650afa..94fb99d52 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -480,14 +480,16 @@ bool setupPulsesInternalModule(uint8_t protocol) } } +void stopPulsesInternalModule() +{ + intmoduleStop(); + moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; +} + bool setupPulsesInternalModule() { uint8_t protocol = getRequiredProtocol(INTERNAL_MODULE); - if(protocol != PROTOCOL_CHANNELS_NONE) { - INTERNAL_MODULE_ON(); - } - heartbeat |= (HEART_TIMER_PULSES << INTERNAL_MODULE); if (moduleState[INTERNAL_MODULE].protocol != protocol) { @@ -502,14 +504,16 @@ bool setupPulsesInternalModule() } #endif +void stopPulsesExternalModule() +{ + extmoduleStop(); + moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; +} + bool setupPulsesExternalModule() { uint8_t protocol = getRequiredProtocol(EXTERNAL_MODULE); - if(protocol != PROTOCOL_CHANNELS_NONE) { - EXTERNAL_MODULE_ON(); - } - heartbeat |= (HEART_TIMER_PULSES << EXTERNAL_MODULE); if (moduleState[EXTERNAL_MODULE].protocol != protocol) { diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 6f37f2a60..c08f8bb88 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -315,8 +315,12 @@ extern TrainerPulsesData trainerPulsesData; #if defined(HARDWARE_INTERNAL_MODULE) bool setupPulsesInternalModule(); +void stopPulsesInternalModule(); #endif +#if defined(HARDWARE_EXTERNAL_MODULE) bool setupPulsesExternalModule(); +void stopPulsesExternalModule(); +#endif void setupPulsesDSM2(); void setupPulsesCrossfire(); void setupPulsesGhost(); diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index 40bac6a67..857cdd1a6 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -53,11 +53,11 @@ void preModelLoad() } pauseMixerCalculations(); -#if defined(INTMODULE_PWR_GPIO) - INTERNAL_MODULE_OFF(); +#if defined(HARDWARE_INTERNAL_MODULE) + stopPulsesInternalModule(); #endif -#if defined(EXTMODULE_PWR_GPIO) - EXTERNAL_MODULE_OFF(); +#if defined(HARDWARE_EXTERNAL_MODULE) + stopPulsesExternalModule(); #endif stopTrainer(); From f7d17b715c2a4fb2c5eb1e1863b6aba7a1898192 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 3 Feb 2021 12:00:48 +0100 Subject: [PATCH 035/188] Please Travis --- radio/src/storage/storage_common.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index 857cdd1a6..6edf79834 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -53,11 +53,13 @@ void preModelLoad() } pauseMixerCalculations(); +#if !defined(SIMU) #if defined(HARDWARE_INTERNAL_MODULE) stopPulsesInternalModule(); #endif #if defined(HARDWARE_EXTERNAL_MODULE) stopPulsesExternalModule(); +#endif #endif stopTrainer(); From 963d7455b721ab90047919ec0f193a8aa415ccc6 Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 5 Feb 2021 16:50:02 +1100 Subject: [PATCH 036/188] Fix source filters for inputs and mixes --- companion/src/modeledit/expodialog.cpp | 2 +- companion/src/modeledit/mixerdialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index 808cff7ba..abede1d73 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -92,7 +92,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G if (firmware->getCapability(VirtualInputs)) { ui->inputName->setMaxLength(firmware->getCapability(InputsLength)); id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), - (RawSource::InputSourceGroups & ~ RawSource::NoneGroup & ~RawSource::InputsGroup)), + (RawSource::InputSourceGroups & ~RawSource::NoneGroup & ~RawSource::InputsGroup) | RawSource::TelemGroup), "RawSource"); ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id)); ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(ed->srcRaw.toValue())); diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp index 67b01f8f6..645a25274 100644 --- a/companion/src/modeledit/mixerdialog.cpp +++ b/companion/src/modeledit/mixerdialog.cpp @@ -49,7 +49,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData * mixdata, this->setWindowTitle(tr("DEST -> %1").arg(RawSource(SOURCE_TYPE_CH, md->destCh - 1).toString(&model, &generalSettings))); id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), - ((RawSource::InputSourceGroups | RawSource::ScriptsGroup) & ~ RawSource::NoneGroup)), + (RawSource::InputSourceGroups & ~RawSource::NoneGroup) | RawSource::ScriptsGroup), "RawSource"); ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id)); ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(md->srcRaw.toValue())); From b78b45723444d931315323835348ce1b7fe15fa9 Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 5 Feb 2021 13:17:54 +0100 Subject: [PATCH 037/188] Please Travis --- radio/src/pulses/pulses.cpp | 4 +++- radio/src/storage/storage_common.cpp | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 94fb99d52..f6651ce4f 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -483,7 +483,9 @@ bool setupPulsesInternalModule(uint8_t protocol) void stopPulsesInternalModule() { intmoduleStop(); - moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; + if (pulsesStarted()) { + moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; + } } bool setupPulsesInternalModule() diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index 6edf79834..857cdd1a6 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -53,13 +53,11 @@ void preModelLoad() } pauseMixerCalculations(); -#if !defined(SIMU) #if defined(HARDWARE_INTERNAL_MODULE) stopPulsesInternalModule(); #endif #if defined(HARDWARE_EXTERNAL_MODULE) stopPulsesExternalModule(); -#endif #endif stopTrainer(); From b9b5ee8a9d70f703e81ae7a632163117332bc884 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 6 Feb 2021 14:58:34 +0100 Subject: [PATCH 038/188] Add switch I X9D+2019 --- radio/src/lua/CMakeLists.txt | 1 + radio/src/lua/api_general.cpp | 2 ++ radio/src/targets/taranis/CMakeLists.txt | 1 + 3 files changed, 4 insertions(+) diff --git a/radio/src/lua/CMakeLists.txt b/radio/src/lua/CMakeLists.txt index 138c8b60a..589b5d1c1 100644 --- a/radio/src/lua/CMakeLists.txt +++ b/radio/src/lua/CMakeLists.txt @@ -24,6 +24,7 @@ if(PYTHONINTERP_FOUND) add_lua_export_target(xlite ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITE) add_lua_export_target(xlites ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITES -DPCBXLITE -DGYRO) add_lua_export_target(x9d ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9D -DPCBX9) + add_lua_export_target(x9d+2019 ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9D -DPCBX9 -DRADIO_X9DP2019) add_lua_export_target(x9e ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9E -DPCBX9) add_lua_export_target(x10 ${LUA_INCLUDES} -DPCBHORUS -DPCBX10) add_lua_export_target(x12s ${LUA_INCLUDES} -DPCBHORUS -DPCBX12S) diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 18b8c0fb8..b205b1c70 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -54,6 +54,8 @@ #include "lua/lua_exports_xlites.inc" #elif defined(PCBXLITE) #include "lua/lua_exports_xlite.inc" +#elif defined(RADIO_X9DP2019) + #include "lua/lua_exports_x9d+2019.inc" #elif defined(PCBTARANIS) #include "lua/lua_exports_x9d.inc" #endif diff --git a/radio/src/targets/taranis/CMakeLists.txt b/radio/src/targets/taranis/CMakeLists.txt index 54779f137..f399ae550 100644 --- a/radio/src/targets/taranis/CMakeLists.txt +++ b/radio/src/targets/taranis/CMakeLists.txt @@ -63,6 +63,7 @@ elseif(PCB STREQUAL X9D+) option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF) option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON) set(FLAVOUR x9d+2019) + set(LUA_EXPORT lua_export_x9d+2019) set(CPU_TYPE STM32F4) set(CPU_TYPE_FULL STM32F407xE) # for size report set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld) From 02e91afff2f96ae171d3c9857488b8f1e0dcb3b7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 8 Feb 2021 16:07:49 +0100 Subject: [PATCH 039/188] Fix model menu 9x --- radio/src/gui/128x64/model_setup.cpp | 33 ++++++++-------------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 33a3d1c36..10baf8724 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -129,9 +129,6 @@ enum MenuModelSetupItems { ITEM_MODEL_SETUP_EXTERNAL_MODULE_CHANNELS, ITEM_MODEL_SETUP_EXTERNAL_MODULE_NOT_ACCESS_RXNUM_BIND_RANGE, ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM, -#if defined(PCBSKY9X) && defined(REVX) - ITEM_MODEL_SETUP_EXTERNAL_MODULE_OUTPUT_TYPE, -#endif #if defined(AFHDS3) ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_RX_FREQ, ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_ACTUAL_POWER, @@ -151,6 +148,9 @@ enum MenuModelSetupItems { ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_2, ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_3, +#if defined(PCBSKY9X) && defined(REVX) + ITEM_MODEL_SETUP_EXTERNAL_MODULE_OUTPUT_TYPE, +#endif #if defined(PCBSKY9X) ITEM_MODEL_SETUP_EXTRA_MODULE_LABEL, ITEM_MODEL_SETUP_EXTRA_MODULE_CHANNELS, @@ -443,30 +443,15 @@ void menuModelSetup(event_t event) 0, // Throttle warning NUM_SWITCHES-1, // Switch warning - NUM_STICKS+NUM_POTS+NUM_SLIDERS-1, // Center beeps + NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1, // Center beeps 0, // Global functions - LABEL(ExternalModule), - MODULE_TYPE_ROWS(EXTERNAL_MODULE), - MULTIMODULE_TYPE_ROWS(EXTERNAL_MODULE) - MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE) - MULTIMODULE_STATUS_ROWS(EXTERNAL_MODULE) - - MODULE_CHANNELS_ROWS(EXTERNAL_MODULE), - IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, MODULE_BIND_ROWS(EXTERNAL_MODULE)), // line reused for PPM: PPM settings - IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // RxNum - 0, // Output type (OpenDrain / PushPull) - MODULE_POWER_ROW(EXTERNAL_MODULE), - IF_NOT_PXX2_MODULE(EXTERNAL_MODULE, MODULE_OPTION_ROW(EXTERNAL_MODULE)), - MULTIMODULE_MODULE_ROWS(EXTERNAL_MODULE) - FAILSAFE_ROWS(EXTERNAL_MODULE), - IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 1), // Range check and Register buttons - IF_PXX2_MODULE(EXTERNAL_MODULE, 0), // Module options - IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 1 - IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 2 - IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 3 - + EXTERNAL_MODULE_ROWS +#if defined(PCBSKY9X) && defined(REVX) + 0, // Output type (OpenDrain / PushPull) +#endif EXTRA_MODULE_ROWS + TRAINER_ROWS }); #endif From c88999827f47850a2d9d93b0b74c10def213d4b6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 8 Feb 2021 21:33:55 +0100 Subject: [PATCH 040/188] Compilation fix --- radio/src/gui/128x64/model_setup.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 10baf8724..0b9cf9868 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -239,6 +239,12 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx) #define TIMER_ROWS(x) 2, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0 #define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1), TIMER_ROWS(2) +#if defined(PCBSKY9X) && defined(REVX) + #define EXTERNAL_MODULE_OUTPUT_ROW 0, // Output type (OpenDrain / PushPull) +#else + #define EXTERNAL_MODULE_OUTPUT_ROW +#endif + #if defined(PCBSKY9X) #define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2, #else @@ -447,9 +453,9 @@ void menuModelSetup(event_t event) 0, // Global functions EXTERNAL_MODULE_ROWS -#if defined(PCBSKY9X) && defined(REVX) - 0, // Output type (OpenDrain / PushPull) -#endif + + EXTERNAL_MODULE_OUTPUT_ROW + EXTRA_MODULE_ROWS TRAINER_ROWS From 1f038dc5ce958b5ae31e9ccc31eaf84ceebd1f8a Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 9 Feb 2021 13:17:11 +0100 Subject: [PATCH 041/188] Output type only with 9xrpro and ppm and refactor --- radio/src/gui/128x64/model_setup.cpp | 52 ++++++++-------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 0b9cf9868..136ab6801 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -211,8 +211,8 @@ enum MenuModelSetupItems { #endif #if defined(PCBSKY9X) && defined(REVX) - #define OUTPUT_TYPE_ROW (isModulePPM(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW), -#elif defined(PCBSKY9X) + #define OUTPUT_TYPE_ROW (isModulePPM(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW), // Output type (OpenDrain / PushPull) +#else #define OUTPUT_TYPE_ROW #endif @@ -239,12 +239,6 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx) #define TIMER_ROWS(x) 2, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0 #define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1), TIMER_ROWS(2) -#if defined(PCBSKY9X) && defined(REVX) - #define EXTERNAL_MODULE_OUTPUT_ROW 0, // Output type (OpenDrain / PushPull) -#else - #define EXTERNAL_MODULE_OUTPUT_ROW -#endif - #if defined(PCBSKY9X) #define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2, #else @@ -393,12 +387,22 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event) #define EXTERNAL_MODULE_ROWS #endif +#if defined(PCBTARANIS) + #define WARN_ROWS \ + SW_WARN_ROWS, /* Switch warning */ \ + POT_WARN_ROWS, /* Pot warning */ +#else + #define WARN_ROWS \ + NUM_SWITCHES - 1, /* Switch warning */ +#endif + void menuModelSetup(event_t event) { int8_t old_editMode = s_editMode; #if defined(PCBTARANIS) int8_t old_posHorz = menuHorizontalPosition; +#endif MENU_TAB({ HEADER_LINE_COLUMNS @@ -416,8 +420,7 @@ void menuModelSetup(event_t event) LABEL(PreflightCheck), 0, // Checklist 0, // Throttle warning - SW_WARN_ROWS, // Switch warning - POT_WARN_ROWS, // Pot warning + WARN_ROWS NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1, // Center beeps 0, // Global functions @@ -428,39 +431,12 @@ void menuModelSetup(event_t event) EXTERNAL_MODULE_ROWS - TRAINER_ROWS - }); -#else - MENU_TAB({ - HEADER_LINE_COLUMNS - 0, - TIMERS_ROWS, - 0, // Extended limits - 1, // Extended trims - 0, // Show trims - 0, // Trims step - 0, // Throttle reverse - 0, // Throttle trace source - 0, // Throttle trim - 0, // Throttle trim switch - - LABEL(PreflightCheck), - 0, // Checklist - 0, // Throttle warning - NUM_SWITCHES-1, // Switch warning - - NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1, // Center beeps - 0, // Global functions - - EXTERNAL_MODULE_ROWS - - EXTERNAL_MODULE_OUTPUT_ROW + OUTPUT_TYPE_ROW EXTRA_MODULE_ROWS TRAINER_ROWS }); -#endif MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT); title(STR_MENUSETUP); From da3f3f60322793f21dfc3c22fb27d449ae376224 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 9 Feb 2021 17:27:12 +0100 Subject: [PATCH 042/188] Update CREDITS.txt --- CREDITS.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 384f48bbd..e77c0266f 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2126,3 +2126,13 @@ Ian Parris Danny Music Eric Bissonnette Riso LTD +William Booth +Ferenc Kunkli +Offer Shmuely +Troy Atneosen +Long Technologies +John Jaugilas +Jan-Hinrich Klee +Hans-Reinhard Mette +Alejandro Casals Oliver +David Homewood From e5d0b9d854d4a2ce5b5c611a8214653b48817b9b Mon Sep 17 00:00:00 2001 From: Kilrah Date: Wed, 10 Feb 2021 14:25:32 +0100 Subject: [PATCH 043/188] Add missing externalaccess option for T18 --- radio/util/fwoptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/util/fwoptions.py b/radio/util/fwoptions.py index 4ce915426..2349bdd18 100755 --- a/radio/util/fwoptions.py +++ b/radio/util/fwoptions.py @@ -256,6 +256,7 @@ options_jumper_t18 = { "nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"), "flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None), "bluetooth": ("BLUETOOTH", "YES", "NO"), + "externalaccessmod": ("HARDWARE_EXTERNAL_ACCESS_MOD", "YES", "NO"), } options_radiomaster_tx12 = { From 5280afecf6f248dfb08a6c41be568ec259b5695f Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 11 Feb 2021 08:43:49 +0100 Subject: [PATCH 044/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index e77c0266f..19cc3b980 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2136,3 +2136,4 @@ Jan-Hinrich Klee Hans-Reinhard Mette Alejandro Casals Oliver David Homewood +John Dunning From bdf9e630caac5c3f276b4134f97e1b0cea64f231 Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 11 Feb 2021 17:27:53 +0100 Subject: [PATCH 045/188] Improve --- radio/src/pulses/pulses.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index f6651ce4f..32ae59342 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -482,8 +482,8 @@ bool setupPulsesInternalModule(uint8_t protocol) void stopPulsesInternalModule() { - intmoduleStop(); - if (pulsesStarted()) { + if (moduleState[INTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) { + intmoduleStop(); moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; } } @@ -508,8 +508,10 @@ bool setupPulsesInternalModule() void stopPulsesExternalModule() { - extmoduleStop(); - moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; + if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED)) { + extmoduleStop(); + moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; + } } bool setupPulsesExternalModule() From e4b64b1d0e28879ae61f94d187ba1f5954668dab Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 12 Feb 2021 07:03:14 +0100 Subject: [PATCH 046/188] Fix compilation --- radio/src/pulses/pulses.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 32ae59342..c5cb0abbf 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -508,7 +508,7 @@ bool setupPulsesInternalModule() void stopPulsesExternalModule() { - if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED)) { + if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) { extmoduleStop(); moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; } From 4b3b81ae3f999c2b1253c63a523e5ea7597febfd Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 12 Feb 2021 11:44:41 +0100 Subject: [PATCH 047/188] Cosmetics --- radio/src/translations/it.h.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 9a0785a1e..796827755 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -462,7 +462,7 @@ #define TR_TTRIM TR("Trim Mot.", INDENT "Trim Motore") #define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Beep al c.", "Beep al centro") -#define TR_USE_GLOBAL_FUNCS "Usa Funz. Globali" +#define TR_USE_GLOBAL_FUNCS TR("Funz. Glob.", "Usa Funz. Globali") #if defined(PCBSKY9X) && defined(REVX) #define TR_OUTPUT_TYPE INDENT "Uscita" #endif @@ -883,7 +883,7 @@ #define TR_MORE_OPTIONS_AVAILABLE "Altre opzioni assenti" #define TR_NO_MODULE_INFORMATION "Nessuna info del modulo" #define TR_EXTERNALRF "Modulo esterno" -#define TR_FAILSAFE "Modo failsafe" +#define TR_FAILSAFE TR("Modo Fsafe", "Modo failsafe") #define TR_FAILSAFESET TR(INDENT "FAILSAFE", INDENT "IMPOSTAZIONI FAILSAFE") #define TR_REG_ID "Reg. ID" #define TR_OWNER_ID "Owner ID" From d1f500fae74e826bc113bea2dc89c2aee15b41b5 Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 12 Feb 2021 11:58:56 +0100 Subject: [PATCH 048/188] Fix some italian translation on bw --- radio/src/translations/it.h.txt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 796827755..493ff118e 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -871,28 +871,28 @@ #define TR_FLASH_EXTERNAL_MODULE TR("Prog. modulo est.", "Programma modulo esterno") #define TR_FLASH_INTERNAL_MULTI TR("Prog. MULTI int.", "Programma MULTI interno") #define TR_FLASH_EXTERNAL_MULTI TR("Prog. MULTI est.", "Programma MULTI esterno") -#define TR_FIRMWARE_UPDATE_ERROR TR(INDENT "Errore agg. FW",INDENT "Errore aggiornamento firmware") +#define TR_FIRMWARE_UPDATE_ERROR TR(INDENT "Errore agg. FW",INDENT "Errore aggiornamento firmware") #define TR_FIRMWARE_UPDATE_SUCCESS "Aggiornamento" BREAKSPACE "riuscito" -#define TR_WRITING "Scrittura..." -#define TR_CONFIRM_FORMAT "Confermi formattazione?" -#define TR_INTERNALRF "Modulo interno" +#define TR_WRITING "Scrittura..." +#define TR_CONFIRM_FORMAT "Confermi formattazione?" +#define TR_INTERNALRF "Modulo interno" #define TR_INTERNAL_MODULE TR("Modulo int.", "Modulo interno") #define TR_EXTERNAL_MODULE TR("Modulo est.", "Modulo esterno") #define TR_OPENTX_UPGRADE_REQUIRED "OpenTX richiede aggiornamento" #define TR_TELEMETRY_DISABLED TR("Telem. off", "Telem. disabilitata") #define TR_MORE_OPTIONS_AVAILABLE "Altre opzioni assenti" #define TR_NO_MODULE_INFORMATION "Nessuna info del modulo" -#define TR_EXTERNALRF "Modulo esterno" -#define TR_FAILSAFE TR("Modo Fsafe", "Modo failsafe") -#define TR_FAILSAFESET TR(INDENT "FAILSAFE", INDENT "IMPOSTAZIONI FAILSAFE") +#define TR_EXTERNALRF "Modulo esterno" +#define TR_FAILSAFE TR(INDENT "Failsafe", "Modo failsafe") +#define TR_FAILSAFESET TR(INDENT "FAILSAFE", INDENT "IMPOSTAZIONI FAILSAFE") #define TR_REG_ID "Reg. ID" #define TR_OWNER_ID "Owner ID" #define TR_PINMAPSET "PINMAP" -#define TR_HOLD "Hold" +#define TR_HOLD "Hold" #define TR_HOLD_UPPERCASE "HOLD" -#define TR_NONE "None" +#define TR_NONE "None" #define TR_NONE_UPPERCASE "NONE" -#define TR_MENUSENSOR "SENSORE" +#define TR_MENUSENSOR "SENSORE" #define TR_POWERMETER_PEAK "Picco" #define TR_POWERMETER_POWER "Potenza" #define TR_POWERMETER_ATTN "Att." @@ -934,7 +934,7 @@ #define TR_SPEAKER INDENT "Speaker" #define TR_BUZZER INDENT "Buzzer" #define TR_BYTES "Bytes" -#define TR_MODULE_BIND "[Bind]" +#define TR_MODULE_BIND TR("[Bnd]","[Bind]") #define TR_POWERMETER_ATTN_NEEDED "Attenuatore necessario" #define TR_PXX2_SELECT_RX "Seleziona RX..." #define TR_PXX2_DEFAULT "" @@ -946,8 +946,8 @@ #define TR_RECEIVER_RESET "Resetto RX?" #define TR_SHARE "Condividere" #define TR_BIND "Bind" -#define TR_REGISTER TR("Reg", "Registrare") -#define TR_MODULE_RANGE "[Range]" +#define TR_REGISTER TR("Reg", "Registrare") +#define TR_MODULE_RANGE TR("[Rng]","[Range]") #define TR_RECEIVER_OPTIONS TR("OPZIONI RX", "OPZIONI RICEVENTE") #define TR_DEL_BUTTON BUTTON(TR("Canc.", "Cancella")) #define TR_RESET_BTN "[Reset]" @@ -970,7 +970,7 @@ #define TR_TOPLCDTIMER "Timer LCD Sup." #define TR_UNIT "Unita" #define TR_TELEMETRY_NEWSENSOR INDENT "Aggiungi nuovo sensore" -#define TR_CHANNELRANGE INDENT "Numero Canali" +#define TR_CHANNELRANGE TR(INDENT "Num Canali", INDENT "Numero Canali") #define TR_AFHDS3_RX_FREQ TR("Freq. RX", "Frequenza RX") #define TR_AFHDS3_ONE_TO_ONE_TELEMETRY TR("Unicast/Tel.", "Unicast/Telemetria") #define TR_AFHDS3_ONE_TO_MANY "Multicast" From 6bd6d214f66bc28d29a83f5a54520735373131e6 Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 12 Feb 2021 12:56:16 +0100 Subject: [PATCH 049/188] Fix some italian translation on bw --- radio/src/translations/it.h.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 493ff118e..3534ac06b 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -883,7 +883,7 @@ #define TR_MORE_OPTIONS_AVAILABLE "Altre opzioni assenti" #define TR_NO_MODULE_INFORMATION "Nessuna info del modulo" #define TR_EXTERNALRF "Modulo esterno" -#define TR_FAILSAFE TR(INDENT "Failsafe", "Modo failsafe") +#define TR_FAILSAFE TR(INDENT "Failsafe", INDENT "Modo failsafe") #define TR_FAILSAFESET TR(INDENT "FAILSAFE", INDENT "IMPOSTAZIONI FAILSAFE") #define TR_REG_ID "Reg. ID" #define TR_OWNER_ID "Owner ID" From fa2dbcf72a214bbb7e5396c224d9e98c343cc961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Charpentier?= Date: Fri, 12 Feb 2021 13:03:58 +0100 Subject: [PATCH 050/188] Lapin fou/fr translation (#8280) * Updated French translation. --- companion/src/translations/companion_fr.ts | 821 +++++++-------------- 1 file changed, 286 insertions(+), 535 deletions(-) diff --git a/companion/src/translations/companion_fr.ts b/companion/src/translations/companion_fr.ts index 89a6734e2..1d1b1b331 100644 --- a/companion/src/translations/companion_fr.ts +++ b/companion/src/translations/companion_fr.ts @@ -743,58 +743,58 @@ Manche Droit: Profondeur, Direction Boards - + Left Horizontal Gauche Horizontal - + Left Vertical Gauche Vertical - + Right Vertical Droit Vertical - + Right Horizontal Droit Horizontal - + Aux. 1 - + Aux. 2 - - + + Unknown Inconnu - + Rud Dir - + Ele Prf - + Thr Gaz - + Ail @@ -8399,11 +8399,6 @@ Mixage actif par défaut si non-renseigné. Warn(%1) Alerte(%1) - - - Offset - Décalage - Flight modes @@ -8557,8 +8552,8 @@ Mixage actif par défaut si non-renseigné. - - + + Source @@ -8598,252 +8593,89 @@ Mixage actif par défaut si non-renseigné. FrSky D (câble) - + Alti Alt - + Alti+ Alt+ - + VSpeed Vitesse verticale - - - + + + A1 - - - + + + A2 - - + + A3 - - + + A4 - - + + FAS - + Cells Velm - - Calculated - Calculé - - - - Add - Addition - - - - Average - Moyenne - - - - + Min - - + Max - - Multiply - Multiplication - - - - Totalise - - - - - Cell - Element LiPo - - - - Consumption - Consommation - - - - Distance - - - - - Lowest - Min - - - - Cell %1 - Elém. %1 - - - - Highest - Max - - - - Delta - - - - - Auto Offset - Offset Auto - - - - 0. - - - - - 0.0 - - - - - 0.00 - - - - - Id - - - - - - Sensor - Capteur - - - - Sources - - - - - GPS - - - - - Blades - Pales - - - - F - - - - - Inst - - - - - Alt - Altitude - - - - Unit - Unité - - - - Prec - - - - - Ratio - - - - - Multi - - - - - Filter - Filtre - - - - Persist - - - - - Positive - - - - - Log - - - - + Numbers Chiffres - + Bars Barres - + Script - + Filename Nom de fichier - + Error: Unable to open or read file! Erreur: Impossible d'ouvrir ou de lire le fichier! @@ -8861,9 +8693,8 @@ Mixage actif par défaut si non-renseigné. - - - + + None Aucun @@ -8939,7 +8770,6 @@ Mixage actif par défaut si non-renseigné. - Custom Prédéfini @@ -9353,42 +9183,42 @@ Mixage actif par défaut si non-renseigné. ModulePanel - + Value Valeur - + Hold Maintien - + No Pulse Pas d'impulsion - + Ask Demander - + Internal Interne - + Internal + External Interne + Externe - + External Externe - + Bind on channel Bind avec VOIE @@ -10660,226 +10490,327 @@ E SensorData - + Raw (-) Chiffres bruts (-) - - + + V - + A - + mA - + kts - + m/s - + km/h - + mph - + m - + f - + °C - + °F - + % - + mAh - + W - + mW - + dB - + rpms - + g - + ° - + Rad - + hours heures - + minutes - + seconds secondes - + ml/minute - + Hertz - + mS - + uS - + TELE - - Custom - Prédéfini + + Formula + Formule - - Calculated - Calculé - - - - Add - Addition - - - - Average - Moyenne - - - - Minimum + + Id - - Maximum + + Instance + + + + + + Sensor + Capteur + + + + Sources - Multiply - Multiplication + GPS + - - Totalize - Totalisation + + Alt + Altitude - - Cell - Element LiPo - - - - Consumption - Consommation + + Unit + Unité - Distance + Precision + Précision + + + + Ratio + + + + + Offset + Décalage + + + + Auto Offset + Blades + Pales + + + + Multiplier + Multiplicateur + + + + Filter + Filtre + + + + Persist + Persistant + + + + Positive + + + + + Log + + + + + Custom + Prédéfini + + + + Calculated + Calculé + + + + Add + Addition + + + + Average + Moyenne + + + + Minimum + + + + + Maximum + + + + + Multiply + Multiplication + + + + Totalize + Totalisation + + + + Cell + Element LiPo + + + + Consumption + Consommation + + + + Distance + + + + Lowest Min - + Cell %1 Elément %1 - + Highest Max - + Delta + + + Y + O + + + + N + + Setup @@ -11063,92 +10994,92 @@ Si cette option est cochée, la voie des gaz est inversée: le ralenti est &apo SetupPanel - + Popup menu available Menu contextuel disponible - + Timer %1 Chrono %1 - + THR GAZ - + Profile Settings Paramètres du profil - + SD structure path not specified or invalid Chemin de la structure SD non spécifié ou invalide - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - + Clear Timer. Are you sure? Effacer le Chrono. Êtes-vous sûr? - + Clear all Timers. Are you sure? Effacer tous les Chronos. Êtes-vous sûr? - + Cut Timer. Are you sure? Couper le Chrono. Êtes-vous sûr? - + Delete Timer. Are you sure? Supprimer le Chrono. Êtes-vous sûr? @@ -12625,52 +12556,52 @@ Trop d'erreurs, abandon. TelemetryPanel - + FrSky S.PORT - + FrSky D - + FrSky D (cable) FrSky D (câble) - + Telemetry screen %1 Ecran de télémesure %1 - + Source - + Low Alarm Alarme basse - + Critical Alarm Alarme critique - + Winged Shadow How High - + Winged Shadow How High (not supported) Winged Shadow How High (non supporté) - + Delete Sensor. Are you sure? Supprimer le Capteur. Êtes-vous sûr? @@ -12688,279 +12619,99 @@ Trop d'erreurs, abandon. - - Custom - Prédéfini - - - - Calculated - Calculé - - - + Id - + Instance - + Rx - - Add - Addition - - - - Average - Moyenne - - - - Min - - - - - Max - - - - - Multiply - Multiplication - - - - Totalize - Totalisation - - - - Cell - Element LiPo - - - - Consumption - Consommation - - - - Dist - Distance - - - + Cells Sensor : Capteur d'éléments: - - - - - - - - + + + + + + + + --- - + GPS Sensor : Capteur GPS: - + Alt. Sensor : Capteur d'altitude: - + Sensor : Capteur: - - V - - - - - A - - - - - mA - - - - - kt - - - - - m/s - - - - - ft/s - - - - - km/h - - - - - mph - - - - - m - - - - - ft - - - - - °C - - - - - °F - - - - - % - - - - - mAh - - - - - W - - - - - mW - - - - - dBm - - - - - g - - - - - ° - - - - - Rad - - - - - mL - - - - - US fl.Oz. - - - - - Raw (-) - Chiffres bruts (-) - - - - RPM - Tours/minute - - - - ml/min - - - - + Precision Précision - + Ratio - + Blades Pales - + Offset Décalage - + Multiplier Multiplicateur - + Auto Offset Offset auto - + Filter Filtre - + Persistent Persistant - + Positive - + Logs @@ -12968,72 +12719,72 @@ Trop d'erreurs, abandon. TelemetrySensorPanel - + TELE%1 - + Popup menu available Menu contextuel disponible - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - + Cut Telemetry Sensor. Are you sure? Couper le capteur de télémétrie. Êtes-vous sûr? - + Clear Telemetry Sensor. Are you sure? Effacer le capteur de télémétrie. Êtes-vous sûr? - + Clear all Telemetry Sensors. Are you sure? Effacez tous les capteurs de télémétrie. Êtes-vous sûr? @@ -13403,12 +13154,12 @@ hh:mm:ss Timer - + Countdown Compte à rebours - + Minute Call Annonces minutes From 8751ae31755360668308e5def25d7c7a14b7cffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=8F=20=E3=81=BE=E3=82=8A=E3=81=82?= =?UTF-8?q?=E3=81=A6=E3=82=8C=E3=81=98=E3=81=82?= <36994795+ToshihiroMakuuchi@users.noreply.github.com> Date: Sat, 13 Feb 2021 22:20:45 +0900 Subject: [PATCH 051/188] Update Japanese translation. --- companion/src/translations/companion_ja.ts | 2044 +++++++++----------- 1 file changed, 894 insertions(+), 1150 deletions(-) diff --git a/companion/src/translations/companion_ja.ts b/companion/src/translations/companion_ja.ts index 2d7d02b4d..d423959d4 100644 --- a/companion/src/translations/companion_ja.ts +++ b/companion/src/translations/companion_ja.ts @@ -730,58 +730,58 @@ Mode 4: Boards - + Left Horizontal 左・横 - + Left Vertical 左・縦 - + Right Vertical 右・縦 - + Right Horizontal 右・横 - + Aux. 1 AUX. 1 - + Aux. 2 AUX. 2 - - + + Unknown 不明 - + Rud ラダー - + Ele エレベーター - + Thr スロットル - + Ail エルロン @@ -828,44 +828,44 @@ Mode 4: - Channels + ChannelsPanel - + Name 名称 - + Subtrim サブトリム - + Min 最小 - + Max 最大 - + Direction 方向 - + Curve カーブ - + PPM Center PPM センター - + Linear Subtrim 線形サブトリム @@ -890,67 +890,67 @@ Mode 4: リバース - + Delete Channel. Are you sure? チャンネルを削除します。よろしいですか? - + Cut Channel. Are you sure? チャンネルを切り取ります。よろしいですか? - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Clear Channel. Are you sure? チャンネルを消去します。よろしいですか? - + Clear all Channels. Are you sure? チャンネルをすべて消去します。よろしいですか? @@ -1090,37 +1090,37 @@ Mode 4: 送信機と機体モデルの設定 - + Select or create a file for exported Settings: エクスポートした設定ファイルを選択または作成します: - + Press the 'Retry' button to choose another file. 別のファイルを選択するには『再試行』ボタンを押してください。 - + Simulator for this firmware is not yet available このファームウェアのシミュレータはまだ利用できません - + Uknown error during Simulator startup. シミュレータ起動中に不明なエラーが発生しました。 - + Simulator Error シミュレータ エラー - + Data Load Error データロード エラー - + Error occurred while starting simulator. シミュレータ起動中にエラーが発生しました。 @@ -1376,51 +1376,28 @@ If you have a settings backup file, you may import that instead. - CurveGroup + CurveReference - + Diff 差分 - + Expo エクスポ - + Func 機能 - + Curve カーブ - - CurveReference - - - Diff(%1) - 差分(%1) - - - - Expo(%1) - エクスポ(%1) - - - - Function(%1) - 機能(%1) - - - - Curve(%1) - カーブ(%1) - - Curves @@ -1509,113 +1486,116 @@ If you have a settings backup file, you may import that instead. Point size 点のサイズ + + + CurvesPanel - + Curve %1 カーブ %1 - + Popup menu available 利用可能なポップアップメニュー - + %1 points %1 点 - + Linear 線形 - + Single Expo シングルエクスポ - + Symmetrical f(x)=-f(-x) 対称 f(x)=-f(-x) - + Symmetrical f(x)=f(-x) 対称 f(x)=f(-x) - + Editing curve %1 カーブ %1 編集 - + Not enough free points in EEPROM to store the curve. EEPROMにカーブを保存する十分な空き容量がありません。 - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Clear Curve. Are you sure? カーブを消去します。よろしいですか? - + Clear all Curves. Are you sure? カーブをすべて消去します。よろしいですか? - + Cut Curve. Are you sure? カーブを切り取ります。よろしいですか? - + Delete Curve. Are you sure? カーブを削除します。よろしいですか? @@ -1689,8 +1669,13 @@ If you have a settings backup file, you may import that instead. - Set Timer %1 - 設定: タイマー %1 + Set %1 + 設定 %1 + + + + Set Failsafe + フェイルセーフ設定 @@ -1750,75 +1735,50 @@ If you have a settings backup file, you may import that instead. Adjust %1 - アジャスト %1 - - - - SetFailsafe Int. Module - 設定: フェイルセーフ 内部モジュール + 調整 %1 - SetFailsafe Ext. Module - 設定: フェイルセーフ 外部モジュール - - - RangeCheck Int. Module レンジチェック 内部モジュール - + RangeCheck Ext. Module レンジチェック 外部モジュール - + Bind Int. Module バインド 内部モジュール - + Bind Ext. Module バインド 外部モジュール - - Timer1 - タイマー1 - - - - Timer2 - タイマー2 - - - - Timer3 - タイマー3 - - - + Flight フライト - + Telemetry テレメトリー - + Rotary Encoder エンコーダ再生 - + REa エンコーダ再生a - + REb エンコーダ再生b @@ -1855,7 +1815,7 @@ If you have a settings backup file, you may import that instead. 無効 - + CFN CFN @@ -1863,139 +1823,139 @@ If you have a settings backup file, you may import that instead. CustomFunctionsPanel - + Switch スイッチ - + Action 実行 - + Parameters パラメータ - + Enable 有効 - + Popup menu available 利用可能なポップアップメニュー - + SF%1 SF%1 - + GF%1 GF%1 - + ON ON - + Error occurred while trying to play sound, possibly the file is already opened. (Err: %1 [%2]) サウンド再生中にエラーが発生しました。おそらくファイルは既に開かれています (Err: %1 [%2]) - + Unable to find or open sound file: %1 音源ファイルが見つからない、または開けません。 %1 - + Delete Function. Are you sure? ファンクションを削除します。よろしいですか? - + Cut Special Function. Are you sure? ファンクションを切り取ります。よろしいですか? - + Clear Function. Are you sure? ファンクションを消去します。よろしいですか? - + Clear all Functions. Are you sure? ファンクションをすべて消去します。よろしいですか? - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Value 値 - + Source 選択元 - + GVAR GVAR - + Increment 増加 @@ -2163,48 +2123,48 @@ If you have a settings backup file, you may import that instead. フィールド %1 変換エラー - + Switch スイッチ - + Switch スイッチ - + cannot be exported on this board! このボードにエクスポートできません! - + Source 選択元 - + Source %1 cannot be exported on this board! このボードでは選択元 %1 をエクスポートできません! - + OpenTX only accepts %1 points in all curves OpenTXはすべてのカーブで %1 点のみを許容します - + OpenTx only accepts %1 points in all curves OpenTxはすべてのカーブで %1 点のみを許容します - - + + OpenTX on this board doesn't accept this function このボード上のOpenTXはこの機能を受け付けません - + OpenTX doesn't accept this radio protocol OpenTXはこの送信機プロトコルを受け付けません @@ -2219,18 +2179,18 @@ If you have a settings backup file, you may import that instead. <html><head/><body><p>Enable or disable the filter. If the button won't stay enabled, it is likely there is a syntax error in the Regular Expression entered.</p></body></html> - <html><head/><body><p>フィルタを有効または無効にします。ボタンが有効にならない場合は、入力した正規表現に構文エラーがある可能性があります。</p></body></html> + <html><head/><body><p>フィルターを有効または無効にします。ボタンが有効にならない場合は、入力した正規表現に構文エラーがある可能性があります。</p></body></html> Filter: - フィルタ: + フィルター: <html><head/><body><p>Enter filter text here. Click the help/info button for details about using the filter. </p><p> To <b>remove a remembered entry</b> from the filter list, first choose it, and then press <code>Shift-Delete</code> (or <code>Shift-Backspace</code>) key combination.</p></body></html> - <html><head/><body><p>ここにフィルタテキストを入力してください。フィルタの使用方法の詳細は、help / info ボタンをクリックしてください。</p><p> + <html><head/><body><p>ここにフィルタテキストを入力してください。フィルターの使用方法の詳細は、help / info ボタンをクリックしてください。</p><p> フィルタリストから<b>保存したエントリを削除</b>するには、選択してから<code>Shift+Delete</code> (または<code>Shift+Backspace</code>) キーを押してください。</p></body></html> @@ -2246,12 +2206,12 @@ To <b>remove a remembered entry</b> from the filter list, first cho Filter &Help - フィルタ &ヘルプ + フィルター &ヘルプ Show information about using the filter. - フィルタの使用に関する情報を表示します。 + フィルターの使用に関する情報を表示します。 @@ -2276,22 +2236,22 @@ To <b>remove a remembered entry</b> from the filter list, first cho Enable &Filter - 有効 &フィルタ + 有効 &フィルター Turn the filter on/off. - フィルタをON / OFFします。 + フィルターをON / OFFします。 <html><head><style>kbd {background-color: palette(alternate-base); font-size: large; white-space: nowrap;}</style></head><body><p>The filter supports two syntax types: basic matching with common wildcards as well as full Perl-style (<code>pcre</code>) Regular Expressions.</p><p>By default a filter will only show lines which match (<b>inclusive</b>). To make an <b>exclusive</b> filter which removes matching lines, prefix the filter expression with a <kbd>!</kbd> (exclamation mark).</p><p>To use <b>Regular Expressions</b> (RegEx), prefix the filter text with a <kbd>/</kbd> (slash) or <kbd>^</kbd> (up caret). <ul><li>Put the <kbd>/</kbd> or <kbd>^</kbd> after the exclusive <kbd>!</kbd> indicator if you're using one.</li><li>By default the match is case-sensitive. To make it insensitive, add the typical <kbd>/i</kbd> (slash i) operator at the end of your RegEx.</li><li>If you use a caret (^) to denote a RegEx, it will become part of the Reg. Ex. (that is, matches from start of line).</li><li>If the RegEx is invalid, the filter edit field should show a red border and you will not be able to enable the filter.</li><li>A useful resource for testing REs (with a full reference) can be found at <a href="http://www.regexr.com/">http://www.regexr.com/</a></li></ul></p><p>To use <b>basic matching</b> just type any text.<ul><li>Wildcards: <kbd>*</kbd> (asterisk) matches zero or more of any character(s), and <kbd>?</kbd> (question mark) matches any single character.</li><li>The match is always case-insensitive.</li><li>The match always starts from the beginning of a log line. To ignore characters at the start, use a leading <kbd>*</kbd> wildcard.</li><li>A trailing <kbd>*</kbd> is always implied (that is, matches anything to the end of the log line). To avoid this, use a RegEx.</li><li>You can match literal wildcard characters by prefixing them with a <kbd>\</kbd> (backslash) character (eg. "foo\*bar" matches "foo*bar").</li></ul></p><p>After <b>editing text</b>, press ENTER or TAB key (or click anywhere outside the box) to update the filter.</p><p>To <b>remove an entry</b> from the filter selector list, first choose it, and while in the line editor press <kbd>Shift-Delete</kbd> (or <kbd>Shift-Backspace</kbd>) key combination. The default filters cannot be removed. Up to 50 filters are stored.</p></body></html> - <html><head><style>kbd {background-color: palette(alternate-base); font-size: large; white-space: nowrap;}</style></head><body><p>フィルタは2つのシンタックスタイプをサポートしています: 一般的なワイルドカードを用いた完全一致、そして完全なPerlスタイル (<code>pcre</code>) 正規表現です。初期値ではフィルタは一致する (<b>包括的</b>) な行のみを表示します。一致する行を削除する<b>排他的</b>フィルタを作成するには、フィルタ式の先頭に<kbd>!</kbd>(Exclamationマーク)を付けます。</p><p>To use <b>Regular Expressions</b> (RegEx), prefix the filter text with a <kbd>/</kbd> (slash) or <kbd>^</kbd> (up caret). <b>正規表現</b> (RegEx)を使用するには、フィルタテキストの先頭に<kbd>/</kbd> (スラッシュ) または<kbd>^</kbd>(アップキャレット)を付けます。<ul><li>既に <kbd>/</kbd> または <kbd>^</kbd> を使用している場合は、 <kbd>!</kbd> の後ろに置きます。</li><li>初期値では大文字と小文字が区別されます。それを鈍感にするには、正規表現の最後に典型的な <kbd>/i</kbd> (スラッシュ+i)演算子を追加します。</li> <li> 正規表現を表すためにキャレット『^』を使用すると、それは正規表現の一部になります。例(つまり、行頭から一致します。)</li> <li> 正規表現が無効な場合、フィルタ編集フィールドには赤い枠が表示されフィルタを有効にすることはできません。</li> <li> 正規表現のテストに役立つリソース(参考文献)は、<a href="http://www.regexr.com/"> http://www.regexr.com/にあります。</a></li> </ul></p><p><b>標準一致 basic matching</b> を使用するには、テキストを入力するだけです。<ul><li>ワイルドカード: <kbd>*</kbd> (アスタリスク)は0個以上の任意の文字に一致し、 <kbd>?</kbd> (クエスチョンマーク) は任意の1文字に一致します。</li><li>この一致では常に大文字と小文字が区別されません。</li><li>一致は常にログの先頭行から始まります。 先頭の文字を無視するには、先頭に<kbd>*</kbd>ワイルドカードを使用します。</li><li>末尾の <kbd>*</kbd> は常に暗黙的に指定されます。(つまり、ログ末尾行までが対象) これを回避するには、正規表現を使用します。</li><li>リテラルワイルドカード文字の前に <kbd>\</kbd> (バックスラッシュ) 文字を付けることで一致させることができます。(例: "foo\*bar"は"foo*bar"と一致)</li></ul></p><p><b>テキスト編集</b>後、EnterまたはTabキーを押して (またはボックスの外側をクリックし) フィルタを更新します。</p><p>フィルタセレクタリストから<b>エントリー削除</b>をするには、まずエントリーを選択しエディタで<kbd>Shift+Delete</kbd> (または<kbd>Shift+Backspace</kbd>) を押します。デフォルトのフィルタは削除できません。また最大50個のフィルタが保存されています。</p></body></html> + <html><head><style>kbd {background-color: palette(alternate-base); font-size: large; white-space: nowrap;}</style></head><body><p>フィルターは2つのシンタックスタイプをサポートしています: 一般的なワイルドカードを用いた完全一致、そして完全なPerlスタイル (<code>pcre</code>) 正規表現です。初期値ではフィルターは一致する (<b>包括的</b>) な行のみを表示します。一致する行を削除する<b>排他的</b>フィルターを作成するには、フィルター式の先頭に<kbd>!</kbd>(Exclamationマーク)を付けます。</p><p>To use <b>Regular Expressions</b> (RegEx), prefix the filter text with a <kbd>/</kbd> (slash) or <kbd>^</kbd> (up caret). <b>正規表現</b> (RegEx)を使用するには、フィルターテキストの先頭に<kbd>/</kbd> (スラッシュ) または<kbd>^</kbd>(アップキャレット)を付けます。<ul><li>既に <kbd>/</kbd> または <kbd>^</kbd> を使用している場合は、 <kbd>!</kbd> の後ろに置きます。</li><li>初期値では大文字と小文字が区別されます。それを鈍感にするには、正規表現の最後に典型的な <kbd>/i</kbd> (スラッシュ+i)演算子を追加します。</li> <li> 正規表現を表すためにキャレット『^』を使用すると、それは正規表現の一部になります。例(つまり、行頭から一致します。)</li> <li> 正規表現が無効な場合、フィルター編集フィールドには赤い枠が表示されフィルターを有効にすることはできません。</li> <li> 正規表現のテストに役立つリソース(参考文献)は、<a href="http://www.regexr.com/"> http://www.regexr.com/にあります。</a></li> </ul></p><p><b>標準一致 basic matching</b> を使用するには、テキストを入力するだけです。<ul><li>ワイルドカード: <kbd>*</kbd> (アスタリスク)は0個以上の任意の文字に一致し、 <kbd>?</kbd> (クエスチョンマーク) は任意の1文字に一致します。</li><li>この一致では常に大文字と小文字が区別されません。</li><li>一致は常にログの先頭行から始まります。 先頭の文字を無視するには、先頭に<kbd>*</kbd>ワイルドカードを使用します。</li><li>末尾の <kbd>*</kbd> は常に暗黙的に指定されます。(つまり、ログ末尾行までが対象) これを回避するには、正規表現を使用します。</li><li>リテラルワイルドカード文字の前に <kbd>\</kbd> (バックスラッシュ) 文字を付けることで一致させることができます。(例: "foo\*bar"は"foo*bar"と一致)</li></ul></p><p><b>テキスト編集</b>後、EnterまたはTabキーを押して (またはボックスの外側をクリックし) フィルターを更新します。</p><p>フィルターセレクタリストから<b>エントリー削除</b>をするには、まずエントリーを選択しエディタで<kbd>Shift+Delete</kbd> (または<kbd>Shift+Backspace</kbd>) を押します。デフォルトのフィルターは削除できません。また最大50個のフィルターが保存されています。</p></body></html> Debug Console Filter Help - デバッグコンソールフィルタ ヘルプ + デバッグコンソールフィルター ヘルプ @@ -2536,27 +2496,27 @@ If blank then the input is considered to be "ON" all the time.ミキサー選択元 - + Edit %1 編集 %1 - + Popup menu available 利用可能なポップアップメニュー - + Clear All すべて消去 - + Set All すべて設定 - + Invert All すべてリバース @@ -2925,255 +2885,293 @@ Blank means include all. ?, *, and [...] wildcards accepted. Firmware - + Channel values displayed in us 表示されるチャンネル値 - + No OverrideCH functions available 使用可能な上書きチャンネル機能はありません - + Possibility to enable FAI MODE (no telemetry) at field フィールドでFAIモード (テレメトリーなし) を有効にする可能性 - + FAI MODE (no telemetry) always enabled FAIモード (テレメトリーなし) を常に有効 - + Removes D8 FrSky protocol support which is not legal for use in the EU on radios sold after Jan 1st, 2015 2015/01/01以降に販売された送信機に対し、EUでの使用に適さないD8 FrSkyプロトコルサポートを削除 - + Enable non certified firmwares 認定されていないファームウェアを有効にする - - + + + + + Disable HELI menu and cyclic mix support HELIメニューとサイクリックミックスサポートを無効にする - - + + + + + Disable Global variables グローバル変数を無効にする - - + + + + + Enable Lua custom scripts screen Luaカスタムスクリプト画面を有効にする - + Use alternative SQT5 font SQT5 代替フォントを使用する - + Pots use in menus navigation メニューナビゲーションでダイヤルを使用 - + FrSky Taranis X9D+ FrSky Taranis X9D+ - - + + Disable RAS (SWR) RAS (SWR)を無効にする - + FrSky Taranis X9D+ 2019 - + FrSky Taranis X9D FrSky Taranis X9D - + Haptic module installed タッチパネル対応モジュールをインストール - + FrSky Taranis X9E FrSky Taranis X9E - + Confirmation before radio shutdown 送信機シャットダウン前の確認 - + Horus gimbals installed (Hall sensors) Horusジンバル (ホールセンサー) をインストール - + FrSky Taranis X9-Lite FrSky Taranis X9-Lite - + FrSky Taranis X9-Lite S - + FrSky Taranis X7 / X7S FrSky Taranis X7 / X7S - + FrSky Taranis X-Lite S/PRO FrSky Taranis X-Lite S/PRO - + FrSky Taranis X-Lite FrSky Taranis X-Lite - + FrSky Horus X10 / X10S FrSky Horus X10 / X10S - + + + + + + Support hardware mod: R9M ACCESS + ハードウェアモジュールサポート: R9M ACCESS + + + FrSky Horus X12S FrSky Horus X12S - + Use ONLY with first DEV pcb version 初期DEV pcbバージョンでのみ使用 - - + + Support for MULTI internal module MULTI内部モジュールのサポート - - - + + Jumper T-Lite + Jumper T-Lite + + + + + Support for bluetooth module Bluetoothモジュールのサポート - + + Radiomaster TX12 + Radiomaster TX12 + + + + Radiomaster T8 + Radiomaster T8 + + + + Allow bind using bind key + バインドキーを使用したバインドを許可 + + + Radiomaster TX16S / SE / Hall / Masterfire Radiomaster TX16S / SE / Hall / Masterfire - + Jumper T18 Jumper T18 - + Turnigy 9XR-PRO Turnigy 9XR-PRO - + Enable HELI menu and cyclic mix support HELIメニューとサイクリックミックスのサポートを有効にする - + Enable AFHDS3 support AFHDS3サポート 有効 - + Global variables グローバル変数 - + In model setup menus automatically set source by moving the control モデル設定メニューでは、コントローラーを動かし自動的に選択元を設定します - + In model setup menus automatically set switch by moving the control モデル設定メニューでは、コントローラーを動かし自動的にスイッチを設定します - + No graphical check boxes and sliders グラフィカルなチェックボックスとスライダーはありません - + Battery graph バッテリーグラフ - + Don't use bold font for highlighting active items 有効なアイテムを強調表示するために太字フォントを使用しない - + FrSky Taranis X7 / X7S Access FrSky Taranis X7 / X7S ACCESS - - + + Support for ACCESS internal module replacement ACCESS内部モジュール変更のサポート - + Enable resetting values by pressing up and down at the same time 上下に同時に押し、値のリセットを有効にする - + 9X with AR9X board 9X AR9Xボード - + FrSky Horus X10 Express / X10S Express FrSky Horus X10 Express / X10S Express - + Jumper T12 / T12 Pro Jumper T12 / T12 Pro - + Jumper T16 / T16+ / T16 Pro Jumper T16 / T16+ / T16 Pro - + Support internal GPS 内蔵GPSサポート - + 9X with Sky9x board 9X Sky9Xボード @@ -3670,88 +3668,88 @@ You are currently using: FlightModePanel - - + + Popup menu available 利用可能なポップアップメニュー - + Trim disabled トリム 無効 - + Own Trim 独自トリム - + Use Trim from Flight mode %1 フライトモードからトリムを使用してください %1 - + Use Trim from Flight mode %1 + Own Trim as an offset フライトモードからトリムを使用してください %1+オフセット独自トリム - + Rotary Encoder %1 ロータリーエンコーダ %1 - + Name 名称 - + Value source 元値 - + Value 値 - + Unit ユニット - + Prec - + Min 最小 - + Max 最大 - + Popup enabled ポップアップ有効 - + GVAR%1 - + 0._ - + 0.0 0.0 @@ -3767,49 +3765,49 @@ You are currently using: - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 @@ -3819,63 +3817,63 @@ You are currently using: フライトモードを消去します。よろしいですか? - + Clear all Flight Modes. Are you sure? フライトモードをすべて消去します。よろしいですか? - + Cut Flight Mode. Are you sure? フライトモードを切り取ります。よろしいですか? - + Delete Flight Mode. Are you sure? フライトモードを削除します。よろしいですか? - + Clear Global Variable across all Flight Modes. Are you sure? すべてのフライトモードのグローバル変数を消去します。よろしいですか? - + Clear Global Variable. Are you sure? グローバル変数を消去します。よろしいですか? - + Cut Global Variable across all Flight Modes. Are you sure? すべてのフライトモードのグローバル変数を切り取ります。よろしいですか? - + Cut Global Variable. Are you sure? グローバル変数を切り取ります。よろしいですか? - + Delete Global Variable. Are you sure? グローバル変数を削除します。よろしいですか? - + Paste to selected Global Variable across all Flight Modes. Are you sure? すべてのフライトモードで選択したグローバル変数を貼り付けます。よろしいですか? - + Clear all Global Variables for all Flight Modes. Are you sure? すべてのフライトモードのすべてのグローバル変数を消去します。よろしいですか? - + Clear all Global Variables for this Flight Mode. Are you sure? このフライトモードのすべてのグローバル変数を消去します。よろしいですか? - + Clear 消去 @@ -3883,17 +3881,17 @@ You are currently using: FlightModesPanel - + Flight Mode %1 フライトモード %1 - + (%1) (%1) - + (default) (初期値) @@ -4133,12 +4131,12 @@ p, li { white-space: pre-wrap; } - + Own value 独自トリム - + Flight mode %1 value フライトモード %1 値 @@ -4168,52 +4166,52 @@ These will be relevant for all models in the same EEPROM. これらは同じEEPROM内のすべてのモデルに関連します。 - + Setup セットアップ - + Global Functions グローバルファンクション - + Trainer トレーナー - + Hardware ハードウェア - + Calibration 校正 - + Wrong data in profile, radio calibration was not retrieved プロファイルデータが正しくなく、送信機校正情報が取得できませんでした - + Wrong data in profile, Switch/pot config not retrieved プロファイルデータが正しくなく、スイッチ/ダイヤル構成が取得できませんでした - + Wrong data in profile, hw related parameters were not retrieved プロファイルデータが正しくなく、HW関連パラメーターが取得できませんでした - + Do you want to store calibration in %1 profile<br>overwriting existing calibration? 既存の校正情報を上書きして %1 プロファイルに校正情報を保存しますか? - + Calibration and HW parameters saved. 校正情報とHWパラメータが保存されました。 @@ -4221,7 +4219,7 @@ These will be relevant for all models in the same EEPROM. GeneralSettings - + Radio Settings 送信機設定 @@ -4306,7 +4304,7 @@ These will be relevant for all models in the same EEPROM. Adjust RTC - 時計調整 + 内蔵時計調整 @@ -4823,7 +4821,7 @@ Acceptable values are 5v..10v Low EEPROM Warning - EEPROM残量警告 + EEPROM 残量警告 @@ -5262,252 +5260,257 @@ Are you sure ? フォーム - + SQ SQ - + SR SR - + LS2 LS2 - + SP SP - + SO SO - + S4 S4 - + RS RS - + SB SB - + PPM 2 PPM 2 - + Antenna アンテナ - + S5 S5 - + OFF OFF - + S-Port Mirror S-Port ミラー - + Telemetry テレメトリー - + SBUS Trainer SBUS トレーナー - + Debug デバッグ - + RTC Batt Check - RTC Battチェック + 内蔵電池チェック - + + S.Port Power + S.Port 出力 + + + Rud ラダー - + PPM 3 PPM 3 - + S1 S1 - + S2 S2 - + S3 S3 - + PPM 1 PPM 1 - + Serial Port シリアルポート - + v v - + PPM Multiplier PPM 乗算 - + Current Offset 現在のオフセット - + PPM 4 PPM 4 - + SA SA - + Ele エレベーター - + Ail エルロン - + Thr スロットル - + SC SC - + LS LS - + SD SD - + Battery Offset バッテリーオフセット - + SE SE - + SF SF - + SG SG - + SH SH - + SI SI - + SJ SJ - + SK SK - + SL SL - + SM SM - + SN SN - + RS2 RS2 - + Bluetooth Bluetooth - + ADC Filter - ADCフィルタ + ADCフィルター - + Device Name: デバイス名: @@ -5516,8 +5519,8 @@ Are you sure ? HardwarePanel - - + + None なし @@ -5537,67 +5540,67 @@ Are you sure ? 3 ポジション - + Pot with detent ダイヤル (ノッチあり) - + Multipos switch マルチPosスイッチ - + Pot without detent ダイヤル (ノッチなし) - + Slider with detent スライダー (ノッチあり) - + OFF OFF - + Enabled 有効 - + Telemetry テレメトリー - + Trainer トレーナー - + Internal 内部 - + Ask 確認 - + Per model Per モデル - + Internal + External 内部 + 外部 - + External 外部 @@ -5723,159 +5726,159 @@ Are you sure ? InputsPanel - - - + + + Move Up 上へ移動 - - + + Ctrl+Up - - - + + + Move Down 下へ移動 - - + + Ctrl+Down - + Clear All Inputs すべての入力項目を消去 - + Not enough available Inputs! 入力項目が不足しています! - + Delete selected Input lines. Are you sure? 選択したInput行を削除します。よろしいですか? - + Cut selected Input lines. Are you sure? 選択したInput行を切り取ります。よろしいですか? - + Lines 直線 - + &Add &追加 - + Ctrl+A - + &Edit &編集 - + Enter Enter - + &Delete &削除 - - + + Delete 削除 - + &Copy &コピー - + Ctrl+C - + &Cut &切り取り - + Ctrl+X - + &Paste &貼り付け - + Ctrl+V - + Du&plicate &複製 - + Ctrl+U - + Input 入力 - + Insert 挿入 - + Clear 消去 - + Clear All すべて消去 - + Clear all Input lines. Are you sure? すべてのInput行を消去します。よろしいですか? - + Clear all lines for the selected Inputs. Are you sure? 選択したすべてのInput行を消去します。よろしいですか? - + Delete all lines for the selected Inputs. Are you sure? 選択したすべてのInput行を削除します。よろしいですか? @@ -5901,7 +5904,7 @@ Are you sure ? LimitsGroup - + GV @@ -6032,112 +6035,112 @@ Are you sure ? LogicalSwitchesPanel - + Function 機能 - + V1 - + V2 - + AND Switch & スイッチ - + Duration 期間 - + Delay 遅延 - + Popup menu available 利用可能なポップアップメニュー - + (instant) (瞬間) - + (infinite) (無制限) - + Delete Logical Switch. Are you sure? 論理スイッチを削除します。よろしいですか? - + Cut Logical Switch. Are you sure? 論理スイッチを切り取ります。よろしいですか? - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Clear Logical Switch. Are you sure? 論理スイッチを消去します。よろしいですか? - + Clear all Logical Switches. Are you sure? 論理スイッチをすべて消去します。よろしいですか? @@ -7872,27 +7875,27 @@ If blank then the mix is considered to be "ON" all the time. 空白の場合、ミックスは常に『オン』と見なします。 - + DEST -> %1 - + Click to access popup menu クリックしてポップアップメニューにアクセス - + Clear All すべて消去 - + Set All すべて設定 - + Invert All すべてリバース @@ -7923,136 +7926,136 @@ If blank then the mix is considered to be "ON" all the time. MixesPanel - - + + Move Up 上へ移動 - - + + Ctrl+Up - - + + Move Down 下へ移動 - - + + Ctrl+Down - + Clear Mixes ミキサーを消去 - + Not enough available mixers! ミキサー項目が足りません! - + Delete selected Mix lines. Are you sure? 選択したMix行を削除します。よろしいですか? - + Cut selected Mix lines. Are you sure? 選択したMix行を切り取ります。よろしいですか? - + &Add &追加 - + Ctrl+A - + &Edit &編集 - + Enter Enter - + &Toggle highlight &ハイライト切替 - + Ctrl+T - + &Delete &削除 - + Delete 削除 - + &Copy &コピー - + Ctrl+C - + C&ut &切り取り - + Ctrl+X - + &Paste &貼り付け - + Ctrl+V - + Du&plicate &複製 - + Ctrl+U - + Clear Mixes? ミキサーを消去しますか? - + Really clear all the mixes? すべてのミキサーを本当に消去しますか? @@ -8069,6 +8072,11 @@ If blank then the mix is considered to be "ON" all the time. Throttle Source スロットル値 + + + THR + THR + ModelEdit @@ -8083,52 +8091,52 @@ If blank then the mix is considered to be "ON" all the time. シミュレート - + Setup セットアップ - + Heli ヘリ - + Flight Modes フライトモード - + Inputs 入力 - + Mixes ミキサー - + Outputs 出力 - + Curves カーブ - + Logical Switches 論理スイッチ - + Special Functions スペシャルファンクション - + Telemetry テレメトリー @@ -8183,8 +8191,8 @@ If blank then the mix is considered to be "ON" all the time. - - + + OFF OFF @@ -8225,7 +8233,7 @@ If blank then the mix is considered to be "ON" all the time. - + Mode モード @@ -8259,14 +8267,13 @@ If blank then the mix is considered to be "ON" all the time. - - + Delay 遅延 - + Receiver 受信機 @@ -8358,11 +8365,10 @@ If blank then the mix is considered to be "ON" all the time. - - - - - + + + + None なし @@ -8403,528 +8409,353 @@ If blank then the mix is considered to be "ON" all the time. FM%1+%2 - - - - Weight - ウェイト - - - - - Switch - スイッチ - - + NoTrim トリムなし + Offset(%1) オフセット(%1) - + MULT! 複数! - + No DR/Expo DR/Expoなし - - - Offset - オフセット + + + Weight(%1) + ウェイト(%1) - - Slow - ゆっくり + + + Switch(%1) + スイッチ(%1) - - Warn - 警告 + + Delay(u%1:d%2) + 遅延(u%1:d%2) - + + Slow(u%1:d%2) + 速度低下(u%1:d%2) + + + + Warn(%1) + 警告(%1) + + + Disabled in all flight modes すべてのフライトモードを無効 - + Flight modes フライトモード - + Flight mode フライトモード - + All すべて - + Edge Edge:端 - + instant 簡易 - + Sticky Sticky:追尾 - + Timer タイマー - + missing 間違い - + Duration 期間 - - - + + Custom カスタム - + Standard 標準 - + Extended Limits 拡張制限 - + Display Checklist ディスプレイ チェックリスト - + Global Functions グローバルファンクション - + Manual 手動 - + Auto 自動 - + Failsafe Mode フェイルセーフモード - - + + Hold ホールド - + No Pulse パルスなし - + Not set セットなし - + No pulses パルスなし - + Silent 消音 - + Beeps ビープ - + Voice 音声 - + Haptic タッチパネル - + Flight フライト - + Manual reset 手動リセット - + Step ステップ - + Display ディスプレイ - + Extended 拡張 - + Never なし - + On Change 変更 - + Always 常に - - - + + + Source 選択元 - + Trim idle only トリムアイドルのみ - + Warning 警告 - + Reversed リバース - + Tmr Tmr - + FrSky S.PORT - + FrSky D - + FrSky D (cable) - + Alti - + Alti+ - + VSpeed - - - + + + A1 - - - + + + A2 - - + + A3 - - + + A4 - - + + FAS - + Cells セル - - Calculated - 計算値 - - - - Add - 追加 - - - - Average - 平均 - - - - + Min 最小 - - + Max 最大 - - Multiply - 乗算 - - - - Totalise - 合計 - - - - Cell - セル - - - - Consumption - 消費 - - - - Distance - 距離 - - - - Lowest - より低く - - - - Cell %1 - セル %1 - - - - Highest - より高く - - - - Delta - 差分 - - - - Formula - 定式 - - - - - Id - - - - - Instance - インスタンス - - - - - - - Sensor - センサー - - - - - Sources - 選択元 - - - - - GPS - GPS - - - - Alt. - Alt. - - - - - Blades - ブレード - - - - Multi. - マルチ. - - - - F - - - - - Inst - - - - - Alt - - - - - Unit - - - - - Prec - 精度 - - - - Ratio - レシオ - - - - Multi - マルチ - - - - A/Offset - A/オフセット - - - - Filter - フィルタ - - - - Persist - 持続 - - - - Positive - ノーマル - - - - Log - ログ - - - + Numbers ナンバー - + Bars バー - + Script スクリプト - + Filename ファイル名 - + Error: Unable to open or read file! エラー: ファイルを開けないか、読み取れません! @@ -9019,7 +8850,7 @@ If blank then the mix is considered to be "ON" all the time. Low Power - 低パワー + 低出力 @@ -9320,12 +9151,12 @@ If blank then the mix is considered to be "ON" all the time. 2 W - + Positive ノーマル - + Negative リバース @@ -9333,42 +9164,42 @@ If blank then the mix is considered to be "ON" all the time. ModulePanel - + Value 値 - + Hold ホールド - + No Pulse パルスなし - + Ask 確認 - + Internal 内部 - + Internal + External 内部 + 外部 - + External 外部 - + Bind on channel チャンネルへバインド @@ -9844,22 +9675,22 @@ If blank then the mix is considered to be "ON" all the time. OpenTxEepromInterface - + Unknown error 不明のエラー - + ... plus %1 errors ...追加 %1 エラー - + Cannot write radio settings 送信機設定を書き込めません - + Cannot write model %1 機体モデル %1 を書き込めません @@ -10007,12 +9838,12 @@ If blank then the mix is considered to be "ON" all the time. QObject - + WARNING 警告 - + <p>Importing JumperTX data into OpenTX 2.3 is <b>not supported and dangerous.</b></p> <p>It is unfortunately not possible for us to differentiate JumperTX data from legitimate FrSky X10 data, but <b>You should only continue here if the file you opened comes from a real FrSky X10.</b></p> <p>Do you really want to continue?</p> <p>JumperTXデータをOpenTX 2.3にインポートすることは<b>サポート対象外となり危険な行為です。</b></p> <p>残念ながら、JumperTXデータを正当なFrSky X10データと区別することができませんが、<b>開いたファイルが実際のFrSky X10で生成されたものである場合にのみ、続行する事ができます。</b></p> <p>本当に続行しますか?</p> @@ -10367,17 +10198,6 @@ X REb エンコーダ再生b - - - - ??? - - - - - ---- - - I @@ -10406,7 +10226,7 @@ X - + SRC @@ -10414,22 +10234,22 @@ X RawSwitch - + ↑ - + ↓ - + - - + ! @@ -10654,146 +10474,327 @@ X SensorData - - + + Formula + 定式 + + + + Id + ID + + + + Instance + インスタンス + + + + + Sensor + センサー + + + + Sources + 選択元 + + + + GPS + GPS + + + + Alt + 高度 + + + + Unit + ユニット + + + + Precision + 精度 + + + + Ratio + レシオ + + + + Offset + オフセット + + + + Auto Offset + 自動オフセット + + + + Blades + ブレード + + + + Multiplier + 乗算 + + + + Filter + フィルター + + + + Persist + 持続 + + + + Positive + ノーマル + + + + Log + ログ + + + + Custom + カスタム + + + + Calculated + 計算値 + + + + Add + 追加 + + + + Average + 平均 + + + + Minimum + 最低値 + + + + Maximum + 最大値 + + + + Multiply + 乗算 + + + + Totalize + 合計 + + + + Cell + セル + + + + Consumption + 消費 + + + + Distance + 距離 + + + + Lowest + より低く + + + + Cell %1 + セル %1 + + + + Highest + より高く + + + + Delta + 差分 + + + + Raw (-) + Raw (-) + + + + V V - + A - + mA - + kts - + m/s - + km/h - + mph - + m - + f - + °C - + °F - + % - + mAh - + W - + mW - + dB - + rpms - + g - + ° - + Rad - + hours - + minutes - + seconds - + ml/minute - + Hertz - + mS - + uS - + TELE + + + Y + Y + + + + N + N + Setup @@ -10975,92 +10976,92 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi SetupPanel - + Popup menu available 利用可能なポップアップメニュー - + Timer %1 タイマー %1 - + THR - + Profile Settings プロファイル設定 - + SD structure path not specified or invalid SDカード保存先パスが指定されていないか無効です - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Clear Timer. Are you sure? タイマーを消去します。よろしいですか? - + Clear all Timers. Are you sure? タイマーをすべて消去します。よろしいですか? - + Cut Timer. Are you sure? タイマーを切り取ります。よろしいですか? - + Delete Timer. Are you sure? タイマーを削除します。よろしいですか? @@ -11786,62 +11787,62 @@ The default is configured in the chosen Radio Profile. 送信機シミュレータ (%1) - + Could not determine startup data source. 起動データ元を特定できませんでした。 - + Could not load data, possibly wrong format. データをロードできません、フォーマットが間違っている可能性があります。 - + Data Load Error データロード エラー - + Invalid startup data provided. Plese specify a proper file/path. 無効なスタートアップデータが提供されました。正しいファイル/パスを指定してください。 - + Simulator Startup Error シミュレータ スタートアップ エラー - + Error saving data: could open file for writing: '%1' データ保存エラー: 書き込み用にファイルを開くことができました: 「%1」 - + Error saving data: could not get data from simulator interface. データ保存エラー: シミュレータのインターフェイスからデータを取得できませんでした。 - + An unexpected error occurred while attempting to save radio data to file '%1'. 送信機データをファイル「%1」に保存しようとしたときに予期せぬエラーが発生しました。 - + Data Save Error データ保存 エラー - + Cannot open joystick, joystick disabled スティックが接続不可、もしくはスティックが無効です - + Radio firmware error: %1 送信機 ファームウェア エラー: %1 - + - Flight Mode %1 (#%2) - フライトモード %1 (#%2) @@ -12514,22 +12515,22 @@ Too many errors, giving up. 最大 - + None なし - + Numbers ナンバー - + Bars バー - + Script スクリプト @@ -12537,109 +12538,52 @@ Too many errors, giving up. TelemetryPanel - + Telemetry screen %1 テレメトリースクリーン %1 - + FrSky S.PORT - + FrSky D - + FrSky D (cable) - + Source 信号元 - + Low Alarm 低アラーム - + Critical Alarm クリティカルアラーム - + Winged Shadow How High Winged Shadow How High - + Winged Shadow How High (not supported) Winged Shadow How High (サポートなし) - - Alti - - - - - Alti+ - - - - - VSpeed - - - - - - - A1 - - - - - - - A2 - - - - - - A3 - - - - - - A4 - - - - - - FAS - - - - - Cells - セル - - - - --- - --- - - - + Delete Sensor. Are you sure? テレメトリーセンサーを削除します。よろしいですか? @@ -12657,279 +12601,99 @@ Too many errors, giving up. TELE## - - Custom - カスタム - - - - Calculated - 計算値 - - - + Id ID - + Instance インスタンス - + Rx 受信 - - Add - 追加 - - - - Average - 平均 - - - - Min - 最小 - - - - Max - 最大 - - - - Multiply - 乗算 - - - - Totalize - 合計 - - - - Cell - セル - - - - Consumption - 消費 - - - - Dist - 距離 - - - + Cells Sensor : セル センサー : - - - - - - - - + + + + + + + + --- --- - + GPS Sensor : GPS センサー : - + Alt. Sensor : 高度 センサー : - + Sensor : センサー : - - Raw (-) - Raw (-) - - - - V - V - - - - A - - - - - mA - - - - - kt - - - - - m/s - - - - - ft/s - - - - - km/h - - - - - mph - - - - - m - 分 - - - - ft - - - - - °C - - - - - °F - - - - - % - - - - - mAh - - - - - W - - - - - mW - - - - - dBm - - - - - RPM - - - - - g - - - - - ° - - - - - Rad - - - - - mL - - - - - US fl.Oz. - - - - - ml/min - - - - + Precision 精度 - + Ratio レシオ - + Blades ブレード - + Offset オフセット - + Multiplier 乗算 - + Auto Offset 自動オフセット - + Filter - フィルタ + フィルター - + Persistent 持続 - + Positive ノーマル - + Logs ログ @@ -12937,92 +12701,72 @@ Too many errors, giving up. TelemetrySensorPanel - + TELE%1 - + Popup menu available 利用可能なポップアップメニュー - - Lowest - より低く - - - - Cell %1 - セル %1 - - - - Highest - より高く - - - - Delta - 差分 - - - + Copy コピー - + Cut 切り取り - + Paste 貼り付け - + Clear 消去 - + Insert 挿入 - + Delete 削除 - + Move Up 上へ移動 - + Move Down 下へ移動 - + Clear All すべて消去 - + Cut Telemetry Sensor. Are you sure? テレメトリーセンサーを切り取ります。よろしいですか? - + Clear Telemetry Sensor. Are you sure? テレメトリーセンサーを消去します。よろしいですか? - + Clear all Telemetry Sensors. Are you sure? テレメトリーセンサーのすべてを消去します。よろしいですか? @@ -13391,12 +13135,12 @@ hh:mm:ss Timer - + Countdown カウントダウン - + Minute Call 音声時報 @@ -13857,7 +13601,7 @@ CTRL+スクロールまたはPAGE UP/DOWNキーを押すと、大きなステ Has your helicopter got an adjustable gyro for the tail? - このヘリコプターはテールのアジャストジャイロを実装しましたか? + このヘリコプターはテールのジャイロ調整を実装しましたか? From 92b25e71fc1a63c81e5bacf1377a1726fc070a8b Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 13 Feb 2021 22:30:45 +0100 Subject: [PATCH 052/188] Update CREDITS.txt --- CREDITS.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 19cc3b980..07df1ae15 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2137,3 +2137,6 @@ Hans-Reinhard Mette Alejandro Casals Oliver David Homewood John Dunning +Konrad Helbach +Bernard Delpy +Raymond Ellsworth From e94f6c0ccdc1ecd800f2ef27a28120878bc9ec41 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 14 Feb 2021 10:40:34 +0100 Subject: [PATCH 053/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 07df1ae15..669935391 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2140,3 +2140,4 @@ John Dunning Konrad Helbach Bernard Delpy Raymond Ellsworth +Bogdan Musial From 7eaede341aaf051ee66e71b2f0d7b5f3a91e4171 Mon Sep 17 00:00:00 2001 From: Risto Date: Sun, 14 Feb 2021 14:33:49 +0100 Subject: [PATCH 054/188] RTOS_MS_PER_TICK calculation simplification CFG_CPU_FREQ cancels itself out in the original equation: ((CFG_CPU_FREQ / CFG_SYSTICK_FREQ) / (CFG_CPU_FREQ / 1000)) In addition, comment is now fixed - 1ms is used for STM32, 2ms was used for other chips: https://github.com/opentx/opentx/blob/e94f6c0ccdc1ecd800f2ef27a28120878bc9ec41/radio/src/thirdparty/CoOS/OsConfig.h#L88-L92 --- radio/src/rtos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/rtos.h b/radio/src/rtos.h index 6e42ebf30..98d0c0415 100644 --- a/radio/src/rtos.h +++ b/radio/src/rtos.h @@ -155,7 +155,7 @@ template } #endif - #define RTOS_MS_PER_TICK ((CFG_CPU_FREQ / CFG_SYSTICK_FREQ) / (CFG_CPU_FREQ / 1000)) // RTOS timer tick length in ms (currently 2) + #define RTOS_MS_PER_TICK (1000 / CFG_SYSTICK_FREQ) // RTOS timer tick length in ms (currently 1 for STM32, 2 for others) typedef OS_TID RTOS_TASK_HANDLE; typedef OS_MutexID RTOS_MUTEX_HANDLE; From 2d1276f08119f97f238d9b29e92f104fb221e570 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 15 Feb 2021 09:15:58 +0100 Subject: [PATCH 055/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 669935391..d83f82e79 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2141,3 +2141,5 @@ Konrad Helbach Bernard Delpy Raymond Ellsworth Bogdan Musial +Гасак Сергей +Philip Garcia From 24fdbcbbab0246213abd4c41e99f783d08cffee5 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 15 Feb 2021 13:10:29 +0100 Subject: [PATCH 056/188] Send 0 with getRSSI when no telem --- radio/src/lua/api_general.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index b205b1c70..60ebe39fe 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -1411,7 +1411,10 @@ Get RSSI value as well as low and critical RSSI alarm levels (in dB) */ static int luaGetRSSI(lua_State * L) { - lua_pushunsigned(L, min((uint8_t)99, TELEMETRY_RSSI())); + if (TELEMETRY_STREAMING()) + lua_pushunsigned(L, min((uint8_t)99, TELEMETRY_RSSI())); + else + lua_pushunsigned(L, 0); lua_pushunsigned(L, g_model.rssiAlarms.getWarningRssi()); lua_pushunsigned(L, g_model.rssiAlarms.getCriticalRssi()); return 3; From d4aec69b3f1d7073a17e5d421781e6a7b4bd1ea7 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 15 Feb 2021 13:22:43 +0100 Subject: [PATCH 057/188] Allow a wider range for battery settings in companion to care for 1S --- companion/src/generaledit/generalsetup.ui | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/companion/src/generaledit/generalsetup.ui b/companion/src/generaledit/generalsetup.ui index 7353b9c4b..422eddc7d 100644 --- a/companion/src/generaledit/generalsetup.ui +++ b/companion/src/generaledit/generalsetup.ui @@ -1527,7 +1527,7 @@ Mode 4: Battery warning voltage. This is the threashhold where the battery warning sounds. -Acceptable values are 5v..10v +Acceptable values are 3v..12v @@ -1539,7 +1539,7 @@ Acceptable values are 5v..10v 1 - 4.000000000000000 + 3.000000000000000 12.000000000000000 @@ -1679,7 +1679,7 @@ Acceptable values are 5v..10v 1 - 4.000000000000000 + 3.000000000000000 16.000000000000000 @@ -1708,7 +1708,7 @@ Acceptable values are 5v..10v 1 - 4.000000000000000 + 3.000000000000000 16.000000000000000 From 96eb5d2bb0aa190f64da943ddc7c2a3e2ae5a5d2 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 15 Feb 2021 14:01:26 +0100 Subject: [PATCH 058/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index d83f82e79..38c1f732d 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2143,3 +2143,4 @@ Raymond Ellsworth Bogdan Musial Гасак Сергей Philip Garcia +Helder Simoes From af8dff9da296e0c87cdd1ac8d215c1f9fc512752 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 15 Feb 2021 14:37:07 +0100 Subject: [PATCH 059/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 38c1f732d..8553a80fc 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2144,3 +2144,4 @@ Bogdan Musial Гасак Сергей Philip Garcia Helder Simoes +Thomas Blanchin From 9e254e7dd621ba69dbb2cff63923c7aeb3396eb5 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 16 Feb 2021 10:43:15 +0100 Subject: [PATCH 060/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8553a80fc..ffa4dca00 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2145,3 +2145,4 @@ Bogdan Musial Philip Garcia Helder Simoes Thomas Blanchin +Jean-Luc Mesnier From eaa972cd2fbe2db5b975661227ba92022a752449 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 17 Feb 2021 11:48:08 +0100 Subject: [PATCH 061/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index ffa4dca00..ff67af694 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2146,3 +2146,4 @@ Philip Garcia Helder Simoes Thomas Blanchin Jean-Luc Mesnier +Michael Bajer From 621fa17b85b920a4af46e3f57200962fa05106df Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 18 Feb 2021 11:04:05 +0100 Subject: [PATCH 062/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index ff67af694..38080254c 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2147,3 +2147,4 @@ Helder Simoes Thomas Blanchin Jean-Luc Mesnier Michael Bajer +David Homewood From 85780d43026220c9d0676432f1c64b6f84c63ed9 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 18 Feb 2021 11:15:39 +0100 Subject: [PATCH 063/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 38080254c..38b255ccf 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2148,3 +2148,4 @@ Thomas Blanchin Jean-Luc Mesnier Michael Bajer David Homewood +Marc Sanders From ecfa393a9b8f673b8aa378c401a72d5f040f5fab Mon Sep 17 00:00:00 2001 From: Risto Date: Wed, 17 Feb 2021 17:29:42 +0100 Subject: [PATCH 064/188] Uniform CLI stackinfo output in bytes. Main task size currently in double words, the CoOS RTOS task stack sizes in bytes. Available stack size output was in double words, now everything uniform in bytes also added "bytes" label to CLI output to make this clear. --- radio/src/cli.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index cb72b8076..8d64e7972 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -699,11 +699,11 @@ int cliTrace(const char ** argv) int cliStackInfo(const char ** argv) { - serialPrint("[MAIN] %d available / %d", stackAvailable(), stackSize()); - serialPrint("[MENUS] %d available / %d", menusStack.available(), menusStack.size()); - serialPrint("[MIXER] %d available / %d", mixerStack.available(), mixerStack.size()); - serialPrint("[AUDIO] %d available / %d", audioStack.available(), audioStack.size()); - serialPrint("[CLI] %d available / %d", cliStack.available(), cliStack.size()); + serialPrint("[MAIN] %d available / %d bytes", stackAvailable()*4, stackSize()*4); + serialPrint("[MENUS] %d available / %d bytes", menusStack.available()*4, menusStack.size()); + serialPrint("[MIXER] %d available / %d bytes", mixerStack.available()*4, mixerStack.size()); + serialPrint("[AUDIO] %d available / %d bytes", audioStack.available()*4, audioStack.size()); + serialPrint("[CLI] %d available / %d bytes", cliStack.available()*4, cliStack.size()); return 0; } From cae6d56b74818ede0529d3ffec42136f289b117d Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 19 Feb 2021 08:49:25 +0100 Subject: [PATCH 065/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 38b255ccf..4b5871c38 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2149,3 +2149,4 @@ Jean-Luc Mesnier Michael Bajer David Homewood Marc Sanders +Буров Александр From 2a719199e3446c99c960b99fa7a744279125470d Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 19 Feb 2021 16:50:53 +0100 Subject: [PATCH 066/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 4b5871c38..e6623b971 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2150,3 +2150,4 @@ Michael Bajer David Homewood Marc Sanders Буров Александр +Rudy T'Jolleyn From d1a60cca8de80a8ecf5fc8a177f19d15cc37e816 Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 19 Feb 2021 16:53:01 +0100 Subject: [PATCH 067/188] Multi : support SX1276 power indication and protect against unknown options coming from multi --- radio/src/gui/128x64/model_setup.cpp | 4 +++- radio/src/gui/212x64/model_setup.cpp | 3 +++ radio/src/gui/480x272/model_setup.cpp | 3 +++ radio/src/gui/gui_common.cpp | 5 +++++ radio/src/pulses/modules_helpers.h | 2 ++ radio/src/translations/untranslated.h | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 136ab6801..28ca2c0b9 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1544,7 +1544,9 @@ void menuModelSetup(event_t event) const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); if (status.isValid()) { - MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); + if (status.optionDisp >= getMaxMultiOptions()) { + status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) + } lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); if (attr && status.optionDisp == 2) { lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT); diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 5a2d05446..390d55700 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -1299,6 +1299,9 @@ void menuModelSetup(event_t event) MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); const uint8_t multi_proto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(); if (status.isValid()) { + if (status.optionDisp >= getMaxMultiOptions()) { + status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) + } lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); if (attr && status.optionDisp == 2) { lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT); diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index cd9974ac5..724f12db4 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -1681,6 +1681,9 @@ bool menuModelSetup(event_t event) MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); if (status.isValid()) { + if (status.optionDisp >= getMaxMultiOptions()) { + status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) + } lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); if (attr && status.optionDisp == 2) { lcdDrawNumber(LCD_W - 10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")"); diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 368aac163..0cc14467a 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -997,6 +997,11 @@ const char* mm_options_strings::options[] = { STR_MULTI_RFPOWER }; +const uint8_t getMaxMultiOptions() +{ + return DIM(mm_options_strings::options); +} + const mm_protocol_definition multi_protocols[] = { // Protocol as defined in pulses\modules_constants.h, number of sub_protocols - 1, Failsafe supported, Disable channel mapping supported, Subtype string, Option type {MODULE_SUBTYPE_MULTI_FLYSKY, 4, false, true, STR_SUBTYPE_FLYSKY, nullptr}, diff --git a/radio/src/pulses/modules_helpers.h b/radio/src/pulses/modules_helpers.h index 0272a3825..b01db972d 100644 --- a/radio/src/pulses/modules_helpers.h +++ b/radio/src/pulses/modules_helpers.h @@ -42,6 +42,8 @@ struct mm_options_strings { static const char* options[]; }; +const uint8_t getMaxMultiOptions(); + struct mm_protocol_definition { uint8_t protocol; uint8_t maxSubtype; diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index 74735bc7f..2b1c05407 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -134,7 +134,7 @@ #define TR_MULTI_PROTOCOLS "FlySky\0""Hubsan\0""FrSky\0 ""Hisky\0 ""V2x2\0 ""DSM\0 ""Devo\0 ""YD717\0 ""KN\0 ""SymaX\0 ""SLT\0 ""CX10\0 ""CG023\0 ""Bayang\0""ESky\0 ""MT99XX\0""MJXq\0 ""Shenqi\0""FY326\0 ""Futaba\0""J6 Pro\0""FQ777\0 ""Assan\0 ""Hontai\0""OpenLrs""FlSky2A""Q2x2\0 ""Walkera""Q303\0 ""GW008\0 ""DM002\0 ""Cabell\0""Esky150""H8 3D\0 ""Corona\0""CFlie\0 ""Hitec\0 ""WFly\0 ""Bugs\0 ""BugMini""Traxxas""NCC1701""E01X\0 ""V911S\0 ""GD00X\0 ""V761\0 ""KF606\0 ""Redpine""Potensi""ZSX\0 ""Height\0""Scanner""FrSkyRX""FS2A_RX""HoTT\0 ""FX816\0 ""BayanRX""Pelikan""Tiger\0 ""XK\0 ""XN297DU""FrSkyX2""FrSkyR9""Propel\0""FrSkyL\0""Skyartc""ESky-v2""DSM RX\0""JJRC345""Q90C\0 ""Kyosho\0""RadLink""ExpLRS\0""Realacc""OMP\0 ""M-Link\0""Wfly 2\0""E016Hv2" #define LEN_MULTI_POWER "\005" -#define TR_MULTI_POWER "10mW\0""25mW\0""50mW\0""100mW""200mW""300mW""500mW""1W\0 ""2W\0 " +#define TR_MULTI_POWER "1.6mW""2.0mW""2.5mW""3.2mW""4.0mW""5.0mW""6.3mW""7.9mW""10mW\0""13mW\0""16mW\0""20mW\0""25mW\0""32mW\0""40mW\0""50mW\0" #define LEN_AFHDS3_PROTOCOLS "\x008" #define TR_AFHDS3_PROTOCOLS "PWM/IBUS""PWM/SBUS""PPM/IBUS""PPM/SBUS" From 8e13639f5de489e7ab86fb37f14c3aa31a0127f2 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sat, 20 Feb 2021 07:39:24 +1100 Subject: [PATCH 068/188] Mirror rssi alarms in companion --- companion/src/modeledit/telemetry.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 8cda220a9..ec4491734 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -813,7 +813,9 @@ void TelemetryPanel::setup() ui->ignoreSensorIds->setField(model->frsky.ignoreSensorIds, this); ui->disableTelemetryAlarms->setField(model->rssiAlarms.disabled); + ui->rssiAlarmWarningSB->setRange(45 - 30, 45 + 30); ui->rssiAlarmWarningSB->setValue(model->rssiAlarms.warning); + ui->rssiAlarmCriticalSB->setRange(42 - 30, 42 + 30); ui->rssiAlarmCriticalSB->setValue(model->rssiAlarms.critical); ui->rssiSourceLabel->show(); From 10dadf1f785b5863255ad0f3128d5cbb334bf3d7 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 21 Feb 2021 12:25:47 +0100 Subject: [PATCH 069/188] Multi : improve options support part 1 --- radio/src/gui/128x64/model_setup.cpp | 46 ++++++++++----------------- radio/src/gui/212x64/model_setup.cpp | 46 ++++++++++----------------- radio/src/gui/480x272/model_setup.cpp | 40 +++++++++-------------- radio/src/gui/gui_common.cpp | 19 +++++++++++ radio/src/gui/gui_common.h | 1 + radio/src/translations.cpp | 1 + radio/src/translations.h | 1 + radio/src/translations/untranslated.h | 3 ++ 8 files changed, 73 insertions(+), 84 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 28ca2c0b9..ca60a17af 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1538,43 +1538,29 @@ void menuModelSetup(event_t event) { #if defined(MULTIMODULE) if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) { + const char * title = getMultiOptionTitle(moduleIdx); + + lcdDrawText(INDENT_WIDTH, y, title); + if (title == STR_MULTI_RFTUNE) { + lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT); + lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); + lcdDrawText(lcdLastRightPos, y, ")", LEFT); + } + int optionValue = g_model.moduleData[moduleIdx].multi.optionValue; - - MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); - - if (status.isValid()) { - if (status.optionDisp >= getMaxMultiOptions()) { - status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) - } - lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); - if (attr && status.optionDisp == 2) { - lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT); - lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); - lcdDrawText(lcdLastRightPos, y, ")", LEFT); - } - } - else { - const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_proto); - if (pdef->optionsstr) { - lcdDrawText(INDENT_WIDTH, y, pdef->optionsstr); - if (attr && pdef->optionsstr == STR_MULTI_RFTUNE) { - lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT); - lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); - lcdDrawText(lcdLastRightPos, y, ")", LEFT); - } - } - } - int8_t min, max; getMultiOptionValues(multi_proto, min, max); - if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { - lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); - } - else if (multi_proto == MODULE_SUBTYPE_MULTI_FRSKY_R9) { + if (title == STR_MULTI_RFPOWER) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_POWER, optionValue, LEFT | attr); } + else if (title == STR_MULTI_TELEMETRY) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); + } + else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { + lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); + } else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) { optionValue = optionValue & 0x01; editCheckBox(optionValue, MODEL_SETUP_2ND_COLUMN, y, "", LEFT | attr, event); diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 390d55700..6c698f53e 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -1294,41 +1294,29 @@ void menuModelSetup(event_t event) #if defined(MULTIMODULE) if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) { + const char * title = getMultiOptionTitle(moduleIdx); + + lcdDrawText(INDENT_WIDTH, y, title); + if (title == STR_MULTI_RFTUNE) { + lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT); + lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); + lcdDrawText(lcdLastRightPos, y, ")", LEFT); + } + int optionValue = g_model.moduleData[moduleIdx].multi.optionValue; - - MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); - const uint8_t multi_proto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(); - if (status.isValid()) { - if (status.optionDisp >= getMaxMultiOptions()) { - status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) - } - lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); - if (attr && status.optionDisp == 2) { - lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT); - lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); - lcdDrawText(lcdLastRightPos, y, ")", LEFT); - } - } - else { - const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_proto); - if (pdef->optionsstr) - lcdDrawText(INDENT_WIDTH, y, pdef->optionsstr); - if (pdef->optionsstr == STR_MULTI_RFTUNE) { - lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT); - lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); - lcdDrawText(lcdLastRightPos, y, ")", LEFT); - } - } - + const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); int8_t min, max; getMultiOptionValues(multi_proto, min, max); - if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { - lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); - } - else if (multi_proto == MODULE_SUBTYPE_MULTI_FRSKY_R9) { + if (title == STR_MULTI_RFPOWER) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_POWER, optionValue, LEFT | attr); } + else if (title == STR_MULTI_TELEMETRY) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); + } + else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { + lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); + } else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) { optionValue = optionValue & 0x01; editCheckBox(optionValue, MODEL_SETUP_2ND_COLUMN, y, "", LEFT | attr, event); diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 724f12db4..55566524b 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -1676,38 +1676,27 @@ bool menuModelSetup(event_t event) { #if defined(MULTIMODULE) if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) { + const char * title = getMultiOptionTitle(moduleIdx); + + lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, title); + if (title == STR_MULTI_RFTUNE) { + lcdDrawNumber(LCD_W - 10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")"); + } + int optionValue = g_model.moduleData[moduleIdx].multi.optionValue; - - MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); - if (status.isValid()) { - if (status.optionDisp >= getMaxMultiOptions()) { - status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) - } - lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]); - if (attr && status.optionDisp == 2) { - lcdDrawNumber(LCD_W - 10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")"); - } - } - else { - const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_proto); - if (pdef->optionsstr) { - lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, pdef->optionsstr); - if (attr && pdef->optionsstr == STR_MULTI_RFTUNE) { - lcdDrawNumber(LCD_W - 10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")"); - } - } - } - int8_t min, max; getMultiOptionValues(multi_proto, min, max); - if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { - lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); - } - else if (multi_proto == MODULE_SUBTYPE_MULTI_FRSKY_R9) { + if (title == STR_MULTI_RFPOWER) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_POWER, optionValue, LEFT | attr); } + else if (title == STR_MULTI_TELEMETRY) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); + } + else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { + lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); + } else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) { optionValue = optionValue & 0x01; editCheckBox(optionValue, MODEL_SETUP_2ND_COLUMN, y, LEFT | attr, event); @@ -1718,6 +1707,7 @@ bool menuModelSetup(event_t event) else lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, optionValue, LEFT | attr); } + if (attr) { CHECK_INCDEC_MODELVAR(event, optionValue, min, max); if (checkIncDec_Ret) { diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 0cc14467a..b493247d5 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -1096,3 +1096,22 @@ void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, Lcd else lcdDrawMMM(x, y, flags); } + +#if defined(MULTIMODULE) +const char* getMultiOptionTitle(uint8_t moduleIdx) +{ + MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); + + if (status.isValid()) { + if (status.optionDisp >= getMaxMultiOptions()) { + status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option) + } + return mm_options_strings::options[status.optionDisp]; + } + else { + const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); + const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_proto); + return pdef->optionsstr; + } +} +#endif diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index 8f30a624e..784509378 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -318,6 +318,7 @@ inline uint8_t MODULE_OPTION_ROW(uint8_t moduleIdx) { } void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags); +const char* getMultiOptionTitle(uint8_t moduleIdx); const char * writeScreenshot(); diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 455d6490d..94b53d85f 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -98,6 +98,7 @@ ISTR(INPUTNAMES); #if defined(MULTIMODULE) ISTR(MULTI_PROTOCOLS); ISTR(MULTI_POWER); +ISTR(MULTI_TELEMETRY_MODE); #endif #if defined(BLUETOOTH) diff --git a/radio/src/translations.h b/radio/src/translations.h index a9131d8a5..3e9ce3216 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -161,6 +161,7 @@ extern const char STR_R9M_PXX2_RF_PROTOCOLS[]; extern const char STR_DSM_PROTOCOLS[]; extern const char STR_MULTI_PROTOCOLS[]; extern const char STR_MULTI_POWER[]; +extern const char STR_MULTI_TELEMETRY_MODE[]; extern const char STR_SPORT_MODES[]; #if defined(AFHDS3) diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index 2b1c05407..da0a481c8 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -136,6 +136,9 @@ #define LEN_MULTI_POWER "\005" #define TR_MULTI_POWER "1.6mW""2.0mW""2.5mW""3.2mW""4.0mW""5.0mW""6.3mW""7.9mW""10mW\0""13mW\0""16mW\0""20mW\0""25mW\0""32mW\0""40mW\0""50mW\0" +#define LEN_MULTI_TELEMETRY_MODE "\007" +#define TR_MULTI_TELEMETRY_MODE "Off\0 ""On\0 ""Off+Aux""On+Aux\0" + #define LEN_AFHDS3_PROTOCOLS "\x008" #define TR_AFHDS3_PROTOCOLS "PWM/IBUS""PWM/SBUS""PPM/IBUS""PPM/SBUS" From 08a5015ea0c11f015ba3e9c626fead42e738c7ad Mon Sep 17 00:00:00 2001 From: elecpower Date: Mon, 22 Feb 2021 08:07:38 +1100 Subject: [PATCH 070/188] Stop extended limits affecting output fields referencing gvars --- companion/src/modeledit/channels.cpp | 6 +++--- companion/src/modeledit/channels.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index 27374a8c4..f0353ee45 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -57,7 +57,7 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row spinbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); QHBoxLayout *horizontalLayout = new QHBoxLayout(); - QCheckBox *gv = new QCheckBox(tr("GV")); + gv = new QCheckBox(tr("GV")); gv->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); horizontalLayout->addWidget(gv); QComboBox *cb = new QComboBox(); @@ -84,14 +84,14 @@ void LimitsGroup::updateMinMax(int max) if (spinbox->maximum() == 0) { spinbox->setMinimum(-max * displayStep); gvarGroup->setMinimum(-max); - if (value < -max) { + if (!gv->isChecked() && value < -max) { value = -max; } } if (spinbox->minimum() == 0) { spinbox->setMaximum(max * displayStep); gvarGroup->setMaximum(max); - if (value > max) { + if (!gv->isChecked() && value > max) { value = max; } } diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index 2a65f497a..70da877e7 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -50,6 +50,7 @@ class LimitsGroup GVarGroup *gvarGroup; int &value; double displayStep; + QCheckBox *gv; }; class ChannelsPanel : public ModelPanel From b978f6042335a02e30fba98b2920461d99e25c5f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 22 Feb 2021 09:00:13 +0100 Subject: [PATCH 071/188] Fix Companion len script filename --- companion/src/modeledit/telemetry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 8cda220a9..336403bcf 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -111,7 +111,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, lock = false; if (IS_TARANIS(firmware->getBoard())) { - QSet scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/TELEMETRY", QStringList() << "*.lua", 8); + QSet scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/TELEMETRY", QStringList() << "*.lua", 6); Helpers::populateFileComboBox(ui->scriptName, scriptsSet, screen.body.script.filename); connect(ui->scriptName, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptNameEdited())); connect(ui->scriptName, SIGNAL(editTextChanged ( const QString)), this, SLOT(scriptNameEdited())); From 5c5683894e8a591c52eefca2db42089f26d0dbb1 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 22 Feb 2021 11:45:28 +0100 Subject: [PATCH 072/188] Multi : improve options support part 2 --- radio/src/gui/128x64/model_setup.cpp | 7 +++++++ radio/src/gui/212x64/model_setup.cpp | 5 +++++ radio/src/gui/480x272/model_setup.cpp | 7 +++++++ radio/src/gui/gui_common.cpp | 3 ++- radio/src/pulses/modules_helpers.h | 4 ---- radio/src/translations.cpp | 2 ++ radio/src/translations.h | 2 ++ radio/src/translations/cz.h.txt | 1 + radio/src/translations/de.h.txt | 1 + radio/src/translations/en.h.txt | 1 + radio/src/translations/es.h.txt | 1 + radio/src/translations/fi.h.txt | 1 + radio/src/translations/fr.h.txt | 1 + radio/src/translations/it.h.txt | 1 + radio/src/translations/nl.h.txt | 1 + radio/src/translations/pl.h.txt | 1 + radio/src/translations/pt.h.txt | 1 + radio/src/translations/se.h.txt | 1 + radio/src/translations/untranslated.h | 3 +++ 19 files changed, 39 insertions(+), 5 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index ca60a17af..77ce40c42 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1554,6 +1554,8 @@ void menuModelSetup(event_t event) if (title == STR_MULTI_RFPOWER) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_POWER, optionValue, LEFT | attr); + min = 0; + max = 15; } else if (title == STR_MULTI_TELEMETRY) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); @@ -1561,6 +1563,11 @@ void menuModelSetup(event_t event) else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); } + else if (title == STR_MULTI_WBUS) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_WBUS_MODE, optionValue, LEFT | attr); + min = 0; + max = 1; + } else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) { optionValue = optionValue & 0x01; editCheckBox(optionValue, MODEL_SETUP_2ND_COLUMN, y, "", LEFT | attr, event); diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 6c698f53e..47796ac79 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -1314,6 +1314,11 @@ void menuModelSetup(event_t event) else if (title == STR_MULTI_TELEMETRY) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); } + else if (title == STR_MULTI_WBUS) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_WBUS_MODE, optionValue, LEFT | attr); + min = 0; + max = 1; + } else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); } diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 55566524b..895b406da 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -1690,10 +1690,17 @@ bool menuModelSetup(event_t event) if (title == STR_MULTI_RFPOWER) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_POWER, optionValue, LEFT | attr); + min = 0; + max = 15; } else if (title == STR_MULTI_TELEMETRY) { lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_TELEMETRY_MODE, optionValue, LEFT | attr); } + else if (title == STR_MULTI_WBUS) { + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_WBUS_MODE, optionValue, LEFT | attr); + min = 0; + max = 1; + } else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) { lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, 50 + 5 * optionValue, LEFT | attr); } diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index b493247d5..98048c906 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -994,7 +994,8 @@ const char* mm_options_strings::options[] = { STR_MULTI_SERVOFREQ, STR_MULTI_MAX_THROW, STR_MULTI_RFCHAN, - STR_MULTI_RFPOWER + STR_MULTI_RFPOWER, + STR_MULTI_WBUS }; const uint8_t getMaxMultiOptions() diff --git a/radio/src/pulses/modules_helpers.h b/radio/src/pulses/modules_helpers.h index b01db972d..b2bd77de4 100644 --- a/radio/src/pulses/modules_helpers.h +++ b/radio/src/pulses/modules_helpers.h @@ -673,10 +673,6 @@ inline void getMultiOptionValues(int8_t multi_proto, int8_t & min, int8_t & max) min = -1; max = 84; break; - case MODULE_SUBTYPE_MULTI_FRSKY_R9: - min = 0; // 10mW - max = 5; // 300mW - break; default: min = -128; max = 127; diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 94b53d85f..c54248064 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -99,6 +99,7 @@ ISTR(INPUTNAMES); ISTR(MULTI_PROTOCOLS); ISTR(MULTI_POWER); ISTR(MULTI_TELEMETRY_MODE); +ISTR(MULTI_WBUS_MODE); #endif #if defined(BLUETOOTH) @@ -708,6 +709,7 @@ const char STR_BIND_OK[] = TR_BIND_OK; const char STR_MULTI_CUSTOM[] = TR_MULTI_CUSTOM; const char STR_MULTI_RFTUNE[] = TR_MULTI_RFTUNE; const char STR_MULTI_RFPOWER[] = TR_MULTI_RFPOWER; +const char STR_MULTI_WBUS[] = TR_MULTI_WBUS; const char STR_MULTI_TELEMETRY[] = TR_MULTI_TELEMETRY; const char STR_MULTI_VIDFREQ[] = TR_MULTI_VIDFREQ; const char STR_MULTI_OPTION[] = TR_MULTI_OPTION; diff --git a/radio/src/translations.h b/radio/src/translations.h index 3e9ce3216..90112a9f3 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -162,6 +162,7 @@ extern const char STR_DSM_PROTOCOLS[]; extern const char STR_MULTI_PROTOCOLS[]; extern const char STR_MULTI_POWER[]; extern const char STR_MULTI_TELEMETRY_MODE[]; +extern const char STR_MULTI_WBUS_MODE[]; extern const char STR_SPORT_MODES[]; #if defined(AFHDS3) @@ -404,6 +405,7 @@ extern const char STR_MULTI_OPTION[]; extern const char STR_MULTI_VIDFREQ[]; extern const char STR_MULTI_RFTUNE[]; extern const char STR_MULTI_RFPOWER[]; +extern const char STR_MULTI_WBUS[]; extern const char STR_MULTI_TELEMETRY[]; extern const char STR_MULTI_AUTOBIND[]; extern const char STR_DISABLE_CH_MAP[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 59eae1a46..26c96a182 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -639,6 +639,7 @@ #define TR_RECEIVER "Přijímač" #define TR_MULTI_RFTUNE TR(INDENT "Ladění frek", INDENT "Jemné ladění frek. RF") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetrie" #define TR_MULTI_VIDFREQ TR(INDENT "Freq. videa", INDENT "Frekvence videa") #define TR_RFPOWER "Výkon RF" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index fb36f0021..1e8d7ce96 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -641,6 +641,7 @@ #define TR_RECEIVER "Empfänger" #define TR_MULTI_RFTUNE TR(INDENT "RF Freq.", INDENT "RF Freq. Feintuning") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR(INDENT "Vid. Freq.", INDENT "Video Frequenz") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index f66e99a33..3ec8c1e31 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -640,6 +640,7 @@ #define TR_RECEIVER "Receiver" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 0e5fa3dc7..31a0b8afc 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -642,6 +642,7 @@ #define TR_RECEIVER "Receptor" #define TR_MULTI_RFTUNE TR("Sint.freq.", "RF Freq. sint.fina") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetría" #define TR_MULTI_VIDFREQ TR("Freq.vídeo", "Frecuencia vídeo") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 0bd9c954f..1158806f0 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -658,6 +658,7 @@ #define TR_RECEIVER "Receiver" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index fb818f7e8..5e59ba68d 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -661,6 +661,7 @@ #define TR_RECEIVER "Récept." #define TR_MULTI_RFTUNE TR(INDENT "Ajust.fréq", INDENT "Ajustement fréq.") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Télémétrie" #define TR_MULTI_VIDFREQ TR(INDENT "Fréq. vidéo", INDENT "Fréquence vidéo") #define TR_RFPOWER TR("Puiss. RF", "Puissance RF") diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 9a0785a1e..2e08ac45d 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -660,6 +660,7 @@ #define TR_RECEIVER "Ricevente" #define TR_MULTI_RFTUNE TR("Tune RF", "Tune fine Freq. RF") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetria" #define TR_MULTI_VIDFREQ TR("Freq. video", "Frequenza video") #define TR_RFPOWER "Potenza RF" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index 13f567589..f9a2be448 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -646,6 +646,7 @@ #define TR_RECEIVER "Receiver" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index bf59714cf..200072288 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -659,6 +659,7 @@ #define TR_RECEIVER INDENT "Receiver" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 8c794822e..0d1d597ac 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -661,6 +661,7 @@ #define TR_SYNCMENU "Sync [MENU]" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 54c081eb3..c3d3267d3 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -659,6 +659,7 @@ #define TR_SYNCMENU "Synk [MENU]" #define TR_MULTI_RFTUNE TR("Freq tune", "RF Freq. fine tune") #define TR_MULTI_RFPOWER "RF power" +#define TR_MULTI_WBUS "Output" #define TR_MULTI_TELEMETRY "Telemetry" #define TR_MULTI_VIDFREQ TR("Vid. freq.", "Video frequency") #define TR_RFPOWER "RF Power" diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index da0a481c8..a758b1a31 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -136,6 +136,9 @@ #define LEN_MULTI_POWER "\005" #define TR_MULTI_POWER "1.6mW""2.0mW""2.5mW""3.2mW""4.0mW""5.0mW""6.3mW""7.9mW""10mW\0""13mW\0""16mW\0""20mW\0""25mW\0""32mW\0""40mW\0""50mW\0" +#define LEN_MULTI_WBUS_MODE "\004" +#define TR_MULTI_WBUS_MODE "WBUS""PPM\0" + #define LEN_MULTI_TELEMETRY_MODE "\007" #define TR_MULTI_TELEMETRY_MODE "Off\0 ""On\0 ""Off+Aux""On+Aux\0" From af7cf2321e8f8a906694e6620727c9ad2a6c62ce Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 22 Feb 2021 15:29:33 +0100 Subject: [PATCH 073/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index e6623b971..8492196a9 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2151,3 +2151,5 @@ David Homewood Marc Sanders Буров Александр Rudy T'Jolleyn +Jay Watkins +Blaz Vodopivec From 0851e1123371e3d1469739cf44739e20f6e73a0e Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 22 Feb 2021 15:30:53 +0100 Subject: [PATCH 074/188] Update CREDITS.txt --- CREDITS.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8492196a9..6d3f4f6bc 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2153,3 +2153,7 @@ Marc Sanders Rudy T'Jolleyn Jay Watkins Blaz Vodopivec +David De Salvo +Willem Verschoren +Dennis Kathrens +Alan Aucote From fb00e928ea2f3e8e10581db04b1f28deb202b063 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 23 Feb 2021 19:52:01 +0100 Subject: [PATCH 075/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 6d3f4f6bc..dfc22342c 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2157,3 +2157,5 @@ David De Salvo Willem Verschoren Dennis Kathrens Alan Aucote +Richard Jerome Danstrom +David Garcia-Mendia From 45cd6432c7e8cec4c335fc2a6cd77750c53e457a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 23 Feb 2021 22:22:27 +0100 Subject: [PATCH 076/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index dfc22342c..41c1461d4 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2159,3 +2159,4 @@ Dennis Kathrens Alan Aucote Richard Jerome Danstrom David Garcia-Mendia +Mark Jones From 27d3bf8a3cd52a97e02053ca87398862ee972b10 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 24 Feb 2021 18:41:21 +0100 Subject: [PATCH 077/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 41c1461d4..0e7467e02 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2160,3 +2160,4 @@ Alan Aucote Richard Jerome Danstrom David Garcia-Mendia Mark Jones +John Zseleczky From aa06a9d7d1d3543a9c67d299ab9ee1a37330a154 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 25 Feb 2021 07:40:50 +1100 Subject: [PATCH 078/188] Extended limits do not apply to offset --- companion/src/modeledit/channels.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index f0353ee45..b896c44d7 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -241,12 +241,11 @@ void ChannelsPanel::nameEdited() void ChannelsPanel::refreshExtendedLimits() { - int channelMax = model->getChannelsMax(); + int channelMax = model->getChannelsMax() * 10; for (int i = 0 ; i < CPN_MAX_CHNOUT; i++) { - chnOffset[i]->updateMinMax(10 * channelMax); - chnMin[i]->updateMinMax(10 * channelMax); - chnMax[i]->updateMinMax(10 * channelMax); + chnMin[i]->updateMinMax(channelMax); + chnMax[i]->updateMinMax(channelMax); } emit modified(); } From c2c9879de6e503df7a9162c9bab8747cf0edc0e2 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 25 Feb 2021 08:03:56 +1100 Subject: [PATCH 079/188] Allow decimals for channel min and max --- companion/src/modeledit/channels.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index b896c44d7..22ca3f3be 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -25,35 +25,26 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt, ModelPanel * panel): firmware(firmware), spinbox(new QDoubleSpinBox()), - value(value), - displayStep(0.1) + value(value) { Board::Type board = firmware->getBoard(); bool allowGVars = IS_HORUS_OR_TARANIS(board); - int internalStep = 1; spinbox->setProperty("index", row); spinbox->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); spinbox->setAccelerated(true); + spinbox->setDecimals(1); if (firmware->getCapability(PPMUnitMicroseconds)) { displayStep = 0.512; - spinbox->setDecimals(1); spinbox->setSuffix("us"); } else { - spinbox->setDecimals(0); + displayStep = 0.1; spinbox->setSuffix("%"); } - if (deflt == 0 /*it's the offset*/) { - spinbox->setDecimals(1); - } - else { - internalStep *= 10; - } - - spinbox->setSingleStep(displayStep * internalStep); + spinbox->setSingleStep(displayStep); spinbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); QHBoxLayout *horizontalLayout = new QHBoxLayout(); From 71d3f1924918c18bb9803bcd03d6e982243f2ef4 Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 25 Feb 2021 16:17:51 +0100 Subject: [PATCH 080/188] Cosmetcis --- radio/src/gui/gui_common.cpp | 2 +- radio/src/gui/gui_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 98048c906..1bd84b21e 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -1099,7 +1099,7 @@ void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, Lcd } #if defined(MULTIMODULE) -const char* getMultiOptionTitle(uint8_t moduleIdx) +const char * getMultiOptionTitle(uint8_t moduleIdx) { MultiModuleStatus &status = getMultiModuleStatus(moduleIdx); diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index 784509378..e55c16581 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -318,7 +318,7 @@ inline uint8_t MODULE_OPTION_ROW(uint8_t moduleIdx) { } void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags); -const char* getMultiOptionTitle(uint8_t moduleIdx); +const char * getMultiOptionTitle(uint8_t moduleIdx); const char * writeScreenshot(); From 1218e20104e1049f54706d425cb03aeaf9623a92 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 26 Feb 2021 10:46:26 +0100 Subject: [PATCH 081/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 0e7467e02..fd76180b4 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2161,3 +2161,4 @@ Richard Jerome Danstrom David Garcia-Mendia Mark Jones John Zseleczky +Xiao Sun From ad0134d3ce21522b65ce3454462a4735ff3ae129 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sat, 27 Feb 2021 08:08:20 +1100 Subject: [PATCH 082/188] Add gvref data model to value/gv fields in inputs, outputs and mixes --- companion/src/helpers.cpp | 50 ++++++++++--------------- companion/src/helpers.h | 11 +++--- companion/src/modeledit/channels.cpp | 27 +++++++------ companion/src/modeledit/channels.h | 15 ++++---- companion/src/modeledit/expodialog.cpp | 7 +++- companion/src/modeledit/mixerdialog.cpp | 8 +++- 6 files changed, 57 insertions(+), 61 deletions(-) diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 020f1b45b..c1cd7de79 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -32,6 +32,7 @@ #include "simulatorinterface.h" #include "simulatormainwindow.h" #include "storage/sdcard.h" +#include "filtereditemmodels.h" #include #include @@ -117,7 +118,8 @@ void CompanionIcon::addImage(const QString & baseimage, Mode mode, State state) * GVarGroup */ -GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars): +GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, + const int deflt, const int mini, const int maxi, const double step, FilteredItemModel * gvarModel): QObject(), weightGV(weightGV), weightSB(weightSB), @@ -131,8 +133,8 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo step(step), lock(true) { - if (allowGvars && getCurrentFirmware()->getCapability(Gvars)) { - Helpers::populateGVCB(*weightCB, weight, model); + if (gvarModel && gvarModel->rowCount() > 0) { + weightCB->setModel(gvarModel); connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int))); connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged())); } @@ -152,12 +154,19 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo void GVarGroup::gvarCBChanged(int state) { - weightCB->setVisible(state); - if (weightSB) + if (!lock) { + weightCB->setVisible(state); + if (weightGV->isChecked()) { + // set CB to +GV1 + int cnt = getCurrentFirmware()->getCapability(Gvars); + if (weightCB->count() > cnt) + weightCB->setCurrentIndex(cnt); + else + weightCB->setCurrentIndex(0); + } weightSB->setVisible(!state); - else - weightSB->setVisible(!state); - valuesChanged(); + valuesChanged(); + } } void GVarGroup::valuesChanged() @@ -168,7 +177,7 @@ void GVarGroup::valuesChanged() else if (sb) weight = sb->value(); else - weight = round(dsb->value()/step); + weight = round(dsb->value() / step); emit valueChanged(); } @@ -180,7 +189,7 @@ void GVarGroup::setWeight(int val) int tval; - if (val>maxi || val maxi || val < mini) { tval = deflt; weightGV->setChecked(true); weightSB->hide(); @@ -214,27 +223,6 @@ void GVarGroup::setWeight(int val) * Helpers namespace functions */ -void Helpers::populateGVCB(QComboBox & b, int value, const ModelData & model) -{ - int count = getCurrentFirmware()->getCapability(Gvars); - - b.clear(); - - for (int i=-count; i<=-1; i++) { - int16_t gval = (int16_t)(-10000+i); - b.addItem("-" + RawSource(SOURCE_TYPE_GVAR, abs(i)-1).toString(&model), gval); - } - - for (int i=1; i<=count; i++) { - int16_t gval = (int16_t)(10000+i); - b.addItem(RawSource(SOURCE_TYPE_GVAR, i-1).toString(&model), gval); - } - - b.setCurrentIndex(b.findData(value)); - if (b.currentIndex() == -1) - b.setCurrentIndex(count); -} - // TODO: Move lookup to GVarData class (w/out combobox) void Helpers::populateGvarUseCB(QComboBox * b, unsigned int phase) { diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 107ca2aa0..8bb1cc6b8 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -18,8 +18,7 @@ * GNU General Public License for more details. */ -#ifndef _HELPERS_H_ -#define _HELPERS_H_ +#pragma once #include "eeprominterface.h" #include @@ -60,12 +59,15 @@ class CompanionIcon: public QIcon { void addImage(const QString &baseimage, Mode mode = Normal, State state = Off); }; +class FilteredItemModel; + class GVarGroup: public QObject { Q_OBJECT public: - GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true); + GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, + const int deflt, const int mini, const int maxi, const double step = 1.0, FilteredItemModel * gvarModel = nullptr); void setWeight(int val); @@ -101,7 +103,6 @@ class GVarGroup: public QObject { namespace Helpers { void populateGvarUseCB(QComboBox *b, unsigned int phase); - void populateGVCB(QComboBox & b, int value, const ModelData & model); void populateFileComboBox(QComboBox * b, const QSet & set, const QString & current); void getFileComboBoxValue(QComboBox * b, char * dest, int length); @@ -234,5 +235,3 @@ private: }; extern Stopwatch gStopwatch; - -#endif // _HELPERS_H_ diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index 22ca3f3be..5ec77ce55 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -22,14 +22,12 @@ #include "helpers.h" #include "filtereditemmodels.h" -LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt, ModelPanel * panel): +LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, + int min, int max, int deflt, FilteredItemModel * gvarModel, ModelPanel * panel): firmware(firmware), spinbox(new QDoubleSpinBox()), value(value) { - Board::Type board = firmware->getBoard(); - bool allowGVars = IS_HORUS_OR_TARANIS(board); - spinbox->setProperty("index", row); spinbox->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); spinbox->setAccelerated(true); @@ -56,7 +54,7 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row horizontalLayout->addWidget(cb); horizontalLayout->addWidget(spinbox); tableLayout->addLayout(row, col, horizontalLayout); - gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, allowGVars); + gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, gvarModel); QObject::connect(gvarGroup, &GVarGroup::valueChanged, panel, &ModelPanel::modified); } @@ -87,6 +85,7 @@ void LimitsGroup::updateMinMax(int max) } } } + ChannelsPanel::ChannelsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware, CompoundItemModelFactory * sharedItemModels): ModelPanel(parent, model, generalSettings, firmware), sharedItemModels(sharedItemModels) @@ -94,8 +93,12 @@ ChannelsPanel::ChannelsPanel(QWidget * parent, ModelData & model, GeneralSetting chnCapability = firmware->getCapability(Outputs); int channelNameMaxLen = firmware->getCapability(ChannelsName); - curveFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_Curve)); - connectItemModelEvents(curveFilteredModel); + dialogFilteredItemModels = new FilteredItemModelFactory(); + + int crvid = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_Curve)), "Curve"); + connectItemModelEvents(dialogFilteredItemModels->getItemModel(crvid)); + + int gvid = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_GVarRef)), "GVarRef"); QStringList headerLabels; headerLabels << "#"; @@ -137,13 +140,13 @@ ChannelsPanel::ChannelsPanel(QWidget * parent, ModelData & model, GeneralSetting } // Channel offset - chnOffset[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0, this); + chnOffset[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0, dialogFilteredItemModels->getItemModel(gvid), this); // Channel min - chnMin[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax() * 10, 0, -1000, this); + chnMin[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax() * 10, 0, -1000, dialogFilteredItemModels->getItemModel(gvid), this); // Channel max - chnMax[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax() * 10, 1000, this); + chnMax[i] = new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax() * 10, 1000, dialogFilteredItemModels->getItemModel(gvid), this); // Channel inversion invCB[i] = new QComboBox(this); @@ -156,7 +159,7 @@ ChannelsPanel::ChannelsPanel(QWidget * parent, ModelData & model, GeneralSetting if (IS_HORUS_OR_TARANIS(firmware->getBoard())) { curveCB[i] = new QComboBox(this); curveCB[i]->setProperty("index", i); - curveCB[i]->setModel(curveFilteredModel); + curveCB[i]->setModel(dialogFilteredItemModels->getItemModel(crvid)); connect(curveCB[i], SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited())); tableLayout->addWidget(i, col++, curveCB[i]); } @@ -204,7 +207,7 @@ ChannelsPanel::~ChannelsPanel() delete centerSB[i]; delete symlimitsChk[i]; } - delete curveFilteredModel; + delete dialogFilteredItemModels; } void ChannelsPanel::symlimitsEdited() diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index 70da877e7..574e316d8 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -18,8 +18,7 @@ * GNU General Public License for more details. */ -#ifndef _CHANNELS_H_ -#define _CHANNELS_H_ +#pragma once #include "helpers.h" #include "modeledit.h" @@ -27,7 +26,7 @@ #include class CompoundItemModelFactory; -class FilteredItemModel; +class FilteredItemModelFactory; constexpr char MIMETYPE_CHANNEL[] = "application/x-companion-channel"; @@ -38,7 +37,8 @@ class LimitsGroup Q_DECLARE_TR_FUNCTIONS(LimitsGroup) public: - LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt, ModelPanel * panel=NULL); + LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, + int min, int max, int deflt, FilteredItemModel * gvarModel, ModelPanel * panel = nullptr); ~LimitsGroup(); void setValue(int val); @@ -58,7 +58,8 @@ class ChannelsPanel : public ModelPanel Q_OBJECT public: - ChannelsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware, CompoundItemModelFactory * sharedItemModels); + ChannelsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware, + CompoundItemModelFactory * sharedItemModels); virtual ~ChannelsPanel(); public slots: @@ -102,9 +103,7 @@ class ChannelsPanel : public ModelPanel int selectedIndex; int chnCapability; CompoundItemModelFactory *sharedItemModels; - FilteredItemModel *curveFilteredModel; void updateItemModels(); void connectItemModelEvents(const FilteredItemModel * itemModel); + FilteredItemModelFactory *dialogFilteredItemModels; }; - -#endif // _CHANNELS_H_ diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index abede1d73..be549144c 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -50,8 +50,11 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G setWindowTitle(tr("Edit %1").arg(RawSource(srcType, ed->chn).toString(&model, &generalSettings))); QRegExp rx(CHAR_FOR_NAMES_REGEX); - gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100); - gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100); + id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_GVarRef)), "GVarRef"); + gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100, 1.0, + dialogFilteredItemModels->getItemModel(id)); + gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100, 1.0, + dialogFilteredItemModels->getItemModel(id)); curveRefFilteredItemModels = new CurveRefFilteredFactory(sharedItemModels, firmware->getCapability(HasInputDiff) ? 0 : FilteredItemModel::PositiveFilter); diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp index 645a25274..6cc39ffd1 100644 --- a/companion/src/modeledit/mixerdialog.cpp +++ b/companion/src/modeledit/mixerdialog.cpp @@ -55,9 +55,13 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData * mixdata, ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(md->srcRaw.toValue())); int limit = firmware->getCapability(OffsetWeight); + id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_GVarRef)), "GVarRef"); + + gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, model, 100, -limit, limit, 1.0, + dialogFilteredItemModels->getItemModel(id)); + gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, model, 0, -limit, limit, 1.0, + dialogFilteredItemModels->getItemModel(id)); - gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, model, 100, -limit, limit); - gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, model, 0, -limit, limit); curveRefFilteredItemModels = new CurveRefFilteredFactory(sharedItemModels, firmware->getCapability(HasMixerExpo) ? 0 : FilteredItemModel::PositiveFilter); curveGroup = new CurveReferenceUIManager(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueSB, ui->curveValueCB, md->curve, model, From 9aaa329e4e54f650548920ea36aec1e9a0dfc4d1 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 28 Feb 2021 17:32:10 +0100 Subject: [PATCH 083/188] Update CREDITS.txt --- CREDITS.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index fd76180b4..1fa8b356a 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2162,3 +2162,7 @@ David Garcia-Mendia Mark Jones John Zseleczky Xiao Sun +Glenn Harvey +Albrecht Friebel +Gunter Klemke +Travis McCarthy From d213034bfd56be0e2c6c6be3e0db958f176fe836 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 28 Feb 2021 05:13:34 +1100 Subject: [PATCH 084/188] Add item data models for action and reset param --- .../src/firmwares/customfunctiondata.cpp | 88 +++++++++++++-- companion/src/firmwares/customfunctiondata.h | 16 ++- companion/src/modeledit/customfunctions.cpp | 102 ++++++++---------- companion/src/modeledit/customfunctions.h | 15 +-- 4 files changed, 143 insertions(+), 78 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index d4942c60c..56891dc46 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -22,6 +22,7 @@ #include "eeprominterface.h" #include "radiodata.h" #include "radiodataconversionstate.h" +#include "compounditemmodels.h" void CustomFunctionData::clear() { @@ -200,7 +201,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const else if (func >= FuncAdjustGV1 && func < FuncCount) { switch (adjustMode) { case FUNC_ADJUST_GVAR_CONSTANT: - return tr("Value ") + QString("%1").arg(param); + return tr("Value") + QString(" %1").arg(param); case FUNC_ADJUST_GVAR_SOURCE: case FUNC_ADJUST_GVAR_GVAR: return RawSource(param).toString(); @@ -209,7 +210,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const QString unit; val = param * model->gvarData[func - FuncAdjustGV1].multiplierGet(); unit = model->gvarData[func - FuncAdjustGV1].unitToString(); - return QString("Increment: %1%2").arg(val).arg(unit); + return tr("Increment") + QString(": %1%2").arg(val).arg(unit); } } return ""; @@ -217,15 +218,20 @@ QString CustomFunctionData::paramToString(const ModelData * model) const QString CustomFunctionData::repeatToString() const { - if (repeatParam == -1) { - return tr("played once, not during startup"); + return repeatToString(repeatParam); +} + +// static +QString CustomFunctionData::repeatToString(int value) const +{ + if (value == -1) { + return tr("Played once, not during startup"); } - else if (repeatParam == 0) { - return ""; + else if (value == 0) { + return tr("No repeat"); } else { - unsigned int step = 1; - return tr("repeat(%1s)").arg(step * repeatParam); + return tr("Repeat(%1s)").arg(value); } } @@ -312,3 +318,69 @@ void CustomFunctionData::convert(RadioDataConversionState & cstate) param = RawSource(param).convert(cstate.withComponentField("PARAM")).toValue(); } } + +// static +QString CustomFunctionData::harpicToString(int value) +{ + return QString("%1").arg(value); +} + +// static +QStringList CustomFunctionData::playsoundStringList() +{ + return QStringList("Beep 1" "Beep 2" "Beep 3" "Warn 1" "Warn 2" "Cheep" "Ratata" "Tick" + "Siren" "Ring" "SciFi" "Robot" "Chirp" "Tada" "Crickt" "AlmClk"); +} + +// static +QString CustomFunctionData::playsoundToString(int value) +{ + QStringList strl = playsoundStringList(); + if (value < strl.count()) + return strl.at(value); + else + return CPN_STR_UNKNOWN_ITEM; +} + +// static +AbstractStaticItemModel * CustomFunctionData::repeatItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("customfunctiondata.repeat"); + + for (int i = -1; i <= 60; i++) { + mdl->appendToItemList(repeatToString(i), i); + } + + mdl->loadItemList(); + return mdl; +} + +// static +AbstractStaticItemModel * CustomFunctionData::playSoundsItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("customfunctiondata.playsounds"); + + for (int i = 0; i <= 60; i++) { + mdl->appendToItemList(playsoundsToString(i), i); + } + + mdl->loadItemList(); + return mdl; +} + +// static +AbstractStaticItemModel * CustomFunctionData::harpicItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("customfunctiondata.harpic"); + + for (int i = 0; i <= 3; i++) { + mdl->appendToItemList(harpicToString(i), i); + } + + mdl->loadItemList(); + return mdl; +} + diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 9e597441f..63c68e2d0 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -18,8 +18,7 @@ * GNU General Public License for more details. */ -#ifndef CUSTOMFUNCTIONDATA_H -#define CUSTOMFUNCTIONDATA_H +#pragma once #include "boards.h" #include "constants.h" @@ -32,6 +31,7 @@ class Firmware; class ModelData; class GeneralSettings; class RadioDataConversionState; +class AbstractStaticItemModel; enum AssignFunc { FuncOverrideCH1 = 0, @@ -109,6 +109,8 @@ class CustomFunctionData { QString paramToString(const ModelData * model) const; QString repeatToString() const; QString enabledToString() const; + QString playsoundsToString() const; + QString harpicToString() const; static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value); static void populatePlaySoundParams(QStringList & qs); @@ -120,7 +122,11 @@ class CustomFunctionData { void convert(RadioDataConversionState & cstate); + static QString repeatToString(int value); + static QStringList playsoundStringList(); + static QString playsoundsToString(int value); + static QString harpicToString(int value); + static AbstractStaticItemModel * repeatItemModel(); + static AbstractStaticItemModel * playsoundsItemModel(); + static AbstractStaticItemModel * harpicItemModel(); }; - - -#endif // CUSTOMFUNCTIONDATA_H diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 5c15bd538..66f317ab2 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -30,7 +30,7 @@ RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam): repeatParam(repeatParam) { unsigned int step = 1; - int value = repeatParam/step; + int value = repeatParam / step; setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); @@ -59,7 +59,7 @@ void RepeatComboBox::onIndexChanged(int index) void RepeatComboBox::update() { unsigned int step = 1; - int value = repeatParam/step; + int value = repeatParam / step; if (step == 1) { value++; } @@ -77,18 +77,35 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, lock = true; fswCapability = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); - rawSwitchFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), - model ? RawSwitch::SpecialFunctionsContext : RawSwitch::GlobalFunctionsContext); - connectItemModelEvents(rawSwitchFilteredModel); + dlgFilterFactory = new FilteredItemModelFactory(); - rawSourceAllModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource)); - connectItemModelEvents(rawSourceAllModel); + funcActionsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncAction), + model ? CustomFunctionData::AllFunctionContexts : CustomFunctionData::GlobalFunctionsContext), + "Function Actions"); + connectItemModelEvents(dlgFilterFactory->getItemModel(funcActionsId)); - rawSourceInputsModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), RawSource::InputSourceGroups); - connectItemModelEvents(rawSourceInputsModel); + funcResetParamId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncResetParam)), + "Reset Params"); + connectItemModelEvents(dlgFilterFactory->getItemModel(funcResetParamId)); - rawSourceGVarsModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), RawSource::GVarsGroup); - connectItemModelEvents(rawSourceGVarsModel); + rawSwitchId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), + model ? RawSwitch::SpecialFunctionsContext : RawSwitch::GlobalFunctionsContext), + "RawSwitch"); + connectItemModelEvents(dlgFilterFactory->getItemModel(rawSwitchId)); + + rawSourceAllId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource)), + "RawSource All"); + connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceAllId)); + + rawSourceInputsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), + RawSource::InputSourceGroups), + "RawSource Inputs"); + connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceInputsId)); + + rawSourceGVarsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), + RawSource::GVarsGroup), + "RawSource GVars"); + connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceGVarsId)); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); @@ -135,32 +152,24 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); tableLayout->addWidget(i, 0, label); - // s1.report("label"); // The switch fswtchSwtch[i] = new QComboBox(this); - fswtchSwtch[i]->setModel(rawSwitchFilteredModel); + fswtchSwtch[i]->setModel(dlgFilterFactory->getItemModel(rawSwitchId)); fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(functions[i].swtch.toValue())); fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); fswtchSwtch[i]->setMaxVisibleItems(10); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); tableLayout->addWidget(i, 1, fswtchSwtch[i]); - // s1.report("switch"); // The function fswtchFunc[i] = new QComboBox(this); - if (!i) { - populateFuncCB(fswtchFunc[i], functions[i].func); - } - else { - fswtchFunc[i]->setModel(fswtchFunc[0]->model()); - fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func)); - } + fswtchFunc[i]->setModel(dlgFilterFactory->getItemModel(funcActionsId)); + fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func)); fswtchFunc[i]->setProperty("index", i); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); tableLayout->addWidget(i, 2, fswtchFunc[i]); - // s1.report("func"); // The parameters QHBoxLayout * paramLayout = new QHBoxLayout(); @@ -250,10 +259,7 @@ CustomFunctionsPanel::~CustomFunctionsPanel() { if (mediaPlayer) stopSound(mediaPlayerCurrent); - delete rawSwitchFilteredModel; - delete rawSourceAllModel; - delete rawSourceInputsModel; - delete rawSourceGVarsModel; + delete dlgFilterFactory; } void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state) @@ -653,33 +659,6 @@ void CustomFunctionsPanel::onCustomContextMenuRequested(QPoint pos) contextMenu.exec(globalPos); } -void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value) -{ - b->clear(); - for (unsigned int i = 0; i < FuncCount; i++) { - if (((i >= FuncOverrideCH1 && i <= FuncOverrideCH32) && (!model || !firmware->getCapability(SafetyChannelCustomFunction))) || - ((i == FuncVolume || i == FuncBackgroundMusic || i == FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) || - ((i == FuncPlayScript && !IS_HORUS_OR_TARANIS(firmware->getBoard()))) || - ((i == FuncPlayHaptic) && !firmware->getCapability(Haptic)) || - ((i == FuncPlayBoth) && !firmware->getCapability(HasBeeper)) || - ((i == FuncLogs) && !firmware->getCapability(HasSDLogs)) || - ((i == FuncSetTimer3) && firmware->getCapability(Timers) < 3) || - ((i == FuncScreenshot) && !IS_HORUS_OR_TARANIS(firmware->getBoard())) || - ((i >= FuncRangeCheckInternalModule && i <= FuncBindExternalModule) && (!model || !firmware->getCapability(DangerousFunctions))) || - ((i >= FuncAdjustGV1 && i <= FuncAdjustGVLast) && (!model || !firmware->getCapability(Gvars))) - ) { - // skipped - continue; - } - else { - b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(model), i); - if (i == value) { - b->setCurrentIndex(b->count() - 1); - } - } - } -} - void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value) { b->clear(); @@ -705,25 +684,30 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi b->setCurrentIndex(value); } else if (function == FuncReset) { - CustomFunctionData::populateResetParams(model, b, value); + b->setModel(dlgFilterFactory->getItemModel(funcResetParamId)); + b->setCurrentIndex(b->findData(value)); } else if (function == FuncVolume || function == FuncBacklight) { - b->setModel(rawSourceInputsModel); + b->setModel(dlgFilterFactory->getItemModel(rawSourceInputsId)); b->setCurrentIndex(b->findData(value)); } else if (function == FuncPlayValue) { - b->setModel(rawSourceAllModel); + b->setModel(dlgFilterFactory->getItemModel(rawSourceAllId)); b->setCurrentIndex(b->findData(value)); } else if (function >= FuncAdjustGV1 && function <= FuncAdjustGVLast) { switch (adjustmode) { case 1: - b->setModel(rawSourceInputsModel); + b->setModel(dlgFilterFactory->getItemModel(rawSourceInputsId)); b->setCurrentIndex(b->findData(value)); + if (b->currentIndex() < 0) + b->setCurrentIndex(0); break; case 2: - b->setModel(rawSourceGVarsModel); + b->setModel(dlgFilterFactory->getItemModel(rawSourceGVarsId)); b->setCurrentIndex(b->findData(value)); + if (b->currentIndex() < 0) + b->setCurrentIndex(0); break; } } @@ -828,7 +812,7 @@ bool CustomFunctionsPanel::moveUpAllowed() const return selectedIndex > 0; } -void CustomFunctionsPanel::connectItemModelEvents(const FilteredItemModel * itemModel) +void CustomFunctionsPanel::connectItemModelEvents(FilteredItemModel * itemModel) { connect(itemModel, &FilteredItemModel::aboutToBeUpdated, this, &CustomFunctionsPanel::onItemModelAboutToBeUpdated); connect(itemModel, &FilteredItemModel::updateComplete, this, &CustomFunctionsPanel::onItemModelUpdateComplete); diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index e41baf672..7a1fd9c39 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -27,6 +27,7 @@ #include class CompoundItemModelFactory; +class FilteredItemModelFactory; class FilteredItemModel; class TimerEdit; @@ -87,7 +88,6 @@ class CustomFunctionsPanel : public GenericPanel void onItemModelUpdateComplete(); private: - void populateFuncCB(QComboBox *b, unsigned int value); void populateGVmodeCB(QComboBox *b, unsigned int value); void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0); bool hasClipboardData(QByteArray * data = nullptr) const; @@ -96,12 +96,15 @@ class CustomFunctionsPanel : public GenericPanel bool moveUpAllowed() const; void swapData(int idx1, int idx2); void resetCBsAndRefresh(int idx); - void connectItemModelEvents(const FilteredItemModel * itemModel); + void connectItemModelEvents(FilteredItemModel * itemModel); - FilteredItemModel * rawSwitchFilteredModel; - FilteredItemModel * rawSourceAllModel; - FilteredItemModel * rawSourceInputsModel; - FilteredItemModel * rawSourceGVarsModel; + FilteredItemModelFactory * dlgFilterFactory; + int funcActionsId; + int funcResetParamId; + int rawSwitchId; + int rawSourceAllId; + int rawSourceInputsId; + int rawSourceGVarsId; QSet tracksSet; QSet scriptsSet; From e6e41f18d7fe8a6dd52ade378749b80278b0c1e0 Mon Sep 17 00:00:00 2001 From: elecpower Date: Mon, 1 Mar 2021 10:00:21 +1100 Subject: [PATCH 085/188] Add static models --- .../src/firmwares/customfunctiondata.cpp | 75 +++++++++---------- companion/src/firmwares/customfunctiondata.h | 14 ++-- companion/src/modeledit/customfunctions.cpp | 58 +++++++------- companion/src/modeledit/customfunctions.h | 5 +- 4 files changed, 75 insertions(+), 77 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 56891dc46..428e4eead 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -24,6 +24,16 @@ #include "radiodataconversionstate.h" #include "compounditemmodels.h" +void CustomFunctionData::convert(RadioDataConversionState & cstate) +{ + cstate.setComponent(tr("CFN"), 8); + cstate.setSubComp(nameToString(cstate.subCompIdx, (cstate.toModel() ? false : true))); + swtch.convert(cstate); + if (func == FuncVolume || func == FuncBacklight || func == FuncPlayValue || (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast && adjustMode == 1)) { + param = RawSource(param).convert(cstate.withComponentField("PARAM")).toValue(); + } +} + void CustomFunctionData::clear() { memset(reinterpret_cast(this), 0, sizeof(CustomFunctionData)); @@ -95,9 +105,9 @@ QString CustomFunctionData::funcToString(const ModelData * model) const else if (func == FuncSetFailsafe) return tr("Set Failsafe"); else if (func == FuncRangeCheckInternalModule) - return tr("RangeCheck Int. Module"); + return tr("Range Check Int. Module"); else if (func == FuncRangeCheckExternalModule) - return tr("RangeCheck Ext. Module"); + return tr("Range Check Ext. Module"); else if (func == FuncBindInternalModule) return tr("Bind Int. Module"); else if (func == FuncBindExternalModule) @@ -143,17 +153,6 @@ void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox b->setCurrentIndex(b->findData(value)); } -void CustomFunctionData::populatePlaySoundParams(QStringList & qs) -{ - qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ; - qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ; -} - -void CustomFunctionData::populateHapticParams(QStringList & qs) -{ - qs << "0" << "1" << "2" << "3"; -} - QString CustomFunctionData::paramToString(const ModelData * model) const { QStringList qs; @@ -164,18 +163,10 @@ QString CustomFunctionData::paramToString(const ModelData * model) const return QString("%1").arg(param / 10.0) + tr("s"); } else if (func == FuncPlaySound) { - CustomFunctionData::populatePlaySoundParams(qs); - if (param >= 0 && param < (int)qs.count()) - return qs.at(param); - else - return tr("Inconsistent parameter"); + return playSoundToString(param); } else if (func == FuncPlayHaptic) { - CustomFunctionData::populateHapticParams(qs); - if (param >= 0 && param < (int)qs.count()) - return qs.at(param); - else - return tr("Inconsistent parameter"); + return harpicToString(param); } else if (func == FuncReset) { QComboBox cb; @@ -184,7 +175,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const if (pos >= 0) return cb.itemText(pos); else - return tr("Inconsistent parameter"); + return QString(CPN_STR_UNKNOWN_ITEM); } else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) { RawSource item(param); @@ -222,7 +213,7 @@ QString CustomFunctionData::repeatToString() const } // static -QString CustomFunctionData::repeatToString(int value) const +QString CustomFunctionData::repeatToString(int value) { if (value == -1) { return tr("Played once, not during startup"); @@ -309,14 +300,9 @@ bool CustomFunctionData::isResetParamAvailable(const ModelData * model, int inde return false; } -void CustomFunctionData::convert(RadioDataConversionState & cstate) +QString CustomFunctionData::harpicToString() const { - cstate.setComponent(tr("CFN"), 8); - cstate.setSubComp(nameToString(cstate.subCompIdx, (cstate.toModel() ? false : true))); - swtch.convert(cstate); - if (func == FuncVolume || func == FuncBacklight || func == FuncPlayValue || (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast && adjustMode == 1)) { - param = RawSource(param).convert(cstate.withComponentField("PARAM")).toValue(); - } + return harpicToString(param); } // static @@ -326,20 +312,27 @@ QString CustomFunctionData::harpicToString(int value) } // static -QStringList CustomFunctionData::playsoundStringList() +QStringList CustomFunctionData::playSoundStringList() { - return QStringList("Beep 1" "Beep 2" "Beep 3" "Warn 1" "Warn 2" "Cheep" "Ratata" "Tick" - "Siren" "Ring" "SciFi" "Robot" "Chirp" "Tada" "Crickt" "AlmClk"); + QStringList strl; + strl << tr("Beep 1") << tr("Beep 2") << tr("Beep 3") << tr("Warn 1") << tr("Warn 2") << tr("Cheep") << tr("Ratata") << tr("Tick") + << tr("Siren") << tr("Ring") << tr("Sci Fi") << tr("Robot") << tr("Chirp") << tr("Tada") << tr("Cricket") << tr("Alarm Clock"); + return strl; +} + +QString CustomFunctionData::playSoundToString() const +{ + return playSoundToString(param); } // static -QString CustomFunctionData::playsoundToString(int value) +QString CustomFunctionData::playSoundToString(int value) { - QStringList strl = playsoundStringList(); + QStringList strl = playSoundStringList(); if (value < strl.count()) return strl.at(value); else - return CPN_STR_UNKNOWN_ITEM; + return QString(CPN_STR_UNKNOWN_ITEM); } // static @@ -357,13 +350,13 @@ AbstractStaticItemModel * CustomFunctionData::repeatItemModel() } // static -AbstractStaticItemModel * CustomFunctionData::playSoundsItemModel() +AbstractStaticItemModel * CustomFunctionData::playSoundItemModel() { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); mdl->setName("customfunctiondata.playsounds"); - for (int i = 0; i <= 60; i++) { - mdl->appendToItemList(playsoundsToString(i), i); + for (int i = 0; i < playSoundStringList().count(); i++) { + mdl->appendToItemList(playSoundToString(i), i); } mdl->loadItemList(); diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 63c68e2d0..2301e6567 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -102,6 +102,8 @@ class CustomFunctionData { unsigned int adjustMode; int repeatParam; + void convert(RadioDataConversionState & cstate); + void clear(); bool isEmpty() const; QString nameToString(int index, bool globalContext = false) const; @@ -109,24 +111,20 @@ class CustomFunctionData { QString paramToString(const ModelData * model) const; QString repeatToString() const; QString enabledToString() const; - QString playsoundsToString() const; + QString playSoundToString() const; QString harpicToString() const; static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value); - static void populatePlaySoundParams(QStringList & qs); - static void populateHapticParams(QStringList & qs); static bool isFuncAvailable(int index); static int funcContext(int index); static int resetParamCount(const ModelData * model); static bool isResetParamAvailable(const ModelData * model, int index); - void convert(RadioDataConversionState & cstate); - static QString repeatToString(int value); - static QStringList playsoundStringList(); - static QString playsoundsToString(int value); + static QStringList playSoundStringList(); + static QString playSoundToString(int value); static QString harpicToString(int value); static AbstractStaticItemModel * repeatItemModel(); - static AbstractStaticItemModel * playsoundsItemModel(); + static AbstractStaticItemModel * playSoundItemModel(); static AbstractStaticItemModel * harpicItemModel(); }; diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 66f317ab2..f2f2e07f1 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -19,6 +19,7 @@ */ #include "customfunctions.h" +#include "compounditemmodels.h" #include "filtereditemmodels.h" #include "helpers.h" #include "appdata.h" @@ -77,35 +78,39 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, lock = true; fswCapability = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); - dlgFilterFactory = new FilteredItemModelFactory(); + tabModelFactory = new CompoundItemModelFactory(&generalSettings, model); + playSoundId = tabModelFactory->registerItemModel(CustomFunctionData::playSoundItemModel()); + harpicId = tabModelFactory->registerItemModel(CustomFunctionData::harpicItemModel()); - funcActionsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncAction), + tabFilterFactory = new FilteredItemModelFactory(); + + funcActionsId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncAction), model ? CustomFunctionData::AllFunctionContexts : CustomFunctionData::GlobalFunctionsContext), "Function Actions"); - connectItemModelEvents(dlgFilterFactory->getItemModel(funcActionsId)); + connectItemModelEvents(tabFilterFactory->getItemModel(funcActionsId)); - funcResetParamId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncResetParam)), + funcResetParamId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_CustomFuncResetParam)), "Reset Params"); - connectItemModelEvents(dlgFilterFactory->getItemModel(funcResetParamId)); + connectItemModelEvents(tabFilterFactory->getItemModel(funcResetParamId)); - rawSwitchId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), + rawSwitchId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), model ? RawSwitch::SpecialFunctionsContext : RawSwitch::GlobalFunctionsContext), "RawSwitch"); - connectItemModelEvents(dlgFilterFactory->getItemModel(rawSwitchId)); + connectItemModelEvents(tabFilterFactory->getItemModel(rawSwitchId)); - rawSourceAllId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource)), + rawSourceAllId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource)), "RawSource All"); - connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceAllId)); + connectItemModelEvents(tabFilterFactory->getItemModel(rawSourceAllId)); - rawSourceInputsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), + rawSourceInputsId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), RawSource::InputSourceGroups), "RawSource Inputs"); - connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceInputsId)); + connectItemModelEvents(tabFilterFactory->getItemModel(rawSourceInputsId)); - rawSourceGVarsId = dlgFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), + rawSourceGVarsId = tabFilterFactory->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), RawSource::GVarsGroup), "RawSource GVars"); - connectItemModelEvents(dlgFilterFactory->getItemModel(rawSourceGVarsId)); + connectItemModelEvents(tabFilterFactory->getItemModel(rawSourceGVarsId)); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); @@ -155,7 +160,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, // The switch fswtchSwtch[i] = new QComboBox(this); - fswtchSwtch[i]->setModel(dlgFilterFactory->getItemModel(rawSwitchId)); + fswtchSwtch[i]->setModel(tabFilterFactory->getItemModel(rawSwitchId)); fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(functions[i].swtch.toValue())); fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); @@ -165,7 +170,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, // The function fswtchFunc[i] = new QComboBox(this); - fswtchFunc[i]->setModel(dlgFilterFactory->getItemModel(funcActionsId)); + fswtchFunc[i]->setModel(tabFilterFactory->getItemModel(funcActionsId)); fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func)); fswtchFunc[i]->setProperty("index", i); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); @@ -259,7 +264,8 @@ CustomFunctionsPanel::~CustomFunctionsPanel() { if (mediaPlayer) stopSound(mediaPlayerCurrent); - delete dlgFilterFactory; + delete tabModelFactory; + delete tabFilterFactory; } void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state) @@ -674,37 +680,35 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi QStringList qs; b->setModel(new QStandardItemModel(b)); // clear combo box but not any shared item model if (function == FuncPlaySound) { - CustomFunctionData::populatePlaySoundParams(qs); - b->addItems(qs); - b->setCurrentIndex(value); + b->setModel(tabModelFactory->getItemModel(playSoundId)); + b->setCurrentIndex(b->findData(value)); } else if (function == FuncPlayHaptic) { - CustomFunctionData::populateHapticParams(qs); - b->addItems(qs); - b->setCurrentIndex(value); + b->setModel(tabModelFactory->getItemModel(harpicId)); + b->setCurrentIndex(b->findData(value)); } else if (function == FuncReset) { - b->setModel(dlgFilterFactory->getItemModel(funcResetParamId)); + b->setModel(tabFilterFactory->getItemModel(funcResetParamId)); b->setCurrentIndex(b->findData(value)); } else if (function == FuncVolume || function == FuncBacklight) { - b->setModel(dlgFilterFactory->getItemModel(rawSourceInputsId)); + b->setModel(tabFilterFactory->getItemModel(rawSourceInputsId)); b->setCurrentIndex(b->findData(value)); } else if (function == FuncPlayValue) { - b->setModel(dlgFilterFactory->getItemModel(rawSourceAllId)); + b->setModel(tabFilterFactory->getItemModel(rawSourceAllId)); b->setCurrentIndex(b->findData(value)); } else if (function >= FuncAdjustGV1 && function <= FuncAdjustGVLast) { switch (adjustmode) { case 1: - b->setModel(dlgFilterFactory->getItemModel(rawSourceInputsId)); + b->setModel(tabFilterFactory->getItemModel(rawSourceInputsId)); b->setCurrentIndex(b->findData(value)); if (b->currentIndex() < 0) b->setCurrentIndex(0); break; case 2: - b->setModel(dlgFilterFactory->getItemModel(rawSourceGVarsId)); + b->setModel(tabFilterFactory->getItemModel(rawSourceGVarsId)); b->setCurrentIndex(b->findData(value)); if (b->currentIndex() < 0) b->setCurrentIndex(0); diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index 7a1fd9c39..e74ce0d66 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -98,13 +98,16 @@ class CustomFunctionsPanel : public GenericPanel void resetCBsAndRefresh(int idx); void connectItemModelEvents(FilteredItemModel * itemModel); - FilteredItemModelFactory * dlgFilterFactory; + CompoundItemModelFactory * tabModelFactory; + FilteredItemModelFactory * tabFilterFactory; int funcActionsId; int funcResetParamId; int rawSwitchId; int rawSourceAllId; int rawSourceInputsId; int rawSourceGVarsId; + int playSoundId; + int harpicId; QSet tracksSet; QSet scriptsSet; From cb4ee1b30dd76d165f6f8ae9b34452216903dc60 Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 2 Mar 2021 22:23:31 +1100 Subject: [PATCH 086/188] Revert RepeatComboBox to standard ComboBox and add item model --- .../src/firmwares/customfunctiondata.cpp | 2 +- companion/src/modeledit/customfunctions.cpp | 62 +++---------------- companion/src/modeledit/customfunctions.h | 32 ++-------- 3 files changed, 16 insertions(+), 80 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 428e4eead..84e49ceb3 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -222,7 +222,7 @@ QString CustomFunctionData::repeatToString(int value) return tr("No repeat"); } else { - return tr("Repeat(%1s)").arg(value); + return tr("Repeat %1s").arg(value); } } diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index f2f2e07f1..6be75f28f 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -19,54 +19,11 @@ */ #include "customfunctions.h" -#include "compounditemmodels.h" -#include "filtereditemmodels.h" #include "helpers.h" #include "appdata.h" #include -RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam): - QComboBox(parent), - repeatParam(repeatParam) -{ - unsigned int step = 1; - int value = repeatParam / step; - - setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - - if (step == 1) { - addItem(tr("Played once, not during startup"), -1); - value++; - } - - addItem(tr("No repeat"), 0); - - for (unsigned int i = step; i <= 60; i += step) { - addItem(tr("%1s").arg(i), i); - } - - setCurrentIndex(value); - - connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int))); -} - -void RepeatComboBox::onIndexChanged(int index) -{ - repeatParam = itemData(index).toInt(); - emit modified(); -} - -void RepeatComboBox::update() -{ - unsigned int step = 1; - int value = repeatParam / step; - if (step == 1) { - value++; - } - setCurrentIndex(value); -} - CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware, CompoundItemModelFactory * sharedItemModels): GenericPanel(parent, model, generalSettings, firmware), @@ -81,6 +38,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, tabModelFactory = new CompoundItemModelFactory(&generalSettings, model); playSoundId = tabModelFactory->registerItemModel(CustomFunctionData::playSoundItemModel()); harpicId = tabModelFactory->registerItemModel(CustomFunctionData::harpicItemModel()); + repeatId = tabModelFactory->registerItemModel(CustomFunctionData::repeatItemModel()); tabFilterFactory = new FilteredItemModelFactory(); @@ -239,9 +197,12 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, QHBoxLayout * repeatLayout = new QHBoxLayout(); tableLayout->addLayout(i, 4, repeatLayout); - fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam); + fswtchRepeat[i] = new QComboBox(this); + fswtchRepeat[i]->setProperty("index", i); + fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId)); + fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); repeatLayout->addWidget(fswtchRepeat[i], i + 1); - connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onRepeatModified())); + connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); @@ -375,11 +336,6 @@ void CustomFunctionsPanel::functionEdited() } } -void CustomFunctionsPanel::onRepeatModified() -{ - emit modified(); -} - void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) { CustomFunctionData & cfn = functions[i]; @@ -480,8 +436,10 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) } else if (func == FuncPlaySound || func == FuncPlayHaptic || func == FuncPlayValue || func == FuncPlayPrompt || func == FuncPlayBoth || func == FuncBackgroundMusic) { if (func != FuncBackgroundMusic) { + if (modified) + cfn.repeatParam = fswtchRepeat[i]->currentData().toInt(); widgetsMask |= CUSTOM_FUNCTION_REPEAT; - fswtchRepeat[i]->update(); + fswtchRepeat[i]->setCurrentIndex(fswtchRepeat[i]->findData(cfn.repeatParam)); } if (func == FuncPlayValue) { if (modified) @@ -505,7 +463,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) if (modified) { if (fswtchParamGV[i]->isChecked()) { fswtchParam[i]->setMinimum(1); - cfn.param = std::min(fswtchParam[i]->value(),5.0)+(fswtchParamGV[i]->isChecked() ? 250 : 0); + cfn.param = std::min(fswtchParam[i]->value(), 5.0) + (fswtchParamGV[i]->isChecked() ? 250 : 0); } else { cfn.param = fswtchParam[i]->value(); diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index e74ce0d66..1085e78b1 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -18,39 +18,19 @@ * GNU General Public License for more details. */ -#ifndef _CUSTOMFUNCTIONS_H_ -#define _CUSTOMFUNCTIONS_H_ +#pragma once #include "modeledit.h" #include "eeprominterface.h" +#include "compounditemmodels.h" +#include "filtereditemmodels.h" #include -class CompoundItemModelFactory; -class FilteredItemModelFactory; -class FilteredItemModel; class TimerEdit; constexpr char MIMETYPE_CUSTOM_FUNCTION[] = "application/x-companion-custom-function"; -class RepeatComboBox: public QComboBox -{ - Q_OBJECT - - public: - RepeatComboBox(QWidget * parent, int & repeatParam); - void update(); - - signals: - void modified(); - - private slots: - void onIndexChanged(int); - - protected: - int & repeatParam; -}; - class CustomFunctionsPanel : public GenericPanel { Q_OBJECT @@ -69,7 +49,6 @@ class CustomFunctionsPanel : public GenericPanel void functionEdited(); void onCustomContextMenuRequested(QPoint pos); void refreshCustomFunction(int index, bool modified=false); - void onRepeatModified(); bool playSound(int index); void stopSound(int index); void toggleSound(bool play); @@ -108,6 +87,7 @@ class CustomFunctionsPanel : public GenericPanel int rawSourceGVarsId; int playSoundId; int harpicId; + int repeatId; QSet tracksSet; QSet scriptsSet; @@ -121,7 +101,7 @@ class CustomFunctionsPanel : public GenericPanel QComboBox * fswtchParamT[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchParamArmT[CPN_MAX_SPECIAL_FUNCTIONS]; QCheckBox * fswtchEnable[CPN_MAX_SPECIAL_FUNCTIONS]; - RepeatComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS]; + QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS]; QSlider * fswtchBLcolor[CPN_MAX_SPECIAL_FUNCTIONS]; QMediaPlayer * mediaPlayer; @@ -130,5 +110,3 @@ class CustomFunctionsPanel : public GenericPanel int fswCapability; int modelsUpdateCnt; }; - -#endif // _CUSTOMFUNCTIONS_H_ From f0d4c88f03551282a41df432467d478b3bbf57e6 Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 2 Mar 2021 23:17:21 +1100 Subject: [PATCH 087/188] Gvar adjust mode to item model --- .../src/firmwares/customfunctiondata.cpp | 45 ++++++++++++++++--- companion/src/firmwares/customfunctiondata.h | 8 +++- companion/src/modeledit/customfunctions.cpp | 17 ++----- companion/src/modeledit/customfunctions.h | 2 +- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 84e49ceb3..2cd9d27a2 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -314,10 +314,8 @@ QString CustomFunctionData::harpicToString(int value) // static QStringList CustomFunctionData::playSoundStringList() { - QStringList strl; - strl << tr("Beep 1") << tr("Beep 2") << tr("Beep 3") << tr("Warn 1") << tr("Warn 2") << tr("Cheep") << tr("Ratata") << tr("Tick") - << tr("Siren") << tr("Ring") << tr("Sci Fi") << tr("Robot") << tr("Chirp") << tr("Tada") << tr("Cricket") << tr("Alarm Clock"); - return strl; + return QStringList({ tr("Beep 1"), tr("Beep 2"), tr("Beep 3"), tr("Warn 1"), tr("Warn 2"), tr("Cheep"), tr("Ratata"), tr("Tick"), + tr("Siren"), tr("Ring"), tr("Sci Fi"), tr("Robot"), tr("Chirp"), tr("Tada"), tr("Cricket"), tr("Alarm Clock") }); } QString CustomFunctionData::playSoundToString() const @@ -328,13 +326,35 @@ QString CustomFunctionData::playSoundToString() const // static QString CustomFunctionData::playSoundToString(int value) { - QStringList strl = playSoundStringList(); + const QStringList strl = playSoundStringList(); if (value < strl.count()) return strl.at(value); else return QString(CPN_STR_UNKNOWN_ITEM); } +QString CustomFunctionData::gvarAdjustModeToString() const +{ + return gvarAdjustModeToString(adjustMode); +} + +// static +QString CustomFunctionData::gvarAdjustModeToString(int value) +{ + switch (value) { + case FUNC_ADJUST_GVAR_CONSTANT: + return tr("Value"); + case FUNC_ADJUST_GVAR_SOURCE: + return tr("Source"); + case FUNC_ADJUST_GVAR_GVAR: + return tr("GVAR"); + case FUNC_ADJUST_GVAR_INCDEC: + return tr("Increment"); + default: + return QString(CPN_STR_UNKNOWN_ITEM); + } +} + // static AbstractStaticItemModel * CustomFunctionData::repeatItemModel() { @@ -353,7 +373,7 @@ AbstractStaticItemModel * CustomFunctionData::repeatItemModel() AbstractStaticItemModel * CustomFunctionData::playSoundItemModel() { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); - mdl->setName("customfunctiondata.playsounds"); + mdl->setName("customfunctiondata.playsound"); for (int i = 0; i < playSoundStringList().count(); i++) { mdl->appendToItemList(playSoundToString(i), i); @@ -377,3 +397,16 @@ AbstractStaticItemModel * CustomFunctionData::harpicItemModel() return mdl; } +// static +AbstractStaticItemModel * CustomFunctionData::gvarAdjustModeItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("customfunctiondata.gvaradjustmode"); + + for (int i = 0; i < FUNC_ADJUST_GVAR_COUNT; i++) { + mdl->appendToItemList(gvarAdjustModeToString(i), i); + } + + mdl->loadItemList(); + return mdl; +} diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 2301e6567..949ac9ee5 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -78,7 +78,8 @@ enum GVarAdjustModes FUNC_ADJUST_GVAR_CONSTANT, FUNC_ADJUST_GVAR_SOURCE, FUNC_ADJUST_GVAR_GVAR, - FUNC_ADJUST_GVAR_INCDEC + FUNC_ADJUST_GVAR_INCDEC, + FUNC_ADJUST_GVAR_COUNT }; class CustomFunctionData { @@ -113,18 +114,21 @@ class CustomFunctionData { QString enabledToString() const; QString playSoundToString() const; QString harpicToString() const; + QString gvarAdjustModeToString() const; static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value); static bool isFuncAvailable(int index); static int funcContext(int index); static int resetParamCount(const ModelData * model); static bool isResetParamAvailable(const ModelData * model, int index); - static QString repeatToString(int value); static QStringList playSoundStringList(); static QString playSoundToString(int value); static QString harpicToString(int value); + static QStringList gvarAdjustModeStringList(); + static QString gvarAdjustModeToString(int value); static AbstractStaticItemModel * repeatItemModel(); static AbstractStaticItemModel * playSoundItemModel(); static AbstractStaticItemModel * harpicItemModel(); + static AbstractStaticItemModel * gvarAdjustModeItemModel(); }; diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 6be75f28f..05eefb96b 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -39,6 +39,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, playSoundId = tabModelFactory->registerItemModel(CustomFunctionData::playSoundItemModel()); harpicId = tabModelFactory->registerItemModel(CustomFunctionData::harpicItemModel()); repeatId = tabModelFactory->registerItemModel(CustomFunctionData::repeatItemModel()); + gvarAdjustModeId = tabModelFactory->registerItemModel(CustomFunctionData::gvarAdjustModeItemModel()); tabFilterFactory = new FilteredItemModelFactory(); @@ -140,7 +141,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchGVmode[i] = new QComboBox(this); fswtchGVmode[i]->setProperty("index", i); - populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode); + fswtchGVmode[i]->setModel(tabModelFactory->getItemModel(gvarAdjustModeId)); fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchGVmode[i]); @@ -382,8 +383,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast) { int gvidx = func - FuncAdjustGV1; if (modified) - cfn.adjustMode = fswtchGVmode[i]->currentIndex(); - fswtchGVmode[i]->setCurrentIndex(cfn.adjustMode); + cfn.adjustMode = fswtchGVmode[i]->currentData().toInt(); + fswtchGVmode[i]->setCurrentIndex(fswtchGVmode[i]->findData(cfn.adjustMode)); widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE; if (cfn.adjustMode == FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode == FUNC_ADJUST_GVAR_INCDEC) { if (modified) @@ -623,16 +624,6 @@ void CustomFunctionsPanel::onCustomContextMenuRequested(QPoint pos) contextMenu.exec(globalPos); } -void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value) -{ - b->clear(); - b->addItem(tr("Value")); - b->addItem(tr("Source")); - b->addItem(tr("GVAR")); - b->addItem(tr("Increment")); - b->setCurrentIndex(value); -} - void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode) { QStringList qs; diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index 1085e78b1..6d1668114 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -67,7 +67,6 @@ class CustomFunctionsPanel : public GenericPanel void onItemModelUpdateComplete(); private: - void populateGVmodeCB(QComboBox *b, unsigned int value); void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0); bool hasClipboardData(QByteArray * data = nullptr) const; bool insertAllowed() const; @@ -88,6 +87,7 @@ class CustomFunctionsPanel : public GenericPanel int playSoundId; int harpicId; int repeatId; + int gvarAdjustModeId; QSet tracksSet; QSet scriptsSet; From 263d2854a74c804fa98fb16f176fab91c28757c3 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 3 Mar 2021 07:24:43 +1100 Subject: [PATCH 088/188] Housekeeping --- companion/src/firmwares/customfunctiondata.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 2cd9d27a2..8d2d4e87c 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -178,8 +178,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const return QString(CPN_STR_UNKNOWN_ITEM); } else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) { - RawSource item(param); - return item.toString(model); + return RawSource(param).toString(model); } else if (func == FuncPlayPrompt || func == FuncPlayBoth) { if ( getCurrentFirmware()->getCapability(VoicesAsNumbers)) { @@ -192,16 +191,14 @@ QString CustomFunctionData::paramToString(const ModelData * model) const else if (func >= FuncAdjustGV1 && func < FuncCount) { switch (adjustMode) { case FUNC_ADJUST_GVAR_CONSTANT: - return tr("Value") + QString(" %1").arg(param); + return gvarAdjustModeToString(adjustMode) + QString(" %1").arg(param); case FUNC_ADJUST_GVAR_SOURCE: case FUNC_ADJUST_GVAR_GVAR: return RawSource(param).toString(); case FUNC_ADJUST_GVAR_INCDEC: - float val; - QString unit; - val = param * model->gvarData[func - FuncAdjustGV1].multiplierGet(); - unit = model->gvarData[func - FuncAdjustGV1].unitToString(); - return tr("Increment") + QString(": %1%2").arg(val).arg(unit); + const float val = param * model->gvarData[func - FuncAdjustGV1].multiplierGet(); + const QString unit = model->gvarData[func - FuncAdjustGV1].unitToString(); + return gvarAdjustModeToString(adjustMode) + QString(": %1%2").arg(val).arg(unit); } } return ""; @@ -347,7 +344,7 @@ QString CustomFunctionData::gvarAdjustModeToString(int value) case FUNC_ADJUST_GVAR_SOURCE: return tr("Source"); case FUNC_ADJUST_GVAR_GVAR: - return tr("GVAR"); + return tr("Global Variable"); case FUNC_ADJUST_GVAR_INCDEC: return tr("Increment"); default: From 6feb5a3ca985ed35326d4d818e4c9c9d3c8e5f2e Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 3 Mar 2021 08:51:54 +1100 Subject: [PATCH 089/188] Refactor reset param functions --- .../src/datamodels/compounditemmodels.cpp | 4 +- .../src/firmwares/customfunctiondata.cpp | 94 +++++++++---------- companion/src/firmwares/customfunctiondata.h | 4 +- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index 039e90244..f47741341 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -447,7 +447,7 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin setId(IMID_CustomFuncResetParam); setUpdateMask(IMUE_TeleSensors); - for (int i = 0; i < CustomFunctionData::resetParamCount(modelData); i++) { + for (int i = 0; i < CustomFunctionData::resetParamCount(); i++) { QStandardItem * modelItem = new QStandardItem(); modelItem->setData(i, IMDR_Id); setDynamicItemData(modelItem, i); @@ -459,7 +459,7 @@ void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, con { CustomFunctionData cfd = CustomFunctionData(AssignFunc::FuncReset); cfd.param = value; - item->setText(cfd.paramToString(modelData)); + item->setText(CustomFunctionData::resetToString(modelData)); item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available); } diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 8d2d4e87c..aa2f64bbd 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -117,42 +117,6 @@ QString CustomFunctionData::funcToString(const ModelData * model) const } } -void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0) -{ - int val = 0; - Firmware * firmware = Firmware::getCurrentVariant(); - - for (int i = 0; i < CPN_MAX_TIMERS; i++, val++) { - if (i < firmware->getCapability(Timers)) { - RawSource item = RawSource(SOURCE_TYPE_SPECIAL, i + SOURCE_TYPE_SPECIAL_TIMER1_IDX); - b->addItem(item.toString(model), val); - } - } - - b->addItem(tr("Flight"), val++); - b->addItem(tr("Telemetry"), val++); - - int reCount = firmware->getCapability(RotaryEncoders); - if (reCount == 1) { - b->addItem(tr("Rotary Encoder"), val++); - } - else if (reCount == 2) { - b->addItem(tr("REa"), val++); - b->addItem(tr("REb"), val++); - } - - if (model) { - for (int i = 0; i < firmware->getCapability(Sensors); ++i) { - if (model->sensorData[i].isAvailable()) { - RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3 * i); - b->addItem(item.toString(model), val + i); - } - } - } - - b->setCurrentIndex(b->findData(value)); -} - QString CustomFunctionData::paramToString(const ModelData * model) const { QStringList qs; @@ -169,13 +133,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const return harpicToString(param); } else if (func == FuncReset) { - QComboBox cb; - CustomFunctionData::populateResetParams(model, &cb); - int pos = cb.findData(param); - if (pos >= 0) - return cb.itemText(pos); - else - return QString(CPN_STR_UNKNOWN_ITEM); + return resetToString(model, param); } else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) { return RawSource(param).toString(model); @@ -270,12 +228,54 @@ int CustomFunctionData::funcContext(int index) return ret; } + // static -int CustomFunctionData::resetParamCount(const ModelData * model) +QString CustomFunctionData::resetToString(const ModelData * model, int value) { - QComboBox cb; - CustomFunctionData::populateResetParams(model, &cb); - return cb.count(); + Firmware * firmware = getCurrentFirmware(); + int step = CPN_MAX_TIMERS; + + if (value < step) { + if (value < firmware->getCapability(Timers)) + return RawSource(SOURCE_TYPE_SPECIAL, value + SOURCE_TYPE_SPECIAL_TIMER1_IDX).toString(model); + else + return QString(CPN_STR_UNKNOWN_ITEM); + } + + if (value < ++step) + return tr("Flight"); + + if (value < ++step) + return tr("Telemetry"); + + int reCount = firmware->getCapability(RotaryEncoders); + + if (reCount > 0 && value < step + reCount) { + if (reCount == 1 && value < step + 1) + return tr("Rotary Encoder"); + else if (reCount == 2) { + if (value < step + 1) + return tr("REa"); + else + return tr("REb"); + } + else + return QString(CPN_STR_UNKNOWN_ITEM); + } + step += reCount; + + if (value < step + firmware->getCapability(Sensors)) + return RawSource(SOURCE_TYPE_TELEMETRY, 3 * (value - step)).toString(model); + + return QString(CPN_STR_UNKNOWN_ITEM); +} + +// static +int CustomFunctionData::resetParamCount() +{ + Firmware * firmware = getCurrentFirmware(); + + return CPN_MAX_TIMERS + 2 + firmware->getCapability(RotaryEncoders) + firmware->getCapability(Sensors); } // static diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 949ac9ee5..3240256f3 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -116,10 +116,10 @@ class CustomFunctionData { QString harpicToString() const; QString gvarAdjustModeToString() const; - static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value); static bool isFuncAvailable(int index); static int funcContext(int index); - static int resetParamCount(const ModelData * model); + static QString resetToString(const ModelData * model, int value); + static int resetParamCount(); static bool isResetParamAvailable(const ModelData * model, int index); static QString repeatToString(int value); static QStringList playSoundStringList(); From c78a784236d3a5cb0b90ed0cb8ce9710bebd9028 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 3 Mar 2021 23:29:23 +1100 Subject: [PATCH 090/188] Compile and other tweaks --- companion/src/datamodels/compounditemmodels.cpp | 4 +--- companion/src/datamodels/compounditemmodels.h | 5 +---- companion/src/firmwares/customfunctiondata.cpp | 5 +++-- companion/src/modeledit/customfunctions.cpp | 13 ++++++++----- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index f47741341..24aac5aa9 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -457,9 +457,7 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const { - CustomFunctionData cfd = CustomFunctionData(AssignFunc::FuncReset); - cfd.param = value; - item->setText(CustomFunctionData::resetToString(modelData)); + item->setText(CustomFunctionData::resetToString(modelData, value)); item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available); } diff --git a/companion/src/datamodels/compounditemmodels.h b/companion/src/datamodels/compounditemmodels.h index de32fc902..c6d204cb3 100644 --- a/companion/src/datamodels/compounditemmodels.h +++ b/companion/src/datamodels/compounditemmodels.h @@ -18,8 +18,7 @@ * GNU General Public License for more details. */ -#ifndef COMPOUNDITEMMODELS_H -#define COMPOUNDITEMMODELS_H +#pragma once #include "rawsource.h" #include "rawswitch.h" @@ -361,5 +360,3 @@ class CompoundItemModelFactory private: void setSourceId(AbstractItemModel * itemModel); }; - -#endif // COMPOUNDITEMMODELS_H diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index aa2f64bbd..b5bece769 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -262,6 +262,7 @@ QString CustomFunctionData::resetToString(const ModelData * model, int value) else return QString(CPN_STR_UNKNOWN_ITEM); } + step += reCount; if (value < step + firmware->getCapability(Sensors)) @@ -291,8 +292,8 @@ bool CustomFunctionData::isResetParamAvailable(const ModelData * model, int inde } else if (index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders)) return true; - else if (model && index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders) + firmware->getCapability(Sensors)) - return model->sensorData[index - CPN_MAX_TIMERS - firmware->getCapability(RotaryEncoders)].isAvailable(); + else if (model && index < resetParamCount()) + return model->sensorData[index - (CPN_MAX_TIMERS + 2 + firmware->getCapability(RotaryEncoders))].isAvailable(); return false; } diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 05eefb96b..7f3e8ee19 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -99,7 +99,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, playIcon.addImage("stop.png", QIcon::Normal, QIcon::On); QStringList headerLabels; - headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable"); + headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << ""; TableLayout * tableLayout = new TableLayout(this, fswCapability, headerLabels); for (int i = 0; i < fswCapability; i++) { @@ -119,19 +119,21 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, // The switch fswtchSwtch[i] = new QComboBox(this); + fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setModel(tabFilterFactory->getItemModel(rawSwitchId)); fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(functions[i].swtch.toValue())); - fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); + fswtchSwtch[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); fswtchSwtch[i]->setMaxVisibleItems(10); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); tableLayout->addWidget(i, 1, fswtchSwtch[i]); // The function fswtchFunc[i] = new QComboBox(this); + fswtchFunc[i]->setProperty("index", i); fswtchFunc[i]->setModel(tabFilterFactory->getItemModel(funcActionsId)); fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func)); - fswtchFunc[i]->setProperty("index", i); + fswtchFunc[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); tableLayout->addWidget(i, 2, fswtchFunc[i]); @@ -148,8 +150,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchParamGV[i] = new QCheckBox(this); fswtchParamGV[i]->setProperty("index", i); - fswtchParamGV[i]->setText("GV"); - fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); + fswtchParamGV[i]->setText(tr("GV")); + fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamGV[i]); @@ -202,6 +204,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchRepeat[i]->setProperty("index", i); fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId)); fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); + fswtchRepeat[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); repeatLayout->addWidget(fswtchRepeat[i], i + 1); connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); From 6c3f7b1ca64b324bdade41ae2ba7368bea52cba0 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 4 Mar 2021 07:59:24 +1100 Subject: [PATCH 091/188] Consistency and statics --- .../src/datamodels/compounditemmodels.cpp | 6 ++--- .../src/firmwares/customfunctiondata.cpp | 27 ++++++++++++------- companion/src/firmwares/customfunctiondata.h | 21 ++++++++------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index 24aac5aa9..83e046c13 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -420,7 +420,7 @@ CustomFuncActionItemModel::CustomFuncActionItemModel(const GeneralSettings * con void CustomFuncActionItemModel::setDynamicItemData(QStandardItem * item, const int value) const { - item->setText(CustomFunctionData(AssignFunc(value)).funcToString(modelData)); + item->setText(CustomFunctionData::funcToString((AssignFunc)value, modelData)); item->setData(CustomFunctionData::isFuncAvailable(value), IMDR_Available); } @@ -457,8 +457,8 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const { - item->setText(CustomFunctionData::resetToString(modelData, value)); - item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available); + item->setText(CustomFunctionData::resetToString(value, modelData)); + item->setData(CustomFunctionData::isResetParamAvailable(value, modelData), IMDR_Available); } void CustomFuncResetParamItemModel::update(const int event) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index b5bece769..43fd3c149 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -47,12 +47,19 @@ bool CustomFunctionData::isEmpty() const return (swtch.type == SWITCH_TYPE_NONE); } -QString CustomFunctionData::nameToString(int index, bool globalContext) const +// static +QString CustomFunctionData::nameToString(const int index, const bool globalContext) { return RadioData::getElementName((globalContext ? tr("GF") : tr("SF")), index + 1, 0, true); } QString CustomFunctionData::funcToString(const ModelData * model) const +{ + return funcToString(func, model); +} + +// static +QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData * model) { if (func >= FuncOverrideCH1 && func <= FuncOverrideCHLast) return tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model)); @@ -133,7 +140,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const return harpicToString(param); } else if (func == FuncReset) { - return resetToString(model, param); + return resetToString(param, model); } else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) { return RawSource(param).toString(model); @@ -168,7 +175,7 @@ QString CustomFunctionData::repeatToString() const } // static -QString CustomFunctionData::repeatToString(int value) +QString CustomFunctionData::repeatToString(const int value) { if (value == -1) { return tr("Played once, not during startup"); @@ -198,7 +205,7 @@ QString CustomFunctionData::enabledToString() const } // static -bool CustomFunctionData::isFuncAvailable(int index) +bool CustomFunctionData::isFuncAvailable(const int index) { Firmware * fw = getCurrentFirmware(); @@ -217,7 +224,7 @@ bool CustomFunctionData::isFuncAvailable(int index) } // static -int CustomFunctionData::funcContext(int index) +int CustomFunctionData::funcContext(const int index) { int ret = AllFunctionContexts; @@ -230,7 +237,7 @@ int CustomFunctionData::funcContext(int index) } // static -QString CustomFunctionData::resetToString(const ModelData * model, int value) +QString CustomFunctionData::resetToString(const int value, const ModelData * model) { Firmware * firmware = getCurrentFirmware(); int step = CPN_MAX_TIMERS; @@ -280,7 +287,7 @@ int CustomFunctionData::resetParamCount() } // static -bool CustomFunctionData::isResetParamAvailable(const ModelData * model, int index) +bool CustomFunctionData::isResetParamAvailable(const int index, const ModelData * model) { Firmware * firmware = getCurrentFirmware(); @@ -304,7 +311,7 @@ QString CustomFunctionData::harpicToString() const } // static -QString CustomFunctionData::harpicToString(int value) +QString CustomFunctionData::harpicToString(const int value) { return QString("%1").arg(value); } @@ -322,7 +329,7 @@ QString CustomFunctionData::playSoundToString() const } // static -QString CustomFunctionData::playSoundToString(int value) +QString CustomFunctionData::playSoundToString(const int value) { const QStringList strl = playSoundStringList(); if (value < strl.count()) @@ -337,7 +344,7 @@ QString CustomFunctionData::gvarAdjustModeToString() const } // static -QString CustomFunctionData::gvarAdjustModeToString(int value) +QString CustomFunctionData::gvarAdjustModeToString(const int value) { switch (value) { case FUNC_ADJUST_GVAR_CONSTANT: diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 3240256f3..d5a08a96f 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -107,26 +107,27 @@ class CustomFunctionData { void clear(); bool isEmpty() const; - QString nameToString(int index, bool globalContext = false) const; QString funcToString(const ModelData * model = nullptr) const; - QString paramToString(const ModelData * model) const; + QString paramToString(const ModelData * model = nullptr) const; QString repeatToString() const; QString enabledToString() const; QString playSoundToString() const; QString harpicToString() const; QString gvarAdjustModeToString() const; - static bool isFuncAvailable(int index); - static int funcContext(int index); - static QString resetToString(const ModelData * model, int value); + static QString nameToString(const int index, const bool globalContext = false); + static QString funcToString(const AssignFunc func, const ModelData * model = nullptr); + static bool isFuncAvailable(const int index); + static int funcContext(const int index); + static QString resetToString(const int value, const ModelData * model = nullptr); static int resetParamCount(); - static bool isResetParamAvailable(const ModelData * model, int index); - static QString repeatToString(int value); + static bool isResetParamAvailable(const int index, const ModelData * model = nullptr); + static QString repeatToString(const int value); static QStringList playSoundStringList(); - static QString playSoundToString(int value); - static QString harpicToString(int value); + static QString playSoundToString(const int value); + static QString harpicToString(const int value); static QStringList gvarAdjustModeStringList(); - static QString gvarAdjustModeToString(int value); + static QString gvarAdjustModeToString(const int value); static AbstractStaticItemModel * repeatItemModel(); static AbstractStaticItemModel * playSoundItemModel(); static AbstractStaticItemModel * harpicItemModel(); From 3ba689d98927182ee39e1eff5202e56fbe4b1076 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 4 Mar 2021 08:05:15 +1100 Subject: [PATCH 092/188] Remove unused slider --- companion/src/modeledit/customfunctions.cpp | 11 ----------- companion/src/modeledit/customfunctions.h | 1 - 2 files changed, 12 deletions(-) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 7f3e8ee19..c773e90e5 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -182,15 +182,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); - fswtchBLcolor[i] = new QSlider(this); - fswtchBLcolor[i]->setProperty("index", i); - fswtchBLcolor[i]->setMinimum(0); - fswtchBLcolor[i]->setMaximum(100); - fswtchBLcolor[i]->setSingleStep(1); - fswtchBLcolor[i]->setOrientation(Qt::Horizontal); - paramLayout->addWidget(fswtchBLcolor[i]); - connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); - playBT[i] = new QToolButton(this); playBT[i]->setProperty("index", i); playBT[i]->setIcon(playIcon); @@ -310,7 +301,6 @@ void CustomFunctionsPanel::toggleSound(bool play) #define CUSTOM_FUNCTION_ENABLE (1<<6) #define CUSTOM_FUNCTION_REPEAT (1<<7) #define CUSTOM_FUNCTION_PLAY (1<<8) -#define CUSTOM_FUNCTION_BL_COLOR (1<<9) #define CUSTOM_FUNCTION_SHOW_FUNC (1<<10) @@ -551,7 +541,6 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchEnable[i]->setChecked(false); fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT); fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE); - fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR); playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY); } diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index 6d1668114..87775246d 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -103,7 +103,6 @@ class CustomFunctionsPanel : public GenericPanel QCheckBox * fswtchEnable[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS]; - QSlider * fswtchBLcolor[CPN_MAX_SPECIAL_FUNCTIONS]; QMediaPlayer * mediaPlayer; int selectedIndex; From 227b225deaf778a60ce9641edf29bf098992028b Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 4 Mar 2021 08:22:45 +1100 Subject: [PATCH 093/188] Consistency with radio --- companion/src/firmwares/customfunctiondata.cpp | 4 ++-- companion/src/modeledit/customfunctions.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 43fd3c149..d78c1a349 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -94,7 +94,7 @@ QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData else if (func == FuncPlayValue) return tr("Play Value"); else if (func == FuncPlayScript) - return tr("Play Script"); + return tr("Lua Script"); else if (func == FuncLogs) return tr("SD Logs"); else if (func == FuncVolume) @@ -354,7 +354,7 @@ QString CustomFunctionData::gvarAdjustModeToString(const int value) case FUNC_ADJUST_GVAR_GVAR: return tr("Global Variable"); case FUNC_ADJUST_GVAR_INCDEC: - return tr("Increment"); + return tr("Inc/Decrement"); default: return QString(CPN_STR_UNKNOWN_ITEM); } diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index c773e90e5..230cf5e4c 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -201,7 +201,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); - fswtchEnable[i]->setText(tr("ON")); + fswtchEnable[i]->setText(tr("Enable")); fswtchEnable[i]->setFixedWidth(200); repeatLayout->addWidget(fswtchEnable[i], i + 1); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); From fc03ba58d08302bab895178b26d6908b9df855bb Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 4 Mar 2021 08:25:47 +1100 Subject: [PATCH 094/188] Revert enable label --- companion/src/modeledit/customfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 230cf5e4c..c773e90e5 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -201,7 +201,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); - fswtchEnable[i]->setText(tr("Enable")); + fswtchEnable[i]->setText(tr("ON")); fswtchEnable[i]->setFixedWidth(200); repeatLayout->addWidget(fswtchEnable[i], i + 1); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); From 19add4de921d6f143c07ab6657818dd0683d4673 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 4 Mar 2021 08:47:21 +1100 Subject: [PATCH 095/188] Remove some depreciated Rotary Encoder code --- .../src/datamodels/compounditemmodels.cpp | 3 --- .../src/firmwares/customfunctiondata.cpp | 23 +++---------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index 83e046c13..f72eb4f34 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -109,7 +109,6 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett addItems(SOURCE_TYPE_LUA_OUTPUT, RawSource::ScriptsGroup, firmware->getCapability(LuaOutputsPerScript), i * 16); addItems(SOURCE_TYPE_VIRTUAL_INPUT, RawSource::InputsGroup, firmware->getCapability(VirtualInputs)); addItems(SOURCE_TYPE_STICK, RawSource::SourcesGroup, board->getCapability(Board::MaxAnalogs)); - addItems(SOURCE_TYPE_ROTARY_ENCODER, RawSource::SourcesGroup, firmware->getCapability(RotaryEncoders)); addItems(SOURCE_TYPE_TRIM, RawSource::TrimsGroup, board->getCapability(Board::NumTrims)); addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, 1); addItems(SOURCE_TYPE_SWITCH, RawSource::SwitchesGroup, board->getCapability(Board::Switches)); @@ -170,7 +169,6 @@ RawSwitchItemModel::RawSwitchItemModel(const GeneralSettings * const generalSett addItems(SWITCH_TYPE_TELEMETRY, -1); addItems(SWITCH_TYPE_FLIGHT_MODE, -firmware->getCapability(FlightModes)); addItems(SWITCH_TYPE_VIRTUAL, -firmware->getCapability(LogicalSwitches)); - addItems(SWITCH_TYPE_ROTARY_ENCODER, -firmware->getCapability(RotaryEncoders)); addItems(SWITCH_TYPE_TRIM, -board->getCapability(Board::NumTrimSwitches)); addItems(SWITCH_TYPE_MULTIPOS_POT, -(board->getCapability(Board::MultiposPots) * board->getCapability(Board::MultiposPotsPositions))); addItems(SWITCH_TYPE_SWITCH, -board->getCapability(Board::SwitchPositions)); @@ -181,7 +179,6 @@ RawSwitchItemModel::RawSwitchItemModel(const GeneralSettings * const generalSett addItems(SWITCH_TYPE_SWITCH, board->getCapability(Board::SwitchPositions)); addItems(SWITCH_TYPE_MULTIPOS_POT, board->getCapability(Board::MultiposPots) * board->getCapability(Board::MultiposPotsPositions)); addItems(SWITCH_TYPE_TRIM, board->getCapability(Board::NumTrimSwitches)); - addItems(SWITCH_TYPE_ROTARY_ENCODER, firmware->getCapability(RotaryEncoders)); addItems(SWITCH_TYPE_VIRTUAL, firmware->getCapability(LogicalSwitches)); addItems(SWITCH_TYPE_FLIGHT_MODE, firmware->getCapability(FlightModes)); addItems(SWITCH_TYPE_TELEMETRY, 1); diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index d78c1a349..98157cae2 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -255,23 +255,6 @@ QString CustomFunctionData::resetToString(const int value, const ModelData * mod if (value < ++step) return tr("Telemetry"); - int reCount = firmware->getCapability(RotaryEncoders); - - if (reCount > 0 && value < step + reCount) { - if (reCount == 1 && value < step + 1) - return tr("Rotary Encoder"); - else if (reCount == 2) { - if (value < step + 1) - return tr("REa"); - else - return tr("REb"); - } - else - return QString(CPN_STR_UNKNOWN_ITEM); - } - - step += reCount; - if (value < step + firmware->getCapability(Sensors)) return RawSource(SOURCE_TYPE_TELEMETRY, 3 * (value - step)).toString(model); @@ -283,7 +266,7 @@ int CustomFunctionData::resetParamCount() { Firmware * firmware = getCurrentFirmware(); - return CPN_MAX_TIMERS + 2 + firmware->getCapability(RotaryEncoders) + firmware->getCapability(Sensors); + return CPN_MAX_TIMERS + 2 + firmware->getCapability(Sensors); } // static @@ -297,10 +280,10 @@ bool CustomFunctionData::isResetParamAvailable(const int index, const ModelData else return false; } - else if (index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders)) + else if (index < CPN_MAX_TIMERS + 2) return true; else if (model && index < resetParamCount()) - return model->sensorData[index - (CPN_MAX_TIMERS + 2 + firmware->getCapability(RotaryEncoders))].isAvailable(); + return model->sensorData[index - (CPN_MAX_TIMERS + 2)].isAvailable(); return false; } From 3062490dacb4facc9ae8b2e51a5931b35e218ad9 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 5 Mar 2021 10:39:03 +0100 Subject: [PATCH 096/188] Update CREDITS.txt --- CREDITS.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 1fa8b356a..64b706c70 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2166,3 +2166,7 @@ Glenn Harvey Albrecht Friebel Gunter Klemke Travis McCarthy +Franz Zier +Ian Contessa +Sean Sadler +Richard F Janczak From f8498ddf86f37ecf4a1eb962dec0776d220984dc Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 5 Mar 2021 10:39:30 +0100 Subject: [PATCH 097/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 64b706c70..8d20bdd78 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2170,3 +2170,4 @@ Franz Zier Ian Contessa Sean Sadler Richard F Janczak +Mateusz Dziadosz From 9ae4184240207b37158f5d37226b2be307e1d2c0 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 5 Mar 2021 23:13:43 +0100 Subject: [PATCH 098/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8d20bdd78..5104a3af0 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2171,3 +2171,4 @@ Ian Contessa Sean Sadler Richard F Janczak Mateusz Dziadosz +Thomas Merchant From 5b0de67d5d7ea5720d104cc4a56ee6548e1e5bec Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 5 Mar 2021 23:24:29 +0100 Subject: [PATCH 099/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 5104a3af0..63b59bbca 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2172,3 +2172,4 @@ Sean Sadler Richard F Janczak Mateusz Dziadosz Thomas Merchant +M L Perkins From 694355c1b4484f196bbcb80e83760eec6178e1d6 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 6 Mar 2021 20:01:15 +0100 Subject: [PATCH 100/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 63b59bbca..8965152da 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2173,3 +2173,4 @@ Richard F Janczak Mateusz Dziadosz Thomas Merchant M L Perkins +Stefano Boggia From ea301e44edcb1f5a51fd59ee476f2c7e952facda Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 7 Mar 2021 10:14:12 +1100 Subject: [PATCH 101/188] Refactor io_data.h and cpp into separate xdata h and cpp files --- companion/src/firmwares/CMakeLists.txt | 7 +- companion/src/firmwares/curvedata.cpp | 48 +++++ companion/src/firmwares/curvedata.h | 56 +++++ .../{io_data.cpp => flightmodedata.cpp} | 121 +---------- companion/src/firmwares/flightmodedata.h | 59 ++++++ companion/src/firmwares/heli_data.cpp | 21 ++ companion/src/firmwares/heli_data.h | 44 ++++ companion/src/firmwares/input_data.cpp | 35 +++ companion/src/firmwares/input_data.h | 61 ++++++ companion/src/firmwares/io_data.h | 199 ------------------ companion/src/firmwares/mixdata.cpp | 35 +++ companion/src/firmwares/mixdata.h | 65 ++++++ companion/src/firmwares/modeldata.h | 12 +- companion/src/firmwares/output_data.cpp | 60 ++++++ companion/src/firmwares/output_data.h | 52 +++++ 15 files changed, 554 insertions(+), 321 deletions(-) create mode 100644 companion/src/firmwares/curvedata.cpp create mode 100644 companion/src/firmwares/curvedata.h rename companion/src/firmwares/{io_data.cpp => flightmodedata.cpp} (56%) create mode 100644 companion/src/firmwares/flightmodedata.h create mode 100644 companion/src/firmwares/heli_data.cpp create mode 100644 companion/src/firmwares/heli_data.h create mode 100644 companion/src/firmwares/input_data.cpp create mode 100644 companion/src/firmwares/input_data.h delete mode 100644 companion/src/firmwares/io_data.h create mode 100644 companion/src/firmwares/mixdata.cpp create mode 100644 companion/src/firmwares/mixdata.h create mode 100644 companion/src/firmwares/output_data.cpp create mode 100644 companion/src/firmwares/output_data.h diff --git a/companion/src/firmwares/CMakeLists.txt b/companion/src/firmwares/CMakeLists.txt index bf05bc44d..3bc2ca275 100644 --- a/companion/src/firmwares/CMakeLists.txt +++ b/companion/src/firmwares/CMakeLists.txt @@ -2,16 +2,21 @@ set(firmwares_SRCS adjustmentreference.cpp boards.cpp + curvedata.cpp curvereference.cpp customfunctiondata.cpp eeprominterface.cpp generalsettings.cpp gvardata.cpp - io_data.cpp + input_data.cpp + flightmodedata.cpp + heli_data.cpp logicalswitchdata.cpp + mixdata.cpp modeldata.cpp moduledata.cpp multiprotocols.cpp + output_data.cpp radiodata.cpp radiodataconversionstate.cpp rawsource.cpp diff --git a/companion/src/firmwares/curvedata.cpp b/companion/src/firmwares/curvedata.cpp new file mode 100644 index 000000000..c32eac4cc --- /dev/null +++ b/companion/src/firmwares/curvedata.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "curvedata.h" +#include "radiodata.h" + +CurveData::CurveData() +{ + clear(); +} + +void CurveData::clear(int count) +{ + memset(reinterpret_cast(this), 0, sizeof(CurveData)); + this->count = count; +} + +bool CurveData::isEmpty() const +{ + for (int i = 0; i < count; i++) { + if (points[i].y != 0) { + return false; + } + } + return true; +} + +QString CurveData::nameToString(const int idx) const +{ + return RadioData::getElementName(tr("CV"), idx + 1, name); +} diff --git a/companion/src/firmwares/curvedata.h b/companion/src/firmwares/curvedata.h new file mode 100644 index 000000000..cb083375e --- /dev/null +++ b/companion/src/firmwares/curvedata.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "constants.h" + +#include + +class CurvePoint { + public: + int8_t x; + int8_t y; +}; + +#define CURVEDATA_NAME_LEN 6 + +class CurveData { + Q_DECLARE_TR_FUNCTIONS(CurveData) + + public: + enum CurveType { + CURVE_TYPE_STANDARD, + CURVE_TYPE_CUSTOM, + CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM + }; + + CurveData(); + + CurveType type; + bool smooth; + int count; + CurvePoint points[CPN_MAX_POINTS]; + char name[CURVEDATA_NAME_LEN + 1]; + + void clear(int count = 5); + bool isEmpty() const; + QString nameToString(const int idx) const; +}; diff --git a/companion/src/firmwares/io_data.cpp b/companion/src/firmwares/flightmodedata.cpp similarity index 56% rename from companion/src/firmwares/io_data.cpp rename to companion/src/firmwares/flightmodedata.cpp index a958750d8..c0a268e96 100644 --- a/companion/src/firmwares/io_data.cpp +++ b/companion/src/firmwares/flightmodedata.cpp @@ -18,121 +18,17 @@ * GNU General Public License for more details. */ -#include "io_data.h" - -#include "radiodata.h" // for RadioData::getElementName +#include "flightmodedata.h" +#include "radiodata.h" #include "radiodataconversionstate.h" -/* - * ExpoData - */ - -void ExpoData::convert(RadioDataConversionState & cstate) +void FlightModeData::convert(RadioDataConversionState & cstate) { - cstate.setComponent(tr("INP"), 3); - cstate.setSubComp(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, chn).toString(cstate.fromModel(), cstate.fromGS(), cstate.fromType) % tr(" (@%1)").arg(cstate.subCompIdx)); - srcRaw.convert(cstate); + cstate.setComponent("FMD", 2); + cstate.setSubComp(nameToString(cstate.subCompIdx)); swtch.convert(cstate); } -bool ExpoData::isEmpty() const -{ - return (chn == 0 && mode == INPUT_MODE_NONE); -} - -/* - * MixData - */ - -void MixData::convert(RadioDataConversionState & cstate) -{ - cstate.setComponent(tr("MIX"), 4); - cstate.setSubComp(RawSource(SOURCE_TYPE_CH, destCh-1).toString(cstate.fromModel(), cstate.fromGS(), cstate.fromType) % tr(" (@%1)").arg(cstate.subCompIdx)); - srcRaw.convert(cstate); - swtch.convert(cstate); -} - -bool MixData::isEmpty() const -{ - return (destCh == 0); -} - -/* - * LimitData - */ - -QString LimitData::minToString() const -{ - return QString::number((qreal)min/10); -} - -QString LimitData::maxToString() const -{ - return QString::number((qreal)max/10); -} - -QString LimitData::revertToString() const -{ - return revert ? tr("INV") : tr("NOR"); -} - -QString LimitData::nameToString(int index) const -{ - return RadioData::getElementName(tr("CH"), index + 1, name); -} - -QString LimitData::offsetToString() const -{ - return QString::number((qreal)offset/10, 'f', 1); -} - -void LimitData::clear() -{ - memset(reinterpret_cast(this), 0, sizeof(LimitData)); - min = -1000; - max = +1000; -} - -bool LimitData::isEmpty() const -{ - return (min == -1000 && max == 1000 && !revert && !offset && !ppmCenter && !symetrical && name[0] == '\0' && !curve.isSet()); -} - -/* - * CurveData - */ - -CurveData::CurveData() -{ - clear(); -} - -void CurveData::clear(int count) -{ - memset(this, 0, sizeof(CurveData)); - this->count = count; -} - -bool CurveData::isEmpty() const -{ - for (int i=0; i(this), 0, sizeof(FlightModeData)); @@ -149,13 +45,6 @@ QString FlightModeData::nameToString(int phaseIdx) const return RadioData::getElementName(tr("FM"), phaseIdx, name); // names are zero-based, FM0, FM1, etc } -void FlightModeData::convert(RadioDataConversionState & cstate) -{ - cstate.setComponent("FMD", 2); - cstate.setSubComp(nameToString(cstate.subCompIdx)); - swtch.convert(cstate); -} - bool FlightModeData::isEmpty(int phaseIdx) const { if (name[0] != '\0' || swtch.isSet() || fadeIn != 0 || fadeOut != 0) diff --git a/companion/src/firmwares/flightmodedata.h b/companion/src/firmwares/flightmodedata.h new file mode 100644 index 000000000..8578d04e5 --- /dev/null +++ b/companion/src/firmwares/flightmodedata.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "constants.h" +#include "rawswitch.h" + +#include + +class RadioDataConversionState; + +#define FLIGHTMODE_NAME_LEN 10 +#define RENC_MAX_VALUE 1024 +#define RENC_MIN_VALUE -RENC_MAX_VALUE + +class FlightModeData { + Q_DECLARE_TR_FUNCTIONS(FlightModeData) + + public: + FlightModeData() { clear(0); } + + int trimMode[CPN_MAX_TRIMS]; + int trimRef[CPN_MAX_TRIMS]; + int trim[CPN_MAX_TRIMS]; + RawSwitch swtch; + char name[FLIGHTMODE_NAME_LEN + 1]; + unsigned int fadeIn; + unsigned int fadeOut; + int rotaryEncoders[CPN_MAX_ENCODERS]; + int gvars[CPN_MAX_GVARS]; + + void convert(RadioDataConversionState & cstate); + void clear(const int phaseIdx); + bool isEmpty(int phaseIdx) const; + QString nameToString(int phaseIdx) const; + bool isGVarEmpty(int phaseIdx, int gvIdx) const; + bool isREncEmpty(int phaseIdx, int reIdx) const; + int linkedFlightModeZero(int phaseIdx, int maxOwnValue) const; + int linkedGVarFlightModeZero(int phaseIdx) const; + int linkedREncFlightModeZero(int phaseIdx) const; +}; diff --git a/companion/src/firmwares/heli_data.cpp b/companion/src/firmwares/heli_data.cpp new file mode 100644 index 000000000..b1fb7b36e --- /dev/null +++ b/companion/src/firmwares/heli_data.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "heli_data.h" diff --git a/companion/src/firmwares/heli_data.h b/companion/src/firmwares/heli_data.h new file mode 100644 index 000000000..734b29928 --- /dev/null +++ b/companion/src/firmwares/heli_data.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "rawsource.h" + +#include + +class SwashRingData { + Q_DECLARE_TR_FUNCTIONS(SwashRingData) + + public: + SwashRingData() { clear(); } + + int elevatorWeight; + int aileronWeight; + int collectiveWeight; + unsigned int type; + RawSource collectiveSource; + RawSource aileronSource; + RawSource elevatorSource; + unsigned int value; + + void clear() { memset(reinterpret_cast(this), 0, sizeof(SwashRingData)); } +}; + diff --git a/companion/src/firmwares/input_data.cpp b/companion/src/firmwares/input_data.cpp new file mode 100644 index 000000000..9b9ecfe20 --- /dev/null +++ b/companion/src/firmwares/input_data.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "input_data.h" +#include "radiodataconversionstate.h" + +void ExpoData::convert(RadioDataConversionState & cstate) +{ + cstate.setComponent(tr("INP"), 3); + cstate.setSubComp(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, chn).toString(cstate.fromModel(), cstate.fromGS(), cstate.fromType) % tr(" (@%1)").arg(cstate.subCompIdx)); + srcRaw.convert(cstate); + swtch.convert(cstate); +} + +bool ExpoData::isEmpty() const +{ + return (chn == 0 && mode == INPUT_MODE_NONE); +} diff --git a/companion/src/firmwares/input_data.h b/companion/src/firmwares/input_data.h new file mode 100644 index 000000000..27b6b6282 --- /dev/null +++ b/companion/src/firmwares/input_data.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "curvereference.h" +#include "rawsource.h" +#include "rawswitch.h" + +#include + +class RadioDataConversionState; + +enum InputMode { + INPUT_MODE_NONE, + INPUT_MODE_POS, + INPUT_MODE_NEG, + INPUT_MODE_BOTH +}; + +#define EXPODATA_NAME_LEN 10 + +class ExpoData { + Q_DECLARE_TR_FUNCTIONS(ExpoData) + + public: + ExpoData() { clear(); } + + RawSource srcRaw; + unsigned int scale; + unsigned int mode; // InputMode + unsigned int chn; + RawSwitch swtch; + unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4 + int weight; + int offset; + CurveReference curve; + int carryTrim; + char name[EXPODATA_NAME_LEN + 1]; + + void convert(RadioDataConversionState & cstate); + void clear() { memset(reinterpret_cast(this), 0, sizeof(ExpoData)); } + bool isEmpty() const; +}; diff --git a/companion/src/firmwares/io_data.h b/companion/src/firmwares/io_data.h deleted file mode 100644 index b70b174ea..000000000 --- a/companion/src/firmwares/io_data.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef IO_DATA_H -#define IO_DATA_H - -#include "constants.h" -#include "curvereference.h" -#include "rawsource.h" -#include "rawswitch.h" - -#include - -class RadioDataConversionState; - -enum InputMode { - INPUT_MODE_NONE, - INPUT_MODE_POS, - INPUT_MODE_NEG, - INPUT_MODE_BOTH -}; - -#define EXPODATA_NAME_LEN 10 - -class ExpoData { - Q_DECLARE_TR_FUNCTIONS(ExpoData) - - public: - ExpoData() { clear(); } - RawSource srcRaw; - unsigned int scale; - unsigned int mode; // InputMode - unsigned int chn; - RawSwitch swtch; - unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4 - int weight; - int offset; - CurveReference curve; - int carryTrim; - char name[EXPODATA_NAME_LEN+1]; - void clear() { memset(reinterpret_cast(this), 0, sizeof(ExpoData)); } - void convert(RadioDataConversionState & cstate); - bool isEmpty() const; -}; - -enum MltpxValue { - MLTPX_ADD=0, - MLTPX_MUL=1, - MLTPX_REP=2 -}; - -#define MIXDATA_NAME_LEN 10 - -class MixData { - Q_DECLARE_TR_FUNCTIONS(MixData) - - public: - MixData() { clear(); } - void convert(RadioDataConversionState & cstate); - - unsigned int destCh; // 1..CPN_MAX_CHNOUT - RawSource srcRaw; - int weight; - RawSwitch swtch; - CurveReference curve; //0=symmetrisch - unsigned int delayUp; - unsigned int delayDown; - unsigned int speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle) - unsigned int speedDown; // 0 nichts - int carryTrim; - bool noExpo; - MltpxValue mltpx; // multiplex method 0=+ 1=* 2=replace - unsigned int mixWarn; // mixer warning - unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4 - int sOffset; - char name[MIXDATA_NAME_LEN+1]; - - void clear() { memset(reinterpret_cast(this), 0, sizeof(MixData)); } - bool isEmpty() const; -}; - -#define LIMITDATA_NAME_LEN 6 - -class LimitData { - Q_DECLARE_TR_FUNCTIONS(LimitData) - - public: - LimitData() { clear(); } - int min; - int max; - bool revert; - int offset; - int ppmCenter; - bool symetrical; - int failsafe; - char name[LIMITDATA_NAME_LEN + 1]; - CurveReference curve; - QString minToString() const; - QString maxToString() const; - QString offsetToString() const; - QString revertToString() const; - QString nameToString(int index) const; - void clear(); - bool isEmpty() const; -}; - -class CurvePoint { - public: - int8_t x; - int8_t y; -}; - -#define CURVEDATA_NAME_LEN 6 - -class CurveData { - Q_DECLARE_TR_FUNCTIONS(CurveData) - - public: - enum CurveType { - CURVE_TYPE_STANDARD, - CURVE_TYPE_CUSTOM, - CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM - }; - - CurveData(); - void clear(int count = 5); - bool isEmpty() const; - QString nameToString(const int idx) const; - - CurveType type; - bool smooth; - int count; - CurvePoint points[CPN_MAX_POINTS]; - char name[CURVEDATA_NAME_LEN+1]; -}; - -#define FLIGHTMODE_NAME_LEN 10 -#define RENC_MAX_VALUE 1024 -#define RENC_MIN_VALUE -RENC_MAX_VALUE - -class FlightModeData { - Q_DECLARE_TR_FUNCTIONS(FlightModeData) - - public: - FlightModeData() { clear(0); } - int trimMode[CPN_MAX_TRIMS]; - int trimRef[CPN_MAX_TRIMS]; - int trim[CPN_MAX_TRIMS]; - RawSwitch swtch; - char name[FLIGHTMODE_NAME_LEN+1]; - unsigned int fadeIn; - unsigned int fadeOut; - int rotaryEncoders[CPN_MAX_ENCODERS]; - int gvars[CPN_MAX_GVARS]; - void clear(const int phaseIdx); - QString nameToString(int phaseIdx) const; - void convert(RadioDataConversionState & cstate); - bool isEmpty(int phaseIdx) const; - bool isGVarEmpty(int phaseIdx, int gvIdx) const; - bool isREncEmpty(int phaseIdx, int reIdx) const; - int linkedFlightModeZero(int phaseIdx, int maxOwnValue) const; - int linkedGVarFlightModeZero(int phaseIdx) const; - int linkedREncFlightModeZero(int phaseIdx) const; -}; - -class SwashRingData { - Q_DECLARE_TR_FUNCTIONS(SwashRingData) - - public: - SwashRingData() { clear(); } - int elevatorWeight; - int aileronWeight; - int collectiveWeight; - unsigned int type; - RawSource collectiveSource; - RawSource aileronSource; - RawSource elevatorSource; - unsigned int value; - void clear() { memset(reinterpret_cast(this), 0, sizeof(SwashRingData)); } -}; - -#endif // IO_DATA_H diff --git a/companion/src/firmwares/mixdata.cpp b/companion/src/firmwares/mixdata.cpp new file mode 100644 index 000000000..ac2893a4d --- /dev/null +++ b/companion/src/firmwares/mixdata.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "mixdata.h" +#include "radiodataconversionstate.h" + +void MixData::convert(RadioDataConversionState & cstate) +{ + cstate.setComponent(tr("MIX"), 4); + cstate.setSubComp(RawSource(SOURCE_TYPE_CH, destCh-1).toString(cstate.fromModel(), cstate.fromGS(), cstate.fromType) % tr(" (@%1)").arg(cstate.subCompIdx)); + srcRaw.convert(cstate); + swtch.convert(cstate); +} + +bool MixData::isEmpty() const +{ + return (destCh == 0); +} diff --git a/companion/src/firmwares/mixdata.h b/companion/src/firmwares/mixdata.h new file mode 100644 index 000000000..dc81298f0 --- /dev/null +++ b/companion/src/firmwares/mixdata.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "curvereference.h" +#include "rawsource.h" +#include "rawswitch.h" + +#include + +class RadioDataConversionState; + +enum MltpxValue { + MLTPX_ADD, + MLTPX_MUL, + MLTPX_REP +}; + +#define MIXDATA_NAME_LEN 10 + +class MixData { + Q_DECLARE_TR_FUNCTIONS(MixData) + + public: + MixData() { clear(); } + + unsigned int destCh; // 1..CPN_MAX_CHNOUT + RawSource srcRaw; + int weight; + RawSwitch swtch; + CurveReference curve; + unsigned int delayUp; + unsigned int delayDown; + unsigned int speedUp; + unsigned int speedDown; + int carryTrim; + bool noExpo; + MltpxValue mltpx; + unsigned int mixWarn; + unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4 + int sOffset; + char name[MIXDATA_NAME_LEN + 1]; + + void convert(RadioDataConversionState & cstate); + void clear() { memset(reinterpret_cast(this), 0, sizeof(MixData)); } + bool isEmpty() const; +}; diff --git a/companion/src/firmwares/modeldata.h b/companion/src/firmwares/modeldata.h index 847997d94..80b7d7353 100644 --- a/companion/src/firmwares/modeldata.h +++ b/companion/src/firmwares/modeldata.h @@ -18,15 +18,19 @@ * GNU General Public License for more details. */ -#ifndef MODELDATA_H -#define MODELDATA_H +#pragma once #include "constants.h" +#include "curvedata.h" #include "customfunctiondata.h" #include "gvardata.h" -#include "io_data.h" +#include "flightmodedata.h" +#include "heli_data.h" +#include "input_data.h" #include "logicalswitchdata.h" +#include "mixdata.h" #include "moduledata.h" +#include "output_data.h" #include "sensordata.h" #include "telem_data.h" @@ -346,5 +350,3 @@ class ModelData { void sortMixes(); void updateResetParam(CustomFunctionData * cfd); }; - -#endif // MODELDATA_H diff --git a/companion/src/firmwares/output_data.cpp b/companion/src/firmwares/output_data.cpp new file mode 100644 index 000000000..63127d242 --- /dev/null +++ b/companion/src/firmwares/output_data.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "output_data.h" +#include "radiodata.h" +#include "radiodataconversionstate.h" + +void LimitData::clear() +{ + memset(reinterpret_cast(this), 0, sizeof(LimitData)); + min = -1000; + max = +1000; +} + +bool LimitData::isEmpty() const +{ + return (min == -1000 && max == 1000 && !revert && !offset && !ppmCenter && !symetrical && name[0] == '\0' && !curve.isSet()); +} + +QString LimitData::minToString() const +{ + return QString::number((qreal)min / 10); +} + +QString LimitData::maxToString() const +{ + return QString::number((qreal)max / 10); +} + +QString LimitData::revertToString() const +{ + return revert ? tr("INV") : tr("NOR"); +} + +QString LimitData::nameToString(int index) const +{ + return RadioData::getElementName(tr("CH"), index + 1, name); +} + +QString LimitData::offsetToString() const +{ + return QString::number((qreal)offset / 10, 'f', 1); +} diff --git a/companion/src/firmwares/output_data.h b/companion/src/firmwares/output_data.h new file mode 100644 index 000000000..423f03e49 --- /dev/null +++ b/companion/src/firmwares/output_data.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "curvereference.h" + +#include + +#define LIMITDATA_NAME_LEN 6 + +class LimitData { + Q_DECLARE_TR_FUNCTIONS(LimitData) + + public: + LimitData() { clear(); } + + int min; + int max; + bool revert; + int offset; + int ppmCenter; + bool symetrical; + int failsafe; + char name[LIMITDATA_NAME_LEN + 1]; + CurveReference curve; + + void clear(); + bool isEmpty() const; + QString minToString() const; + QString maxToString() const; + QString offsetToString() const; + QString revertToString() const; + QString nameToString(int index) const; +}; From f4866c822ab5a71962edf1f33990bc2ff666f246 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 7 Mar 2021 23:15:15 +0100 Subject: [PATCH 102/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8965152da..eeb3a1ef5 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2174,3 +2174,5 @@ Mateusz Dziadosz Thomas Merchant M L Perkins Stefano Boggia +Новоселов Юрий +James Rhodes From 4660dd852f5a3556c2937c32214de7b766f12f3b Mon Sep 17 00:00:00 2001 From: ruddy douglass Date: Mon, 8 Mar 2021 16:42:34 -0500 Subject: [PATCH 103/188] Resolve issue 8347 by checking if the for nullptr. Additionally resolve a couple other similar issues for keyboard accellerators --- companion/src/modeledit/inputs.cpp | 7 ++++++- companion/src/modeledit/mixes.cpp | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index f48d7d916..d12655c08 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -351,6 +351,8 @@ void InputsPanel::expoOpen(QListWidgetItem *item) if (!item) item = ExposlistWidget->currentItem(); + if (item == nullptr) return; + int idx = item->data(Qt::UserRole).toByteArray().at(0); if (idx < 0) { int ch = -idx - 1; @@ -368,7 +370,10 @@ void InputsPanel::expoOpen(QListWidgetItem *item) void InputsPanel::expoAdd() { - int index = ExposlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0); + QListWidgetItem *item = ExposlistWidget->currentItem(); + if (item == nullptr) return; + + int index = item->data(Qt::UserRole).toByteArray().at(0); if (index < 0) { // if empty then return relevant index expoOpen(); diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp index 3d95bd04d..7f3da65b8 100644 --- a/companion/src/modeledit/mixes.cpp +++ b/companion/src/modeledit/mixes.cpp @@ -354,7 +354,10 @@ void MixesPanel::mixersDuplicate() void MixesPanel::mixerOpen() { - int idx = mixersListWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0); + QListWidgetItem *item = mixersListWidget->currentItem(); + if (item == nullptr) return; + + int idx = item->data(Qt::UserRole).toByteArray().at(0); if(idx < 0) { int i = -idx; idx = getMixerIndex(i); //get mixer index to insert @@ -371,7 +374,10 @@ void MixesPanel::mixerOpen() void MixesPanel::mixerHighlight() { - int idx = mixersListWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0); + QListWidgetItem *item = mixersListWidget->currentItem(); + if (item == nullptr) return; + + int idx = item->data(Qt::UserRole).toByteArray().at(0); int dest; if (idx<0) { dest = -idx; From 9b02d354d6969e7009162bd76d70fe390c7161c8 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 9 Mar 2021 17:07:32 +0100 Subject: [PATCH 104/188] Tidy up --- radio/src/targets/horus/hal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 81639e73a..48bd8ff30 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -420,9 +420,9 @@ #define AUX_SERIAL_USART_IRQn USART3_IRQn #define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1 #define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4 +#if defined(RADIO_TX16S) #define AUX_SERIAL_PWR_GPIO GPIOA #define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PB.00 -#if defined(RADIO_TX16S) #define TRAINER_BATTERY_COMPARTMENT // allows serial port TTL trainer #endif #else From 673c8aac1aa7871233c6201f4e2b724d2207d75d Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 9 Mar 2021 20:22:48 +0100 Subject: [PATCH 105/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index eeb3a1ef5..ce86be529 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2176,3 +2176,4 @@ M L Perkins Stefano Boggia Новоселов Юрий James Rhodes +Peter Gaskill From 5b44f150cfc1bc3e227b8bd5ec2e1e63b4ee5703 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 10 Mar 2021 07:10:06 +1100 Subject: [PATCH 106/188] Limit sensors available as possible RSSI source --- .../src/datamodels/compounditemmodels.cpp | 48 ++++++++++++++++++- companion/src/datamodels/compounditemmodels.h | 24 ++++++++-- companion/src/firmwares/sensordata.cpp | 22 +++++++++ companion/src/firmwares/sensordata.h | 2 + companion/src/modeledit/modeledit.cpp | 1 + companion/src/modeledit/setup.cpp | 10 +++- companion/src/modeledit/setup.h | 2 + companion/src/modeledit/telemetry.cpp | 8 +++- 8 files changed, 109 insertions(+), 8 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index 039e90244..3432258ae 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -488,7 +488,7 @@ TelemetrySourceItemModel::TelemetrySourceItemModel(const GeneralSettings * const if (!modelData) return; - setUpdateMask(IMUE_TeleSensors); + setUpdateMask(IMUE_TeleSensors | IMUE_Modules); const int count = firmware->getCapability(Sensors); for (int i = -count; i <= count; ++i) { @@ -519,6 +519,49 @@ void TelemetrySourceItemModel::update(const int event) } } +// +// RssiSourceItemModel +// + +RssiSourceItemModel::RssiSourceItemModel(const GeneralSettings * const generalSettings, const ModelData * const modelData, + Firmware * firmware, const Boards * const board, const Board::Type boardType) : + AbstractDynamicItemModel(generalSettings, modelData, firmware, board, boardType) +{ + setId(IMID_RssiSource); + + if (!modelData) + return; + + setUpdateMask(IMUE_TeleSensors | IMUE_Modules); + + for (int i = 0; i <= firmware->getCapability(Sensors); ++i) { + QStandardItem * modelItem = new QStandardItem(); + modelItem->setData(i, IMDR_Id); + modelItem->setData(i < 0 ? IMDG_Negative : i > 0 ? IMDG_Positive : IMDG_None, IMDR_Flags); + setDynamicItemData(modelItem, i); + appendRow(modelItem); + } +} + +void RssiSourceItemModel::setDynamicItemData(QStandardItem * item, const int value) const +{ + item->setText(SensorData::rssiSensorToString(modelData, value)); + item->setData(SensorData::isRssiSensorAvailable(modelData, value), IMDR_Available); +} + +void RssiSourceItemModel::update(const int event) +{ + if (doUpdate(event)) { + emit aboutToBeUpdated(); + + for (int i = 0; i < rowCount(); ++i) { + setDynamicItemData(item(i), item(i)->data(IMDR_Id).toInt()); + } + + emit updateComplete(); + } +} + // // CurveRefTypeItemModel // @@ -624,6 +667,9 @@ void CompoundItemModelFactory::addItemModel(const int id) case AbstractItemModel::IMID_TeleSource: registerItemModel(new TelemetrySourceItemModel(generalSettings, modelData, firmware, board, boardType)); break; + case AbstractItemModel::IMID_RssiSource: + registerItemModel(new RssiSourceItemModel(generalSettings, modelData, firmware, board, boardType)); + break; case AbstractItemModel::IMID_CurveRefType: registerItemModel(new CurveRefTypeItemModel(generalSettings, modelData, firmware, board, boardType)); break; diff --git a/companion/src/datamodels/compounditemmodels.h b/companion/src/datamodels/compounditemmodels.h index de32fc902..7acfcbdc9 100644 --- a/companion/src/datamodels/compounditemmodels.h +++ b/companion/src/datamodels/compounditemmodels.h @@ -18,8 +18,7 @@ * GNU General Public License for more details. */ -#ifndef COMPOUNDITEMMODELS_H -#define COMPOUNDITEMMODELS_H +#pragma once #include "rawsource.h" #include "rawswitch.h" @@ -44,6 +43,7 @@ class AbstractItemModel: public QStandardItemModel IMID_CustomFuncAction, IMID_CustomFuncResetParam, IMID_TeleSource, + IMID_RssiSource, IMID_CurveRefType, IMID_CurveRefFunc, IMID_ReservedCount, @@ -78,8 +78,9 @@ class AbstractItemModel: public QStandardItemModel IMUE_Scripts = 1 << 7, IMUE_TeleSensors = 1 << 8, IMUE_Timers = 1 << 9, + IMUE_Modules = 1 << 10, IMUE_All = IMUE_SystemRefresh | IMUE_Channels | IMUE_Curves | IMUE_FlightModes | IMUE_GVars | IMUE_Inputs | - IMUE_LogicalSwitches | IMUE_Scripts | IMUE_TeleSensors | IMUE_Timers + IMUE_LogicalSwitches | IMUE_Scripts | IMUE_TeleSensors | IMUE_Timers | IMUE_Modules }; Q_ENUM(ItemModelUpdateEvent) @@ -305,6 +306,21 @@ class TelemetrySourceItemModel: public AbstractDynamicItemModel virtual void setDynamicItemData(QStandardItem * item, const int value) const; }; +class RssiSourceItemModel: public AbstractDynamicItemModel +{ + Q_OBJECT + public: + explicit RssiSourceItemModel(const GeneralSettings * const generalSettings, const ModelData * const modelData, + Firmware * firmware, const Boards * const board, const Board::Type boardType); + virtual ~RssiSourceItemModel() {}; + + public slots: + virtual void update(const int event = IMUE_SystemRefresh) override; + + protected: + virtual void setDynamicItemData(QStandardItem * item, const int value) const; +}; + class CurveRefTypeItemModel : public AbstractStaticItemModel { Q_OBJECT @@ -361,5 +377,3 @@ class CompoundItemModelFactory private: void setSourceId(AbstractItemModel * itemModel); }; - -#endif // COMPOUNDITEMMODELS_H diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp index a87dc6d21..2c0866e66 100644 --- a/companion/src/firmwares/sensordata.cpp +++ b/companion/src/firmwares/sensordata.cpp @@ -427,6 +427,28 @@ bool SensorData::isSourceAvailable(const ModelData * model, const int index) return false; } +#define RSSI_ID 0xF101 + +// static +bool SensorData::isRssiSensorAvailable(const ModelData * model, const int value) +{ + if (value == 0) + return true; + else { + const SensorData &sensor = model->sensorData[abs(value) - 1]; + return (sensor.isAvailable() && sensor.id == RSSI_ID); + } +} + +// static +QString SensorData::rssiSensorToString(const ModelData * model, const int value) +{ + if (value == 0) + return tr("(default)"); + else + return sourceToString(model, value); +} + // static AbstractStaticItemModel * SensorData::typeItemModel() { diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h index 5e888d749..2353a0ebf 100644 --- a/companion/src/firmwares/sensordata.h +++ b/companion/src/firmwares/sensordata.h @@ -206,6 +206,8 @@ class SensorData { static QString unitToString(const int value); static QString precToString(const int value); static QString boolToString(const bool value) { return value ? tr("Y") : tr("N"); } + static bool isRssiSensorAvailable(const ModelData * model, const int value); + static QString rssiSensorToString(const ModelData * model, const int value); static AbstractStaticItemModel * typeItemModel(); static AbstractStaticItemModel * formulaItemModel(); diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index 3577be7ae..146bc01f0 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -62,6 +62,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw sharedItemModels->addItemModel(AbstractItemModel::IMID_CustomFuncAction); sharedItemModels->addItemModel(AbstractItemModel::IMID_CustomFuncResetParam); sharedItemModels->addItemModel(AbstractItemModel::IMID_TeleSource); + sharedItemModels->addItemModel(AbstractItemModel::IMID_RssiSource); sharedItemModels->addItemModel(AbstractItemModel::IMID_CurveRefType); sharedItemModels->addItemModel(AbstractItemModel::IMID_CurveRefFunc); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index d1756aa48..b695b03ff 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -73,7 +73,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge ui->persistent->addItem(tr("Not persistent"), 0); ui->persistent->addItem(tr("Persistent (flight)"), 1); ui->persistent->addItem(tr("Persistent (manual reset)"), 2); - + ui->countdownStart->setField(timer.countdownStart, this); ui->countdownStart->addItem("5s", 1); ui->countdownStart->addItem("10s", 0); @@ -701,6 +701,7 @@ void ModulePanel::onProtocolChanged(int index) module.protocol = ui->protocol->itemData(index).toInt(); module.channelsCount = module.getMaxChannelCount(); update(); + emit updateItemModels(); emit modified(); } } @@ -801,6 +802,7 @@ void ModulePanel::onMultiProtocolChanged(int index) module.subType = std::min(module.subType, maxSubTypes - 1); module.channelsCount = module.getMaxChannelCount(); update(); + emit updateItemModels(); emit modified(); lock = false; } @@ -1251,6 +1253,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i); ui->modulesLayout->addWidget(modules[i]); connect(modules[i], &ModulePanel::modified, this, &SetupPanel::modified); + connect(modules[i], &ModulePanel::updateItemModels, this, &SetupPanel::onModuleUpdateItemModels); connect(this, &SetupPanel::extendedLimitsToggled, modules[i], &ModulePanel::onExtendedLimitsToggled); } @@ -1798,3 +1801,8 @@ void SetupPanel::updateItemModels() { sharedItemModels->update(AbstractItemModel::IMUE_Timers); } + +void SetupPanel::onModuleUpdateItemModels() +{ + sharedItemModels->update(AbstractItemModel::IMUE_Modules); +} diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 7a5cddba9..7409d7b25 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -81,6 +81,7 @@ class ModulePanel : public ModelPanel signals: void channelsRangeChanged(); void failsafeModified(unsigned index); + void updateItemModels(); private slots: void setupFailsafes(); @@ -175,6 +176,7 @@ class SetupPanel : public ModelPanel void onTimerNameChanged(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); + void onModuleUpdateItemModels(); private: Ui::Setup *ui; diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 8cda220a9..3c0ae7bf7 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -35,6 +35,7 @@ constexpr char FIM_SENSORFORMULA[] {"Sensor.Formula"}; constexpr char FIM_SENSORCELLINDEX[] {"Sensor.CellIndex"}; constexpr char FIM_SENSORUNIT[] {"Sensor.Unit"}; constexpr char FIM_SENSORPRECISION[] {"Sensor.Precision"}; +constexpr char FIM_RSSISOURCE[] {"Rssi Source"}; TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware, const bool & parentLock, FilteredItemModelFactory * panelFilteredItemModels): @@ -696,6 +697,11 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin FIM_TELEPOSSRC); connectItemModelEvents(id); + + id = panelFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RssiSource)), + FIM_RSSISOURCE); + connectItemModelEvents(id); + id = panelItemModels->registerItemModel(SensorData::typeItemModel()); panelFilteredItemModels->registerItemModel(new FilteredItemModel(panelItemModels->getItemModel(id)), FIM_SENSORTYPE); @@ -818,7 +824,7 @@ void TelemetryPanel::setup() ui->rssiSourceLabel->show(); ui->rssiSourceLabel->setText(tr("Source")); - ui->rssiSourceCB->setModel(panelFilteredItemModels->getItemModel(FIM_TELEPOSSRC)); + ui->rssiSourceCB->setModel(panelFilteredItemModels->getItemModel(FIM_RSSISOURCE)); ui->rssiSourceCB->setField(model->rssiSource, this); ui->rssiSourceCB->show(); From 9d383c7f08abe78fccaa9caa190b5a5b7637299b Mon Sep 17 00:00:00 2001 From: ruddy douglass Date: Tue, 9 Mar 2021 16:38:40 -0500 Subject: [PATCH 107/188] Reformat to adhere to coding standards --- companion/src/modeledit/inputs.cpp | 6 ++++-- companion/src/modeledit/mixes.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index d12655c08..8636d6335 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -351,7 +351,8 @@ void InputsPanel::expoOpen(QListWidgetItem *item) if (!item) item = ExposlistWidget->currentItem(); - if (item == nullptr) return; + if (item == nullptr) + return; int idx = item->data(Qt::UserRole).toByteArray().at(0); if (idx < 0) { @@ -371,7 +372,8 @@ void InputsPanel::expoOpen(QListWidgetItem *item) void InputsPanel::expoAdd() { QListWidgetItem *item = ExposlistWidget->currentItem(); - if (item == nullptr) return; + if (item == nullptr) + return; int index = item->data(Qt::UserRole).toByteArray().at(0); diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp index 7f3da65b8..023888760 100644 --- a/companion/src/modeledit/mixes.cpp +++ b/companion/src/modeledit/mixes.cpp @@ -355,7 +355,8 @@ void MixesPanel::mixersDuplicate() void MixesPanel::mixerOpen() { QListWidgetItem *item = mixersListWidget->currentItem(); - if (item == nullptr) return; + if (item == nullptr) + return; int idx = item->data(Qt::UserRole).toByteArray().at(0); if(idx < 0) { @@ -375,7 +376,8 @@ void MixesPanel::mixerOpen() void MixesPanel::mixerHighlight() { QListWidgetItem *item = mixersListWidget->currentItem(); - if (item == nullptr) return; + if (item == nullptr) + return; int idx = item->data(Qt::UserRole).toByteArray().at(0); int dest; From 936617e24461b12cc1a0faadcf1116bb94181ccc Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 10 Mar 2021 15:07:42 +1100 Subject: [PATCH 108/188] Add new model id to toString --- companion/src/datamodels/compounditemmodels.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index 3432258ae..aa3fa1756 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -46,6 +46,8 @@ QString AbstractItemModel::idToString(const int value) return "CustomFuncResetParam"; case IMID_TeleSource: return "TeleSource"; + case IMID_RssiSource: + return "RssiSource"; case IMID_CurveRefType: return "CurveRefType"; case IMID_CurveRefFunc: From 64324e3777b55a10324055448b2259fc4ca036ab Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 10 Mar 2021 11:11:42 +0100 Subject: [PATCH 109/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index ce86be529..b45c8d90c 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2177,3 +2177,4 @@ Stefano Boggia Новоселов Юрий James Rhodes Peter Gaskill +Jacques Temey From 1180fcbe5fe480b524e15d4a5e80c2c6ed018018 Mon Sep 17 00:00:00 2001 From: Tony Cake Date: Wed, 10 Mar 2021 07:16:55 -0800 Subject: [PATCH 110/188] Add GHST GPS Telemetry Sensors (#8352) * Add GHST GPS Telemetry Sensors --- radio/src/telemetry/ghost.cpp | 66 ++++++++++++++++++++++++++++++++--- radio/src/telemetry/ghost.h | 2 ++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/radio/src/telemetry/ghost.cpp b/radio/src/telemetry/ghost.cpp index 098e9c990..1ff6acd48 100755 --- a/radio/src/telemetry/ghost.cpp +++ b/radio/src/telemetry/ghost.cpp @@ -49,6 +49,13 @@ enum GHOST_ID_PACK_VOLTS = 0x000c, // Battery Pack Voltage GHOST_ID_PACK_AMPS = 0x000d, // Battery Pack Current GHOST_ID_PACK_MAH = 0x000e, // Battery Pack mAh consumed + + GHOST_ID_GPS_LAT = 0x000f, // GPS Latitude + GHOST_ID_GPS_LONG = 0x0010, // GPS Longitude + GHOST_ID_GPS_ALT = 0x0011, // GPS Altitude + GHOST_ID_GPS_HDG = 0x0012, // GPS Heading + GHOST_ID_GPS_GSPD = 0x0013, // GPS Ground Speed + GHOST_ID_GPS_SATS = 0x0014 // GPS Satellite Count }; const GhostSensor ghostSensors[] = { @@ -70,6 +77,13 @@ const GhostSensor ghostSensors[] = { {GHOST_ID_PACK_AMPS, ZSTR_CURR, UNIT_AMPS, 2}, {GHOST_ID_PACK_MAH, ZSTR_CAPACITY, UNIT_MAH, 0}, + {GHOST_ID_GPS_LAT, ZSTR_GPS, UNIT_GPS_LATITUDE, 0}, + {GHOST_ID_GPS_LONG, ZSTR_GPS, UNIT_GPS_LONGITUDE, 0}, + {GHOST_ID_GPS_GSPD, ZSTR_GSPD, UNIT_KMH, 1}, + {GHOST_ID_GPS_HDG, ZSTR_HDG, UNIT_DEGREE, 3}, + {GHOST_ID_GPS_ALT, ZSTR_ALT, UNIT_METERS, 0}, + {GHOST_ID_GPS_SATS, ZSTR_SATELLITES, UNIT_RAW, 0}, + {0x00, NULL, UNIT_RAW, 0}, }; @@ -88,7 +102,11 @@ void processGhostTelemetryValue(uint8_t index, int32_t value) return; const GhostSensor * sensor = getGhostSensor(index); - setTelemetryValue(PROTOCOL_TELEMETRY_GHOST, sensor->id, 0, 0, value, sensor->unit, sensor->precision); + uint16_t id = sensor->id; + if (id == GHOST_ID_GPS_LONG) { + id = GHOST_ID_GPS_LAT; + } + setTelemetryValue(PROTOCOL_TELEMETRY_GHOST, id, 0, 0, value, sensor->unit, sensor->precision); } void processGhostTelemetryValueString(const GhostSensor * sensor, const char * str) @@ -105,16 +123,19 @@ bool checkGhostTelemetryFrameCRC() return (crc == telemetryRxBuffer[len + 1]); } +// hifirst uint16_t getTelemetryValue_u16(uint8_t index) { return (telemetryRxBuffer[index] << 8) | telemetryRxBuffer[index + 1]; } +// lofirst uint16_t getTelemetryValue_u16le(uint8_t index) { return (telemetryRxBuffer[index + 1] << 8) | telemetryRxBuffer[index]; } +// hifirst uint32_t getTelemetryValue_s32(uint8_t index) { uint32_t val = 0; @@ -123,6 +144,15 @@ uint32_t getTelemetryValue_s32(uint8_t index) return val; } +// lofirst +uint32_t getTelemetryValue_s32le(uint8_t index) +{ + uint32_t val = 0; + for (int i = 0; i < 4; ++i) + val <<= 8, val |= telemetryRxBuffer[index + 3 - i]; + return val; +} + void processGhostTelemetryFrame() { if (!checkGhostTelemetryFrameCRC()) { @@ -213,15 +243,40 @@ void processGhostTelemetryFrame() case GHST_DL_PACK_STAT: { #if defined(BLUETOOTH) if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY && bluetooth.state == BLUETOOTH_STATE_CONNECTED) { - bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount); - } + bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount); + } #endif processGhostTelemetryValue(GHOST_ID_PACK_VOLTS, getTelemetryValue_u16le(3)); processGhostTelemetryValue(GHOST_ID_PACK_AMPS, getTelemetryValue_u16le(5)); processGhostTelemetryValue(GHOST_ID_PACK_MAH, getTelemetryValue_u16le(7) * 10); - break; } + + case GHST_DL_GPS_PRIMARY: { +#if defined(BLUETOOTH) + if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY && bluetooth.state == BLUETOOTH_STATE_CONNECTED) { + bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount); + } +#endif + processGhostTelemetryValue(GHOST_ID_GPS_LAT, getTelemetryValue_s32le(3) / 10); + processGhostTelemetryValue(GHOST_ID_GPS_LONG, getTelemetryValue_s32le(7) / 10); + processGhostTelemetryValue(GHOST_ID_GPS_ALT, (int16_t) getTelemetryValue_u16le(11)); + break; + } + + case GHST_DL_GPS_SECONDARY: { +#if defined(BLUETOOTH) + if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY && bluetooth.state == BLUETOOTH_STATE_CONNECTED) { + bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount); + } +#endif + processGhostTelemetryValue(GHOST_ID_GPS_HDG, getTelemetryValue_u16le(5) / 10); + + // ground speed is passed via GHST as cm/s, converted to km/h for OpenTx + processGhostTelemetryValue(GHOST_ID_GPS_GSPD, (getTelemetryValue_u16le(3) * 36 + 50) / 100); + processGhostTelemetryValue(GHOST_ID_GPS_SATS, telemetryRxBuffer[7]); + break; + } } } @@ -272,6 +327,9 @@ void ghostSetDefault(int index, uint8_t id, uint8_t subId) const GhostSensor * sensor = getGhostSensor(id); if (sensor) { TelemetryUnit unit = sensor->unit; + if (unit == UNIT_GPS_LATITUDE || unit == UNIT_GPS_LONGITUDE) { + unit = UNIT_GPS; + } uint8_t prec = min(2, sensor->precision); telemetrySensor.init(sensor->name, unit, prec); } diff --git a/radio/src/telemetry/ghost.h b/radio/src/telemetry/ghost.h index 0a3195835..9a43da9b7 100755 --- a/radio/src/telemetry/ghost.h +++ b/radio/src/telemetry/ghost.h @@ -44,6 +44,8 @@ #define GHST_DL_VTX_STAT 0x22 #define GHST_DL_PACK_STAT 0x23 #define GHST_DL_MENU_DESC 0x24 +#define GHST_DL_GPS_PRIMARY 0x25 +#define GHST_DL_GPS_SECONDARY 0x26 #define GHST_RC_CTR_VAL_12BIT 0x7C0 // 0x3e0 << 1 #define GHST_RC_CTR_VAL_8BIT 0x7C From c0ec43526b74a24a43dd525ccecc6f154c210583 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 10 Mar 2021 16:19:34 +0100 Subject: [PATCH 111/188] Cosmetics --- radio/src/telemetry/ghost.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radio/src/telemetry/ghost.cpp b/radio/src/telemetry/ghost.cpp index 1ff6acd48..ad7508084 100755 --- a/radio/src/telemetry/ghost.cpp +++ b/radio/src/telemetry/ghost.cpp @@ -43,14 +43,14 @@ enum GHOST_ID_TOTAL_LATENCY = 0x0007, // Tx-side total latency GHOST_ID_VTX_FREQ = 0x0008, // Vtx Frequency (in MHz) GHOST_ID_VTX_POWER = 0x0009, // Vtx Power (in mW) - GHOST_ID_VTX_CHAN = 0x000a, // Vtx Channel - GHOST_ID_VTX_BAND = 0x000b, // Vtx Band + GHOST_ID_VTX_CHAN = 0x000A, // Vtx Channel + GHOST_ID_VTX_BAND = 0x000B, // Vtx Band - GHOST_ID_PACK_VOLTS = 0x000c, // Battery Pack Voltage - GHOST_ID_PACK_AMPS = 0x000d, // Battery Pack Current - GHOST_ID_PACK_MAH = 0x000e, // Battery Pack mAh consumed + GHOST_ID_PACK_VOLTS = 0x000C, // Battery Pack Voltage + GHOST_ID_PACK_AMPS = 0x000D, // Battery Pack Current + GHOST_ID_PACK_MAH = 0x000E, // Battery Pack mAh consumed - GHOST_ID_GPS_LAT = 0x000f, // GPS Latitude + GHOST_ID_GPS_LAT = 0x000F, // GPS Latitude GHOST_ID_GPS_LONG = 0x0010, // GPS Longitude GHOST_ID_GPS_ALT = 0x0011, // GPS Altitude GHOST_ID_GPS_HDG = 0x0012, // GPS Heading From 7613f72ec55d2ab81e91e5b96f9c4e9ac8728755 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 10 Mar 2021 16:54:01 +0100 Subject: [PATCH 112/188] Tidy up --- radio/src/targets/horus/lcd_driver.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/radio/src/targets/horus/lcd_driver.cpp b/radio/src/targets/horus/lcd_driver.cpp index 751aa88cd..97ecc5a61 100644 --- a/radio/src/targets/horus/lcd_driver.cpp +++ b/radio/src/targets/horus/lcd_driver.cpp @@ -141,29 +141,19 @@ static void LCD_NRSTConfig(void) GPIO_Init(LCD_GPIO_NRST, &GPIO_InitStructure); } -// TODO delay function -static void delay3(uint32_t nCount) -{ - uint32_t index = 0; - for(index = (1000 * 100 * nCount); index != 0; --index) - { - __asm("nop\n"); - } -} - static void lcd_reset(void) { #if defined(RADIO_T18) // T18 screen has issues if NRST is ever brought low NRST_HIGH(); #else NRST_HIGH(); - delay3(1); + delay_ms(1); NRST_LOW(); // RESET(); - delay3(20); + delay_ms(20); NRST_HIGH(); - delay3(30); + delay_ms(30); #endif } From b60ba23f1f2a595c96ceefe625f5efcafa05a274 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 10 Mar 2021 19:13:36 +0100 Subject: [PATCH 113/188] M-Link telemetry (#8281) --- radio/src/audio.cpp | 2 +- radio/src/dataconstants.h | 5 +- radio/src/lua/api_general.cpp | 1 + radio/src/targets/common/arm/CMakeLists.txt | 2 +- radio/src/telemetry/mlink.cpp | 161 ++++++++++++++++++++ radio/src/telemetry/mlink.h | 47 ++++++ radio/src/telemetry/multi.cpp | 8 + radio/src/telemetry/telemetry.h | 1 + radio/src/telemetry/telemetry_sensors.cpp | 4 + radio/src/translations/cz.h.txt | 5 +- radio/src/translations/de.h.txt | 5 +- radio/src/translations/en.h.txt | 5 +- radio/src/translations/es.h.txt | 5 +- radio/src/translations/fi.h.txt | 5 +- radio/src/translations/fr.h.txt | 5 +- radio/src/translations/it.h.txt | 5 +- radio/src/translations/nl.h.txt | 5 +- radio/src/translations/pl.h.txt | 5 +- radio/src/translations/pt.h.txt | 5 +- radio/src/translations/se.h.txt | 5 +- radio/util/tts_en.py | 1 + radio/util/tts_fr.py | 4 + 22 files changed, 276 insertions(+), 15 deletions(-) create mode 100644 radio/src/telemetry/mlink.cpp create mode 100644 radio/src/telemetry/mlink.h diff --git a/radio/src/audio.cpp b/radio/src/audio.cpp index 702ec044e..04ff8a8b2 100644 --- a/radio/src/audio.cpp +++ b/radio/src/audio.cpp @@ -161,7 +161,7 @@ const char * const unitsFilenames[] = { "hertz", "ms", "us", - "spare4", + "km", "spare5", "spare6", "spare7", diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index dae853d12..b7ab6ebea 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -278,6 +278,7 @@ enum TelemetryProtocol PROTOCOL_TELEMETRY_FLYSKY_IBUS, PROTOCOL_TELEMETRY_HITEC, PROTOCOL_TELEMETRY_HOTT, + PROTOCOL_TELEMETRY_MLINK, PROTOCOL_TELEMETRY_MULTIMODULE, PROTOCOL_TELEMETRY_AFHDS3, PROTOCOL_TELEMETRY_GHOST, @@ -318,8 +319,8 @@ enum TelemetryUnit { UNIT_HERTZ, UNIT_MS, UNIT_US, - UNIT_MAX = UNIT_US, - UNIT_SPARE4, + UNIT_KM, + UNIT_MAX = UNIT_KM, UNIT_SPARE5, UNIT_SPARE6, UNIT_SPARE7, diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 60ebe39fe..3c6f20d42 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -2041,6 +2041,7 @@ const luaR_value_entry opentxConstants[] = { {"UNIT_KMH", UNIT_KMH }, {"UNIT_MPH", UNIT_MPH }, {"UNIT_METERS", UNIT_METERS }, + {"UNIT_KM", UNIT_KM }, {"UNIT_FEET", UNIT_FEET }, {"UNIT_CELSIUS", UNIT_CELSIUS }, {"UNIT_FAHRENHEIT", UNIT_FAHRENHEIT }, diff --git a/radio/src/targets/common/arm/CMakeLists.txt b/radio/src/targets/common/arm/CMakeLists.txt index 16169ff24..e725bc68c 100644 --- a/radio/src/targets/common/arm/CMakeLists.txt +++ b/radio/src/targets/common/arm/CMakeLists.txt @@ -148,7 +148,7 @@ endif() if(MULTIMODULE) add_definitions(-DMULTIMODULE) - set(SRC ${SRC} pulses/multi.cpp telemetry/spektrum.cpp telemetry/hitec.cpp telemetry/hott.cpp telemetry/multi.cpp io/multi_firmware_update.cpp) + set(SRC ${SRC} pulses/multi.cpp telemetry/spektrum.cpp telemetry/hitec.cpp telemetry/hott.cpp telemetry/mlink.cpp telemetry/multi.cpp io/multi_firmware_update.cpp) endif() if(CROSSFIRE) diff --git a/radio/src/telemetry/mlink.cpp b/radio/src/telemetry/mlink.cpp new file mode 100644 index 000000000..a7cdccb92 --- /dev/null +++ b/radio/src/telemetry/mlink.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (C) OpenTX + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +struct MLinkSensor +{ + const uint16_t id; + const char * name; + const TelemetryUnit unit; + const uint8_t precision; +}; + +const MLinkSensor mlinkSensors[] = { + {MLINK_RX_VOLTAGE, ZSTR_BATT, UNIT_VOLTS, 1}, + {MLINK_VOLTAGE, ZSTR_VFAS, UNIT_VOLTS, 1}, + {MLINK_CURRENT, ZSTR_CURR, UNIT_AMPS, 1}, + {MLINK_VARIO, ZSTR_VSPD, UNIT_METERS_PER_SECOND, 1}, + {MLINK_SPEED, ZSTR_SPEED, UNIT_KMH, 1}, + {MLINK_RPM, ZSTR_RPM, UNIT_RPMS, 0}, + {MLINK_TEMP, ZSTR_TEMP1, UNIT_CELSIUS, 1}, + {MLINK_HEADING, ZSTR_HDG, UNIT_DEGREE, 1}, + {MLINK_ALT, ZSTR_ALT , UNIT_METERS, 0}, + {MLINK_FUEL, ZSTR_FUEL, UNIT_PERCENT, 0}, + {MLINK_CAPACITY, ZSTR_CAPACITY, UNIT_MAH, 0}, + {MLINK_FLOW, ZSTR_FLOW, UNIT_MILLILITERS, 0}, + {MLINK_DISTANCE, ZSTR_DIST, UNIT_KM, 1}, + {MLINK_LQI, ZSTR_RSSI, UNIT_RAW, 0}, + {MLINK_LOSS, ZSTR_LOSS, UNIT_RAW, 0}, + {MLINK_TX_RSSI, ZSTR_TX_RSSI, UNIT_RAW, 0}, + {MLINK_TX_LQI, ZSTR_TX_QUALITY, UNIT_RAW, 0}, +}; + +const MLinkSensor * getMLinkSensor(uint16_t id) +{ + for (const MLinkSensor * sensor = mlinkSensors; sensor->id; sensor++) { + if (id == sensor->id) + return sensor; + } + return nullptr; +} + +void processMLinkPacket(const uint8_t * packet) +{ + const uint8_t * data = packet + 2; + + // Multi telem + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_TX_RSSI, 0, 0, (packet[0] * 100) / 31, UNIT_RAW, 0); + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_TX_LQI, 0, 0, packet[1], UNIT_RAW, 0); + + // M-Link telem + if (data[0] == 0x13) { // Telemetry type RX-9 + for (uint8_t i = 1; i < 5; i += 3) { //2 sensors per packet + int32_t val = (int16_t )(data[i + 2] << 8 | data[i + 1]); + val = val >> 1; // remove alarm flag + uint8_t adress = (data[i] & 0xF0) >> 4; + switch (data[i] & 0x0F) { + case MLINK_VOLTAGE: + if ((data[i] & 0xF0) == 0x00){ + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_RX_VOLTAGE, 0, adress, val, UNIT_VOLTS, 1); + } + else { + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_VOLTAGE, 0, adress, val, UNIT_VOLTS, 1); + } + break; + case MLINK_CURRENT: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_CURRENT, 0, adress, val, UNIT_AMPS, 1); + break; + case MLINK_VARIO: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_VARIO, 0, adress, val, UNIT_METERS_PER_SECOND, 1); + break; + case MLINK_SPEED: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_SPEED, 0, adress, val, UNIT_KMH, 1); + break; + case MLINK_RPM: + if (val < 0) { + val = -val * 10; + } + else { + val = val * 100; + } + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_RPM, 0, adress, val, UNIT_RPMS, 0); + break; + case MLINK_TEMP: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_TEMP, 0, adress, val, UNIT_CELSIUS, 1); + break; + case MLINK_HEADING: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_HEADING, 0, adress, val, UNIT_DEGREE, 1); + break; + case MLINK_ALT: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_ALT, 0, adress, val, UNIT_METERS, 0); + break; + case MLINK_FUEL: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_FUEL, 0, adress, val, UNIT_PERCENT, 0); + break; + case MLINK_CAPACITY: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_CAPACITY, 0, adress, val, UNIT_MAH, 0); + break; + case MLINK_FLOW: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_FLOW, 0, adress, val, UNIT_MILLILITERS, 0); + break; + case MLINK_DISTANCE: + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_DISTANCE, 0, adress, val, UNIT_KM, 1); + break; + case MLINK_LQI: + uint8_t mlinkRssi = data[i + 1] >> 1; + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_LQI, 0, 0, mlinkRssi, UNIT_RAW, 0); + telemetryData.rssi.set(mlinkRssi); + if (mlinkRssi > 0) { + telemetryStreaming = TELEMETRY_TIMEOUT10ms; + } + break; + } + } + } + else if (packet[2] == 0x03) { // Telemetry type RX-5 + uint16_t mlinkRssi = (packet[4] * 100) / 35; + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_LQI, 0, 0, mlinkRssi, UNIT_RAW, 0); + telemetryData.rssi.set(mlinkRssi); + if (mlinkRssi > 0) { + telemetryStreaming = TELEMETRY_TIMEOUT10ms; + } + setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_LOSS, 0, 0, packet[7], UNIT_RAW, 0); + } +} + +void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance) +{ + TelemetrySensor &telemetrySensor = g_model.telemetrySensors[index]; + telemetrySensor.id = id; + telemetrySensor.subId = subId; + telemetrySensor.instance = instance; + + const MLinkSensor * sensor = getMLinkSensor(id); + if (sensor) { + TelemetryUnit unit = sensor->unit; + uint8_t prec = min(2, sensor->precision); + telemetrySensor.init(sensor->name, unit, prec); + if (unit == UNIT_RPMS) { + telemetrySensor.custom.ratio = 1; + telemetrySensor.custom.offset = 1; + } + } + else { + telemetrySensor.init(id); + } + + storageDirty(EE_MODEL); +} diff --git a/radio/src/telemetry/mlink.h b/radio/src/telemetry/mlink.h new file mode 100644 index 000000000..eb5da955e --- /dev/null +++ b/radio/src/telemetry/mlink.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +enum { + MLINK_VOLTAGE = 1, + MLINK_CURRENT = 2, + MLINK_VARIO = 3, + MLINK_SPEED = 4, + MLINK_RPM = 5, + MLINK_TEMP = 6, + MLINK_HEADING = 7, + MLINK_ALT = 8, + MLINK_FUEL = 9, + MLINK_LQI = 10, + MLINK_CAPACITY = 11, + MLINK_FLOW = 12, + MLINK_DISTANCE = 13, + MLINK_RX_VOLTAGE = 16, // out of range ID for specific RxBt treatment + MLINK_LOSS = 17, // out of range ID for handling number of loss + MLINK_TX_RSSI = 18, // out of range ID for handling Telemetry RSSi reported by multi + MLINK_TX_LQI = 19, // out of range ID for handling Telemetry LQI reported by multi +}; + +void processMLinkTelemetryData(uint8_t data, uint8_t* rxBuffer, uint8_t& rxBufferCount); +void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance); + +// Used by multi protocol +void processMLinkPacket(const uint8_t *packet); diff --git a/radio/src/telemetry/multi.cpp b/radio/src/telemetry/multi.cpp index b1b86eb0a..49a5b0d58 100644 --- a/radio/src/telemetry/multi.cpp +++ b/radio/src/telemetry/multi.cpp @@ -42,6 +42,7 @@ enum MultiPacketTypes : uint8_t FlyskyIBusTelemetryAC, MultiRxChannels, HottTelemetry, + MLinkTelemetry }; enum MultiBufferState : uint8_t @@ -379,6 +380,13 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module) TRACE("[MP] Received HoTT telemetry len %d < 14", len); break; + case MLinkTelemetry: + if (len > 6) + processMLinkPacket(data); + else + TRACE("[MP] Received M-Link telemetry len %d < 6", len); + break; + case FrSkyHubTelemetry: if (len >= 4) frskyDProcessPacket(data); diff --git a/radio/src/telemetry/telemetry.h b/radio/src/telemetry/telemetry.h index 6599db749..d70dbc6be 100644 --- a/radio/src/telemetry/telemetry.h +++ b/radio/src/telemetry/telemetry.h @@ -33,6 +33,7 @@ #include "hitec.h" #include "hott.h" #include "multi.h" + #include "mlink.h" #endif #if defined(MULTIMODULE) || defined(AFHDS3) #include "flysky_ibus.h" diff --git a/radio/src/telemetry/telemetry_sensors.cpp b/radio/src/telemetry/telemetry_sensors.cpp index e88807062..b439bd678 100644 --- a/radio/src/telemetry/telemetry_sensors.cpp +++ b/radio/src/telemetry/telemetry_sensors.cpp @@ -559,6 +559,10 @@ int setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, ui case PROTOCOL_TELEMETRY_HOTT: hottSetDefault(index, id, subId, instance); break; + + case PROTOCOL_TELEMETRY_MLINK: + mlinkSetDefault(index, id, subId, instance); + break; #endif #if defined(LUA) diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 26c96a182..771093985 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -260,7 +260,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Metr.\0""Imper.", "Metrické""Imperial") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1381,3 +1381,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 1e8d7ce96..f0091ef99 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -263,7 +263,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\012") #define TR_VUNITSSYSTEM TR("Metrik""Imper.", "Metrisch\0 ""Imperial\0 ") #define LEN_VTELEMUNIT "\003" - #define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" + #define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1388,3 +1388,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 3ec8c1e31..1fcb635cf 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -263,7 +263,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Metric""Imper.", "Metric\0 ""Imperial") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1385,3 +1385,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 31a0b8afc..793be030b 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -260,7 +260,7 @@ #define LEN_VUNITSSYSTEM "\010" #define TR_VUNITSSYSTEM "Métrico\0""Imperial" #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1384,3 +1384,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 1158806f0..0fa5467ea 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -281,7 +281,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Metric""Imper.", "Metric\0 ""Imperial") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1392,3 +1392,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 5e59ba68d..9190811ed 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -283,7 +283,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\012") #define TR_VUNITSSYSTEM TR("Métr.\0""Impér.", "Métriques\0""Impériales") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1409,3 +1409,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 2d25fffec..277b21458 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -284,7 +284,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\011") #define TR_VUNITSSYSTEM TR("Metric""Imper.", "Metriche\0""Imperiali") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1402,3 +1402,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index f9a2be448..3e9e04641 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -264,7 +264,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Mtrsch""Engels", "Metrisch\0 ""Engels\0 ") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1394,3 +1394,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 200072288..a77acbcd3 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -281,7 +281,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") /*8 decimal*/ #define TR_VUNITSSYSTEM TR("Metr. ""Imper.", "Metryczn""Imperial") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1401,3 +1401,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 0d1d597ac..3241e9ce4 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -277,7 +277,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Metric""Imper.", "Metric\0 ""Imperial") #define LEN_VTELEMUNIT "\003" - #define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" + #define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1401,3 +1401,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index c3d3267d3..4cd3b0df4 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -278,7 +278,7 @@ #define LEN_VUNITSSYSTEM TR("\006", "\010") #define TR_VUNITSSYSTEM TR("Metri.""Imper.", "Metriska""Imperial") #define LEN_VTELEMUNIT "\003" -#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0" +#define TR_VTELEMUNIT "-\0 ""V\0 ""A\0 ""mA\0""kts""m/s""f/s""kmh""mph""m\0 ""ft\0""@C\0""@F\0""%\0 ""mAh""W\0 ""mW\0""dB\0""rpm""g\0 ""@\0 ""rad""ml\0""fOz""mlm""Hz\0""mS\0""uS\0""km\0" #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) @@ -1401,3 +1401,6 @@ #define ZSTR_SERVO_VOLTAGE "SrvV" #define ZSTR_SERVO_TEMPERATURE "SrvT" #define ZSTR_SERVO_STATUS "SrvS" +#define ZSTR_LOSS "Loss" +#define ZSTR_SPEED "Spd " +#define ZSTR_FLOW "Flow" diff --git a/radio/util/tts_en.py b/radio/util/tts_en.py index 616abe516..6230aafe9 100755 --- a/radio/util/tts_en.py +++ b/radio/util/tts_en.py @@ -41,6 +41,7 @@ for i, (s, f) in enumerate([("volt", "volt0"), ("volts", "volt1"), ("hertz", "hertz0"), ("hertz", "hertz1"), ("milisecond", "ms0"), ("miliseconds", "ms1"), ("microsecond", "us0"), ("microseconds", "us1"), + ("kilometer", "km0"), ("kilometers", "km1"), ("hour", "hour0"), ("hours", "hour1"), ("minute", "minute0"), ("minutes", "minute1"), ("second", "second0"), ("seconds", "second1"), diff --git a/radio/util/tts_fr.py b/radio/util/tts_fr.py index 9dc046fa5..eba461d72 100755 --- a/radio/util/tts_fr.py +++ b/radio/util/tts_fr.py @@ -39,6 +39,10 @@ for i, (s, f) in enumerate([("volts", "volt0"), ("millilitres", "ml0"), ("onces", "founce0"), ("millilitre minute", "mlpm0"), + ("microsecond", "us0"), + ("milisecond", "ms0"), + ("hertz", "hertz0"), + ("kilometre", "km0"), ("heure", "hour0"), ("minute", "minute0"), ("seconde", "second0"), From f8bd7b7fb85f5eeab5698b7392d1d50810b87013 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 10 Mar 2021 21:27:56 +0100 Subject: [PATCH 114/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index b45c8d90c..8e8a616aa 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2178,3 +2178,4 @@ Stefano Boggia James Rhodes Peter Gaskill Jacques Temey +Anthony Challis From 1f8692aed344ad69b5f12a5516667232ec0d8de9 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 11 Mar 2021 14:41:20 +1100 Subject: [PATCH 115/188] Fix delete input --- companion/src/modeledit/inputs.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index 8636d6335..1f7fd2b0b 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -351,7 +351,7 @@ void InputsPanel::expoOpen(QListWidgetItem *item) if (!item) item = ExposlistWidget->currentItem(); - if (item == nullptr) + if (item == nullptr) return; int idx = item->data(Qt::UserRole).toByteArray().at(0); @@ -372,7 +372,7 @@ void InputsPanel::expoOpen(QListWidgetItem *item) void InputsPanel::expoAdd() { QListWidgetItem *item = ExposlistWidget->currentItem(); - if (item == nullptr) + if (item == nullptr) return; int index = item->data(Qt::UserRole).toByteArray().at(0); @@ -580,13 +580,15 @@ bool InputsPanel::cmInputMoveUpAllowed() const void InputsPanel::cmInputClear() { - if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all lines for the selected Inputs. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) + if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all lines for the selected Input. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; for (int i = CPN_MAX_EXPOS - 1; i >= 0; i--) { ExpoData *ed = &model->expoData[i]; - if ((int)ed->chn == inputIdx) - model->removeInput(i); + if (!ed->isEmpty()) { + if ((int)ed->chn == inputIdx) + model->removeInput(i); + } } model->updateAllReferences(ModelData::REF_UPD_TYPE_INPUT, ModelData::REF_UPD_ACT_CLEAR, inputIdx); update(); @@ -596,15 +598,17 @@ void InputsPanel::cmInputClear() void InputsPanel::cmInputDelete() { - if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Delete all lines for the selected Inputs. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) + if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Delete all lines for the selected Input. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; - for (int i = 0; i < CPN_MAX_EXPOS; i++) { + for (int i = CPN_MAX_EXPOS - 1; i >= 0; i--) { ExpoData *ed = &model->expoData[i]; - if ((int)ed->chn == inputIdx) - model->removeInput(i); - else if ((int)ed->chn > inputIdx) - ed->chn--; + if (!ed->isEmpty()) { + if ((int)ed->chn == inputIdx) + model->removeInput(i); + else if ((int)ed->chn > inputIdx) + ed->chn--; + } } for (int i = inputIdx; i < inputsCount; i++) { From 92e33d02659e07ef2920b5a71eabd819f3c60657 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 11 Mar 2021 20:10:03 +0100 Subject: [PATCH 116/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8e8a616aa..fc9d7f707 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2179,3 +2179,4 @@ James Rhodes Peter Gaskill Jacques Temey Anthony Challis +Gerard Falaise From 6410dcb43c8cfced638818301fc91fc09dedd6bb Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 12 Mar 2021 10:17:51 +0100 Subject: [PATCH 117/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index fc9d7f707..637915fbb 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2180,3 +2180,4 @@ Peter Gaskill Jacques Temey Anthony Challis Gerard Falaise +George McGinnis From 110e1a5fc7a3b863e0a19cd0e7066c3de58aa78f Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 12 Mar 2021 10:32:56 +1100 Subject: [PATCH 118/188] Move getElementName to helpers and move timerdata to own files --- companion/src/firmwares/CMakeLists.txt | 3 +- companion/src/firmwares/datahelpers.cpp | 31 ++++++++++ .../{helpersdata.h => datahelpers.h} | 8 ++- companion/src/firmwares/modeldata.cpp | 25 -------- companion/src/firmwares/modeldata.h | 30 +-------- companion/src/firmwares/radiodata.cpp | 17 ------ companion/src/firmwares/radiodata.h | 11 ++-- companion/src/firmwares/sensordata.cpp | 4 +- companion/src/firmwares/sensordata.h | 2 +- companion/src/firmwares/timerdata.cpp | 50 +++++++++++++++ companion/src/firmwares/timerdata.h | 61 +++++++++++++++++++ 11 files changed, 159 insertions(+), 83 deletions(-) create mode 100644 companion/src/firmwares/datahelpers.cpp rename companion/src/firmwares/{helpersdata.h => datahelpers.h} (87%) create mode 100644 companion/src/firmwares/timerdata.cpp create mode 100644 companion/src/firmwares/timerdata.h diff --git a/companion/src/firmwares/CMakeLists.txt b/companion/src/firmwares/CMakeLists.txt index 3bc2ca275..b79d8fd42 100644 --- a/companion/src/firmwares/CMakeLists.txt +++ b/companion/src/firmwares/CMakeLists.txt @@ -23,11 +23,13 @@ set(firmwares_SRCS rawswitch.cpp sensordata.cpp telem_data.cpp + timerdata.cpp afhds3.cpp ersky9x/ersky9xeeprom.cpp ersky9x/ersky9xinterface.cpp opentx/opentxeeprom.cpp opentx/opentxinterface.cpp + datahelpers.cpp ) string(REPLACE ".cpp" ".h" firmwares_HDRS "${firmwares_SRCS}") @@ -35,7 +37,6 @@ string(REPLACE ".cpp" ".h" firmwares_HDRS "${firmwares_SRCS}") list(APPEND firmwares_HDRS eepromimportexport.h moduledata.h - helpersdata.h ) set(firmwares_QT diff --git a/companion/src/firmwares/datahelpers.cpp b/companion/src/firmwares/datahelpers.cpp new file mode 100644 index 000000000..7aab674ad --- /dev/null +++ b/companion/src/firmwares/datahelpers.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "datahelpers.h" + +QString DataHelpers::getElementName(const QString & prefix, const unsigned int index, const char * name, const bool padding) +{ + QString result = prefix; + result.append(padding ? QString("%1").arg(index, 2, 10, QChar('0')) : QString("%1").arg(index)); + if (name && QString(name).trimmed().length() > 0) + result.append(":" + QString(name).trimmed()); + + return result; +} diff --git a/companion/src/firmwares/helpersdata.h b/companion/src/firmwares/datahelpers.h similarity index 87% rename from companion/src/firmwares/helpersdata.h rename to companion/src/firmwares/datahelpers.h index 29273e5f0..3291e7b47 100644 --- a/companion/src/firmwares/helpersdata.h +++ b/companion/src/firmwares/datahelpers.h @@ -24,8 +24,6 @@ class FieldRange { - Q_DECLARE_TR_FUNCTIONS(FieldRange) - public: FieldRange(): decimals(0), @@ -48,3 +46,9 @@ class FieldRange QString prefix; QString unit; }; + +namespace DataHelpers +{ + QString getElementName(const QString & prefix, const unsigned int index, const char * name = 0, const bool padding = false); + +} diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 7657e2798..3efb7ae6a 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -27,31 +27,6 @@ #include "helpers.h" #include "adjustmentreference.h" -/* - * TimerData - */ - -void TimerData::convert(RadioDataConversionState & cstate) -{ - cstate.setComponent(tr("TMR"), 1); - cstate.setSubComp(tr("Timer %1").arg(cstate.subCompIdx + 1)); - mode.convert(cstate); -} - -bool TimerData::isEmpty() -{ - return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWN_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/); -} - -QString TimerData::nameToString(int index) const -{ - return RadioData::getElementName(tr("TMR", "as in Timer"), index + 1, name); -} - -/* - * ModelData - */ - ModelData::ModelData() { clear(); diff --git a/companion/src/firmwares/modeldata.h b/companion/src/firmwares/modeldata.h index 80b7d7353..14a9386ee 100644 --- a/companion/src/firmwares/modeldata.h +++ b/companion/src/firmwares/modeldata.h @@ -33,6 +33,7 @@ #include "output_data.h" #include "sensordata.h" #include "telem_data.h" +#include "timerdata.h" #include @@ -55,35 +56,6 @@ class RSSIAlarmData { } }; -#define TIMER_NAME_LEN 8 - -class TimerData { - Q_DECLARE_TR_FUNCTIONS(TimerData) - - public: - enum CountDownMode { - COUNTDOWN_SILENT, - COUNTDOWN_BEEPS, - COUNTDOWN_VOICE, - COUNTDOWN_HAPTIC - }; - TimerData() { clear(); } - RawSwitch mode; - char name[TIMER_NAME_LEN+1]; - bool minuteBeep; - unsigned int countdownBeep; - unsigned int val; - unsigned int persistent; - int countdownStart; - unsigned int direction; - int pvalue; - void clear() { memset(reinterpret_cast(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); } - void convert(RadioDataConversionState & cstate); - bool isEmpty(); - bool isModeOff() { return mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); } - QString nameToString(int index) const; -}; - #define CPN_MAX_SCRIPTS 9 #define CPN_MAX_SCRIPT_INPUTS 10 class ScriptData { diff --git a/companion/src/firmwares/radiodata.cpp b/companion/src/firmwares/radiodata.cpp index 8054e5b1a..c833281fd 100644 --- a/companion/src/firmwares/radiodata.cpp +++ b/companion/src/firmwares/radiodata.cpp @@ -22,23 +22,6 @@ #include "radiodataconversionstate.h" #include "eeprominterface.h" -// static -QString RadioData::getElementName(const QString & prefix, unsigned int index, const char * name, bool padding) -{ - QString result = prefix; - if (padding) - result += QString("%1").arg(index, 2, 10, QChar('0')); - else - result += QString("%1").arg(index); - if (name) { - QString trimmed = QString(name).trimmed(); - if (trimmed.length() > 0) { - result += ":" + QString(name).trimmed(); - } - } - return result; -} - RadioData::RadioData() { models.resize(getCurrentFirmware()->getCapability(Models)); diff --git a/companion/src/firmwares/radiodata.h b/companion/src/firmwares/radiodata.h index 29d29e4eb..d289f1846 100644 --- a/companion/src/firmwares/radiodata.h +++ b/companion/src/firmwares/radiodata.h @@ -1,9 +1,10 @@ -#ifndef _RADIODATA_H_ -#define _RADIODATA_H_ +#pragma once #include "generalsettings.h" #include "modeldata.h" +#include "datahelpers.h" // required for getElementName + #include class RadioDataConversionState; @@ -32,10 +33,10 @@ class RadioData { void fixModelFilenames(); QString getNextModelFilename(); - static QString getElementName(const QString & prefix, unsigned int index, const char * name = 0, bool padding = false); + // leave here until all calls repointed + static QString getElementName(const QString & prefix, unsigned int index, const char * name = 0, bool padding = false) + { return DataHelpers::getElementName(prefix, index, name, padding); } protected: void fixModelFilename(unsigned int index); }; - -#endif // _RADIODATA_H_ diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp index 2c0866e66..12dcdd848 100644 --- a/companion/src/firmwares/sensordata.cpp +++ b/companion/src/firmwares/sensordata.cpp @@ -19,8 +19,6 @@ */ #include "sensordata.h" - -#include "radiodata.h" #include "modeldata.h" #include "eeprominterface.h" #include "compounditemmodels.h" @@ -35,7 +33,7 @@ void SensorData::updateUnit() QString SensorData::nameToString(int index) const { - return RadioData::getElementName(tr("TELE"), index + 1, label); + return DataHelpers::getElementName(tr("TELE"), index + 1, label); } QString SensorData::getOrigin(const ModelData * model) const diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h index 2353a0ebf..b93af0a84 100644 --- a/companion/src/firmwares/sensordata.h +++ b/companion/src/firmwares/sensordata.h @@ -20,7 +20,7 @@ #pragma once -#include "helpersdata.h" +#include "datahelpers.h" #include diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp new file mode 100644 index 000000000..986ff1aa5 --- /dev/null +++ b/companion/src/firmwares/timerdata.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "timerdata.h" +#include "radiodataconversionstate.h" + +void TimerData::convert(RadioDataConversionState & cstate) +{ + cstate.setComponent(tr("TMR"), 1); + cstate.setSubComp(tr("Timer %1").arg(cstate.subCompIdx + 1)); + mode.convert(cstate); +} + +void TimerData::clear() +{ + memset(reinterpret_cast(this), 0, sizeof(TimerData)); + mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); +} + +bool TimerData::isEmpty() +{ + return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWN_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/); +} + +bool TimerData::isModeOff() +{ + return mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); +} + +QString TimerData::nameToString(int index) const +{ + return DataHelpers::getElementName(tr("TMR", "as in Timer"), index + 1, name); +} diff --git a/companion/src/firmwares/timerdata.h b/companion/src/firmwares/timerdata.h new file mode 100644 index 000000000..2d5356331 --- /dev/null +++ b/companion/src/firmwares/timerdata.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include "rawswitch.h" +#include "datahelpers.h" + +#include + +class RadioDataConversionState; + +#define TIMER_NAME_LEN 8 + +class TimerData { + Q_DECLARE_TR_FUNCTIONS(TimerData) + + public: + enum CountDownMode { + COUNTDOWN_SILENT, + COUNTDOWN_BEEPS, + COUNTDOWN_VOICE, + COUNTDOWN_HAPTIC, + COUNTDOWN_COUNT + }; + + TimerData() { clear(); } + + RawSwitch mode; + char name[TIMER_NAME_LEN + 1]; + bool minuteBeep; + unsigned int countdownBeep; + unsigned int val; + unsigned int persistent; + int countdownStart; + unsigned int direction; + int pvalue; + + void convert(RadioDataConversionState & cstate); + void clear(); + bool isEmpty(); + bool isModeOff(); + QString nameToString(int index) const; +}; From 03497d8fc2ec6ef1e9067729afa3eb511219eafe Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 12 Mar 2021 22:50:58 +0100 Subject: [PATCH 119/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 637915fbb..7cc83e580 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2181,3 +2181,4 @@ Jacques Temey Anthony Challis Gerard Falaise George McGinnis +Antoine Soulie From ef1d0e8a82678a46ebab1fe7e557afb15c1d01ca Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 13 Mar 2021 12:16:05 +0100 Subject: [PATCH 120/188] Please Travis ? --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6ddb599b5..77cc9adfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: - libmpc3 - libfox-1.6-dev - libgtest-dev + - libclang-common-6.0-dev - clang-6.0 - python3-pip From a0d96ab39fc7d4e926fc27bbaff8e7453e671e34 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 13 Mar 2021 12:18:52 +0100 Subject: [PATCH 121/188] Please Travis ? --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 77cc9adfc..909cf534d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: - libmpc3 - libfox-1.6-dev - libgtest-dev + - lib32stdc++6 - libclang-common-6.0-dev - clang-6.0 - python3-pip From 1a4eb0636e6652af9c9197cefed2be814907032a Mon Sep 17 00:00:00 2001 From: Risto Date: Sat, 13 Mar 2021 17:57:53 +0100 Subject: [PATCH 122/188] Minor comment fix in hal.h (#8361) Minor comment fix in hal.h for AUX_SERIAL_PWR_GPIO_PIN port and pin. --- radio/src/targets/horus/hal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 48bd8ff30..b094bb333 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -422,7 +422,7 @@ #define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4 #if defined(RADIO_TX16S) #define AUX_SERIAL_PWR_GPIO GPIOA - #define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PB.00 + #define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PA.15 #define TRAINER_BATTERY_COMPARTMENT // allows serial port TTL trainer #endif #else From fe5294c127f14e2aa0ea9a5f800dd40c805e2da6 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sat, 13 Mar 2021 08:52:06 +1100 Subject: [PATCH 123/188] Add booltostring functions to datahelpers --- companion/src/firmwares/datahelpers.cpp | 18 ++++++++++++++++++ companion/src/firmwares/datahelpers.h | 9 +++++++++ companion/src/firmwares/sensordata.cpp | 10 +++++----- companion/src/firmwares/sensordata.h | 1 - 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/companion/src/firmwares/datahelpers.cpp b/companion/src/firmwares/datahelpers.cpp index 7aab674ad..78ac15037 100644 --- a/companion/src/firmwares/datahelpers.cpp +++ b/companion/src/firmwares/datahelpers.cpp @@ -20,6 +20,24 @@ #include "datahelpers.h" +QString DataHelpers::boolToString(const bool value, const BoolFormat format) +{ + static const char *strings[] = { + QT_TRANSLATE_NOOP("DataHelpers", "Disabled"), + QT_TRANSLATE_NOOP("DataHelpers", "Enabled"), + QT_TRANSLATE_NOOP("DataHelpers", "OFF"), + QT_TRANSLATE_NOOP("DataHelpers", "ON"), + QT_TRANSLATE_NOOP("DataHelpers", "False"), + QT_TRANSLATE_NOOP("DataHelpers", "True"), + QT_TRANSLATE_NOOP("DataHelpers", "N"), + QT_TRANSLATE_NOOP("DataHelpers", "Y"), + QT_TRANSLATE_NOOP("DataHelpers", "No"), + QT_TRANSLATE_NOOP("DataHelpers", "Yes") + }; + + return QCoreApplication::translate("DataHelpers", strings[format * 2 + value]); +} + QString DataHelpers::getElementName(const QString & prefix, const unsigned int index, const char * name, const bool padding) { QString result = prefix; diff --git a/companion/src/firmwares/datahelpers.h b/companion/src/firmwares/datahelpers.h index 3291e7b47..ed46da717 100644 --- a/companion/src/firmwares/datahelpers.h +++ b/companion/src/firmwares/datahelpers.h @@ -49,6 +49,15 @@ class FieldRange namespace DataHelpers { + enum BoolFormat { + BOOL_FMT_ENABLEDISABLE, + BOOL_FMT_ONOFF, + BOOL_FMT_TRUEFALSE, + BOOL_FMT_YN, + BOOL_FMT_YESNO + }; + + QString boolToString(const bool value, const BoolFormat format); QString getElementName(const QString & prefix, const unsigned int index, const char * name = 0, const bool padding = false); } diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp index 12dcdd848..ae602bd0d 100644 --- a/companion/src/firmwares/sensordata.cpp +++ b/companion/src/firmwares/sensordata.cpp @@ -169,7 +169,7 @@ QString SensorData::paramsToString(const ModelData * model) const int precsn = prec == 0 ? 1 : pow(10, prec); str.append(QString(FMT_LABEL_VALUE).arg(tr("Ratio")).arg((float)ratio / 10)); str.append(QString(FMT_LABEL_VALUE).arg(tr("Offset")).arg(QString::number((float)offset / precsn, 'f', prec))); - str.append(QString(FMT_LABEL_VALUE).arg(tr("Auto Offset")).arg(boolToString(autoOffset))); + str.append(QString(FMT_LABEL_VALUE).arg(tr("Auto Offset")).arg(DataHelpers::boolToString(autoOffset, DataHelpers::BOOL_FMT_YN))); } else { str.append(QString(FMT_LABEL_VALUE).arg(tr("Blades")).arg(ratio)); // TODO refactor to dedicated RPMS field @@ -178,15 +178,15 @@ QString SensorData::paramsToString(const ModelData * model) const } if (mask & SENSOR_ISCONFIGURABLE) - str.append(QString(FMT_LABEL_VALUE).arg(tr("Filter")).arg(boolToString(filter))); + str.append(QString(FMT_LABEL_VALUE).arg(tr("Filter")).arg(DataHelpers::boolToString(filter, DataHelpers::BOOL_FMT_YN))); if (type == TELEM_TYPE_CALCULATED) - str.append(QString(FMT_LABEL_VALUE).arg(tr("Persist")).arg(boolToString(persistent))); + str.append(QString(FMT_LABEL_VALUE).arg(tr("Persist")).arg(DataHelpers::boolToString(persistent, DataHelpers::BOOL_FMT_YN))); if (mask & SENSOR_HAS_POSITIVE) - str.append(QString(FMT_LABEL_VALUE).arg(tr("Positive")).arg(boolToString(onlyPositive))); + str.append(QString(FMT_LABEL_VALUE).arg(tr("Positive")).arg(DataHelpers::boolToString(onlyPositive, DataHelpers::BOOL_FMT_YN))); - str.append(QString(FMT_LABEL_VALUE).arg(tr("Log")).arg(boolToString(logs))); + str.append(QString(FMT_LABEL_VALUE).arg(tr("Log")).arg(DataHelpers::boolToString(logs, DataHelpers::BOOL_FMT_YN))); return str; } diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h index b93af0a84..8a032cec5 100644 --- a/companion/src/firmwares/sensordata.h +++ b/companion/src/firmwares/sensordata.h @@ -205,7 +205,6 @@ class SensorData { static QString cellIndexToString(const int value); static QString unitToString(const int value); static QString precToString(const int value); - static QString boolToString(const bool value) { return value ? tr("Y") : tr("N"); } static bool isRssiSensorAvailable(const ModelData * model, const int value); static QString rssiSensorToString(const ModelData * model, const int value); From 7940515a48c6241a04f500187d9a5889650c9966 Mon Sep 17 00:00:00 2001 From: Risto Date: Sat, 13 Mar 2021 22:43:26 +0100 Subject: [PATCH 124/188] telemetry dir pin init missed oType def Added missing OType definition to telemetry direction pin. --- radio/src/targets/horus/telemetry_driver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/src/targets/horus/telemetry_driver.cpp b/radio/src/targets/horus/telemetry_driver.cpp index 0288363be..165e65933 100644 --- a/radio/src/targets/horus/telemetry_driver.cpp +++ b/radio/src/targets/horus/telemetry_driver.cpp @@ -34,6 +34,7 @@ static void telemetryInitDirPin() GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Pin = TELEMETRY_DIR_GPIO_PIN; GPIO_Init(TELEMETRY_DIR_GPIO, &GPIO_InitStructure); GPIO_ResetBits(TELEMETRY_DIR_GPIO, TELEMETRY_DIR_GPIO_PIN); From b4478ea48f65d79fefe94248b44b2070a224edfc Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 14 Mar 2021 09:32:56 +1100 Subject: [PATCH 125/188] Timerdata refactoring --- companion/src/firmwares/timerdata.cpp | 106 ++++++++++++++++++++++++++ companion/src/firmwares/timerdata.h | 39 ++++++++-- 2 files changed, 139 insertions(+), 6 deletions(-) diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp index 986ff1aa5..484dfe019 100644 --- a/companion/src/firmwares/timerdata.cpp +++ b/companion/src/firmwares/timerdata.cpp @@ -48,3 +48,109 @@ QString TimerData::nameToString(int index) const { return DataHelpers::getElementName(tr("TMR", "as in Timer"), index + 1, name); } + +QString TimerData::countdownBeepToString() const +{ + return countdownBeepToString(countdownBeep); +} + +QString TimerData::countdownStartToString() const +{ + return countdownStartToString(countdownStart); +} + +QString TimerData::persistentToString() const +{ + return persistentToString(persistent); +} + +// static +QString TimerData::countdownBeepToString(const int value) +{ + switch(value) { + case COUNTDOWNBEEP_SILENT: + return tr("Silent"); + case COUNTDOWNBEEP_BEEPS: + return tr("Beeps"); + case COUNTDOWNBEEP_VOICE: + return tr("Voice"); + case COUNTDOWNBEEP_HAPTIC: + return tr("Haptic"); + default: + return CPN_STR_UNKNOWN_ITEM; + } +} + +// static +QString TimerData::countdownStartToString(const int value) +{ + switch(value) { + case COUNTDOWNSTART_5: + return tr("5s"); + case COUNTDOWNSTART_10: + return tr("10s"); + case COUNTDOWNSTART_20: + return tr("20s"); + case COUNTDOWNSTART_30: + return tr("30s"); + default: + return CPN_STR_UNKNOWN_ITEM; + } +} + +// static +QString TimerData::persistentToString(const int value) +{ + switch(value) { + case PERSISTENT_NOT: + return tr("Not persistent"); + case PERSISTENT_FLIGHT: + return tr("Persistent (flight)"); + case PERSISTENT_MANUALRESET: + return tr("Persistent (manual reset)"); + default: + return CPN_STR_UNKNOWN_ITEM; + } +} + +// static +AbstractStaticItemModel * TimerData::countdownBeepItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("timerdata.countdownBeep"); + + for (int i = 0; i < COUNTDOWNBEEP_COUNT; i++) { + QString str = countdownBeepToString(i); + } + + mdl->loadItemList(); + return mdl; +} + +// static +AbstractStaticItemModel * TimerData::countdownStartItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("timerdata.countdownStart"); + + for (int i = COUNTDOWNSTART_LAST - 1; i >= COUNTDOWNSTART_FIRST; i--) { + QString str = countdownStartToString(i); + } + + mdl->loadItemList(); + return mdl; +} + +// static +AbstractStaticItemModel * TimerData::persistentItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("timerdata.persistent"); + + for (int i = 0; i < PERSISTENT_COUNT; i++) { + QString str = persistentToString(i); + } + + mdl->loadItemList(); + return mdl; +} diff --git a/companion/src/firmwares/timerdata.h b/companion/src/firmwares/timerdata.h index 2d5356331..e2949cd6b 100644 --- a/companion/src/firmwares/timerdata.h +++ b/companion/src/firmwares/timerdata.h @@ -33,12 +33,28 @@ class TimerData { Q_DECLARE_TR_FUNCTIONS(TimerData) public: - enum CountDownMode { - COUNTDOWN_SILENT, - COUNTDOWN_BEEPS, - COUNTDOWN_VOICE, - COUNTDOWN_HAPTIC, - COUNTDOWN_COUNT + enum CountDownBeepType { + COUNTDOWNBEEP_SILENT, + COUNTDOWNBEEP_BEEPS, + COUNTDOWNBEEP_VOICE, + COUNTDOWNBEEP_HAPTIC, + COUNTDOWNBEEP_COUNT + }; + + enum CountDownStart { + COUNTDOWNSTART_30 = -2, + COUNTDOWNSTART_FIRST = COUNTDOWNSTART_30, + COUNTDOWNSTART_20, + COUNTDOWNSTART_10, + COUNTDOWNSTART_5, + COUNTDOWNSTART_LAST = COUNTDOWNSTART_5 + }; + + enum PersistentType { + PERSISTENT_NOT, + PERSISTENT_FLIGHT, + PERSISTENT_MANUALRESET, + PERSISTENT_COUNT }; TimerData() { clear(); } @@ -58,4 +74,15 @@ class TimerData { bool isEmpty(); bool isModeOff(); QString nameToString(int index) const; + QString countdownBeepToString(); + QString countdownStartToString(); + QString persistentToString(); + + static QString countdownBeepToString(const int value); + static QString countdownStartToString(const int value); + static QString persistentToString(const int value); + static AbstractStaticItemModel * countdownBeepItemModel(); + static AbstractStaticItemModel * countdownStartItemModel(); + static AbstractStaticItemModel * persistentItemModel(); + }; From 010d85d146a15b0150091209323925f96ac1e568 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 14 Mar 2021 10:32:25 +0100 Subject: [PATCH 126/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 7cc83e580..a421eb36f 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2182,3 +2182,5 @@ Anthony Challis Gerard Falaise George McGinnis Antoine Soulie +Tjeerd Jager +Bertold Van den Bergh From b11f751127b6f23c398ea70a20d15b730e1df887 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 14 Mar 2021 10:38:42 +0100 Subject: [PATCH 127/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index a421eb36f..c3cc61a76 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2184,3 +2184,4 @@ George McGinnis Antoine Soulie Tjeerd Jager Bertold Van den Bergh +Stefanie Zerbe From c40136d08a2d29918a133b5276fa7754d92b3ca9 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 14 Mar 2021 23:35:52 +1100 Subject: [PATCH 128/188] Add data models to setup timers --- .../src/datamodels/compounditemmodels.cpp | 10 ++ companion/src/datamodels/compounditemmodels.h | 1 + companion/src/firmwares/datahelpers.cpp | 21 +++ companion/src/firmwares/datahelpers.h | 6 + companion/src/firmwares/timerdata.cpp | 32 +++-- companion/src/firmwares/timerdata.h | 17 ++- companion/src/modeledit/setup.cpp | 134 ++++++++++-------- companion/src/modeledit/setup.h | 20 ++- companion/src/modeledit/setup_timer.ui | 23 ++- companion/src/modelprinter.cpp | 40 ------ companion/src/modelprinter.h | 4 - companion/src/multimodelprinter.cpp | 8 +- 12 files changed, 179 insertions(+), 137 deletions(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index ab0ba83ba..b243bf09a 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -717,6 +717,16 @@ AbstractItemModel * CompoundItemModelFactory::getItemModel(const int id) const return nullptr; } +AbstractItemModel * CompoundItemModelFactory::getItemModel(const QString name) const +{ + foreach (AbstractItemModel * itemModel, registeredItemModels) { + if (itemModel->getName() == name) + return itemModel; + } + + return nullptr; +} + bool CompoundItemModelFactory::isItemModelRegistered(const int id) const { foreach (AbstractItemModel * itemModel, registeredItemModels) { diff --git a/companion/src/datamodels/compounditemmodels.h b/companion/src/datamodels/compounditemmodels.h index 7acfcbdc9..d5a7c5f27 100644 --- a/companion/src/datamodels/compounditemmodels.h +++ b/companion/src/datamodels/compounditemmodels.h @@ -363,6 +363,7 @@ class CompoundItemModelFactory void unregisterItemModel(const int id); bool isItemModelRegistered(const int id) const; AbstractItemModel * getItemModel(const int id) const; + AbstractItemModel * getItemModel(const QString name) const; void update(const int event = AbstractItemModel::IMUE_SystemRefresh); void dumpAllItemModelContents() const; diff --git a/companion/src/firmwares/datahelpers.cpp b/companion/src/firmwares/datahelpers.cpp index 78ac15037..8ae759a1b 100644 --- a/companion/src/firmwares/datahelpers.cpp +++ b/companion/src/firmwares/datahelpers.cpp @@ -47,3 +47,24 @@ QString DataHelpers::getElementName(const QString & prefix, const unsigned int i return result; } + +QString DataHelpers::timeToString(const int value, const unsigned int mask) +{ + bool negative = value < 0 ? true : false; + int val = abs(value); + + QString result = QString("%1").arg(negative ? "-" : ((mask & TIMESTR_MASK_PADSIGN) ? " " : "")); + + if (mask & TIMESTR_MASK_HRSMINS) { + int hours = val / 3600; + if (hours > 0 || (mask & TIMESTR_MASK_ZEROHRS)) { + val -= hours * 3600; + result.append(QString("%1:").arg(hours, 2, 10, QLatin1Char('0'))); + } + } + + int minutes = val / 60; + int seconds = val % 60; + result.append(QString("%1:%2").arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0'))); + return result; +} diff --git a/companion/src/firmwares/datahelpers.h b/companion/src/firmwares/datahelpers.h index ed46da717..ccd3b0f64 100644 --- a/companion/src/firmwares/datahelpers.h +++ b/companion/src/firmwares/datahelpers.h @@ -47,6 +47,11 @@ class FieldRange QString unit; }; + +constexpr unsigned int TIMESTR_MASK_HRSMINS { 1 << 1 }; +constexpr unsigned int TIMESTR_MASK_ZEROHRS { 1 << 2 }; +constexpr unsigned int TIMESTR_MASK_PADSIGN { 1 << 3 }; + namespace DataHelpers { enum BoolFormat { @@ -59,5 +64,6 @@ namespace DataHelpers QString boolToString(const bool value, const BoolFormat format); QString getElementName(const QString & prefix, const unsigned int index, const char * name = 0, const bool padding = false); + QString timeToString(const int value, const unsigned int mask); } diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp index 484dfe019..c46351df8 100644 --- a/companion/src/firmwares/timerdata.cpp +++ b/companion/src/firmwares/timerdata.cpp @@ -20,6 +20,7 @@ #include "timerdata.h" #include "radiodataconversionstate.h" +#include "compounditemmodels.h" void TimerData::convert(RadioDataConversionState & cstate) { @@ -36,7 +37,7 @@ void TimerData::clear() bool TimerData::isEmpty() { - return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWN_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/); + return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWNBEEP_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/); } bool TimerData::isModeOff() @@ -59,9 +60,14 @@ QString TimerData::countdownStartToString() const return countdownStartToString(countdownStart); } -QString TimerData::persistentToString() const +QString TimerData::persistentToString(const bool verbose) const { - return persistentToString(persistent); + return persistentToString(persistent, verbose); +} + +QString TimerData::pvalueToString() const +{ + return pvalueToString(pvalue); } // static @@ -99,25 +105,31 @@ QString TimerData::countdownStartToString(const int value) } // static -QString TimerData::persistentToString(const int value) +QString TimerData::persistentToString(const int value, const bool verbose) { switch(value) { case PERSISTENT_NOT: - return tr("Not persistent"); + return verbose ? tr("Not persistent") : tr("NOT"); case PERSISTENT_FLIGHT: - return tr("Persistent (flight)"); + return verbose ? tr("Persistent (flight)") : tr("Flight"); case PERSISTENT_MANUALRESET: - return tr("Persistent (manual reset)"); + return verbose ? tr("Persistent (manual reset)") : tr("Manual reset"); default: return CPN_STR_UNKNOWN_ITEM; } } +// static +QString TimerData::pvalueToString(const int value) +{ + return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS); +} + // static AbstractStaticItemModel * TimerData::countdownBeepItemModel() { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); - mdl->setName("timerdata.countdownBeep"); + mdl->setName(AIM_TIMER_COUNTDOWNBEEP); for (int i = 0; i < COUNTDOWNBEEP_COUNT; i++) { QString str = countdownBeepToString(i); @@ -131,7 +143,7 @@ AbstractStaticItemModel * TimerData::countdownBeepItemModel() AbstractStaticItemModel * TimerData::countdownStartItemModel() { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); - mdl->setName("timerdata.countdownStart"); + mdl->setName(AIM_TIMER_COUNTDOWNSTART); for (int i = COUNTDOWNSTART_LAST - 1; i >= COUNTDOWNSTART_FIRST; i--) { QString str = countdownStartToString(i); @@ -145,7 +157,7 @@ AbstractStaticItemModel * TimerData::countdownStartItemModel() AbstractStaticItemModel * TimerData::persistentItemModel() { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); - mdl->setName("timerdata.persistent"); + mdl->setName(AIM_TIMER_PERSISTENT); for (int i = 0; i < PERSISTENT_COUNT; i++) { QString str = persistentToString(i); diff --git a/companion/src/firmwares/timerdata.h b/companion/src/firmwares/timerdata.h index e2949cd6b..fcd1ab87d 100644 --- a/companion/src/firmwares/timerdata.h +++ b/companion/src/firmwares/timerdata.h @@ -26,8 +26,13 @@ #include class RadioDataConversionState; +class AbstractStaticItemModel; -#define TIMER_NAME_LEN 8 +constexpr char AIM_TIMER_COUNTDOWNBEEP[] {"timerdata.countdownBeep"}; +constexpr char AIM_TIMER_COUNTDOWNSTART[] {"timerdata.countdownStart"}; +constexpr char AIM_TIMER_PERSISTENT[] {"timerdata.persistent"}; + +constexpr int TIMER_NAME_LEN {8}; class TimerData { Q_DECLARE_TR_FUNCTIONS(TimerData) @@ -74,13 +79,15 @@ class TimerData { bool isEmpty(); bool isModeOff(); QString nameToString(int index) const; - QString countdownBeepToString(); - QString countdownStartToString(); - QString persistentToString(); + QString countdownBeepToString() const; + QString countdownStartToString() const; + QString persistentToString(const bool verbose = true) const; + QString pvalueToString() const; static QString countdownBeepToString(const int value); static QString countdownStartToString(const int value); - static QString persistentToString(const int value); + static QString persistentToString(const int value, const bool verbose = true); + static QString pvalueToString(const int value); static AbstractStaticItemModel * countdownBeepItemModel(); static AbstractStaticItemModel * countdownStartItemModel(); static AbstractStaticItemModel * persistentItemModel(); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index b695b03ff..d3d199cc0 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -22,7 +22,6 @@ #include "ui_setup.h" #include "ui_setup_timer.h" #include "ui_setup_module.h" -#include "filtereditemmodels.h" #include "appdata.h" #include "modelprinter.h" #include "multiprotocols.h" @@ -31,54 +30,51 @@ #include +constexpr char FIM_TIMERSWITCH[] {"Timer Switch"}; +constexpr char FIM_THRSOURCE[] {"Throttle Source"}; + TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, - QWidget * prevFocus, FilteredItemModel * rawSwitchFilteredModel): + QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels): ModelPanel(parent, model, generalSettings, firmware), timer(timer), ui(new Ui::Timer) { ui->setupUi(this); - connectItemModelEvents(rawSwitchFilteredModel); + connectItemModelEvents(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); lock = true; // Name int length = firmware->getCapability(TimersName); - if (length == 0) { + if (length == 0) ui->name->hide(); - } - else { - ui->name->setMaxLength(length); - } + else + ui->name->setField(timer.name, length, this); // Mode - ui->mode->setModel(rawSwitchFilteredModel); + ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); connect(ui->mode, SIGNAL(activated(int)), this, SLOT(onModeChanged(int))); + ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP)); + ui->countdownBeep->setField(timer.countdownBeep, this); + + ui->value->setMaximumTime(firmware->getMaxTimerStart()); + + ui->minuteBeep->setField(timer.minuteBeep, this); + if (!firmware->getCapability(PermTimers)) { ui->persistent->hide(); ui->persistentValue->hide(); } + else { + ui->persistent->setModel(panelItemModels->getItemModel(AIM_TIMER_PERSISTENT)); + ui->persistent->setField(timer.persistent, this); + ui->persistentValue->setText(timer.pvalueToString()); + } - ui->countdownBeep->setField(timer.countdownBeep, this); - ui->countdownBeep->addItem(tr("Silent"), TimerData::COUNTDOWN_SILENT); - ui->countdownBeep->addItem(tr("Beeps"), TimerData::COUNTDOWN_BEEPS); - ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE); - ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC); - - ui->value->setMaximumTime(firmware->getMaxTimerStart()); - - ui->persistent->setField(timer.persistent, this); - ui->persistent->addItem(tr("Not persistent"), 0); - ui->persistent->addItem(tr("Persistent (flight)"), 1); - ui->persistent->addItem(tr("Persistent (manual reset)"), 2); - + ui->countdownStart->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNSTART)); ui->countdownStart->setField(timer.countdownStart, this); - ui->countdownStart->addItem("5s", 1); - ui->countdownStart->addItem("10s", 0); - ui->countdownStart->addItem("20s", -1); - ui->countdownStart->addItem("30s", -2); disableMouseScrolling(); QWidget::setTabOrder(prevFocus, ui->name); @@ -102,32 +98,18 @@ void TimerPanel::update() { lock = true; - ui->name->setText(timer.name); + ui->name->updateValue(); + ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); int hour = timer.val / 3600; int min = (timer.val - (hour * 3600)) / 60; int sec = (timer.val - (hour * 3600)) % 60; - - ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); ui->value->setTime(QTime(hour, min, sec)); - if (firmware->getCapability(PermTimers)) { - int sign = 1; - int pvalue = timer.pvalue; - if (pvalue < 0) { - pvalue = -pvalue; - sign = -1; - } - int hours = pvalue / 3600; - pvalue -= hours * 3600; - int minutes = pvalue / 60; - int seconds = pvalue % 60; - ui->persistentValue->setText(QString(" %1(%2:%3:%4)").arg(sign < 0 ? "-" :" ").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0'))); - } - ui->countdownBeep->updateValue(); - ui->minuteBeep->setChecked(timer.minuteBeep); - ui->persistent->updateValue(); + ui->minuteBeep->updateValue(); + if (firmware->getCapability(PermTimers)) + ui->persistent->updateValue(); ui->countdownStart->updateValue(); lock = false; } @@ -139,10 +121,17 @@ QWidget * TimerPanel::getLastFocus() void TimerPanel::on_countdownBeep_currentIndexChanged(int index) { - if(index == TimerData::COUNTDOWN_SILENT) - ui->countdownStart->hide(); - else - ui->countdownStart->show(); + if (!lock) { + const int start = ui->countdownStart->itemData(index).toInt(); + if (start != timer.countdownStart) { + timer.countdownStart = start; + emit modified(); + if(index == TimerData::COUNTDOWNBEEP_SILENT) + ui->countdownStart->setEnabled(false); + else + ui->countdownStart->setEnabled(true); + } + } } void TimerPanel::on_value_editingFinished() @@ -197,12 +186,27 @@ void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel) void TimerPanel::onItemModelAboutToBeUpdated() { lock = true; + modelsUpdateCnt++; } void TimerPanel::onItemModelUpdateComplete() { - update(); - lock = false; + modelsUpdateCnt--; + if (modelsUpdateCnt < 1) { + update(); + lock = false; + } +} + +void TimerPanel::on_countdownStart_currentIndexChanged(int index) +{ + if (!lock) { + const int start = ui->countdownStart->itemData(index).toInt(); + if (start != timer.countdownStart) { + timer.countdownStart = start; + emit modified(); + } + } } /******************************************************************************/ @@ -1023,16 +1027,26 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge { ui->setupUi(this); - rawSwitchFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), RawSwitch::TimersContext); - connectItemModelEvents(rawSwitchFilteredModel); + lock = true; - thrSourceFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_ThrSource)); - connectItemModelEvents(thrSourceFilteredModel); + panelFilteredModels = new FilteredItemModelFactory(); + + panelFilteredModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), + RawSwitch::TimersContext), + FIM_TIMERSWITCH); + connectItemModelEvents(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); + + panelFilteredModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_ThrSource)), + FIM_THRSOURCE); + connectItemModelEvents(panelFilteredModels->getItemModel(FIM_THRSOURCE)); + + panelItemModels = new CompoundItemModelFactory(&generalSettings, &model); + panelItemModels->registerItemModel(TimerData::countdownBeepItemModel()); + panelItemModels->registerItemModel(TimerData::countdownStartItemModel()); + panelItemModels->registerItemModel(TimerData::persistentItemModel()); Board::Type board = firmware->getBoard(); - lock = true; - memset(modules, 0, sizeof(modules)); QRegExp rx(CHAR_FOR_NAMES_REGEX); @@ -1112,7 +1126,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge for (int i = 0; i < CPN_MAX_TIMERS; i++) { if (i < timersCount) { - timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus, rawSwitchFilteredModel); + timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus, panelFilteredModels, panelItemModels); ui->gridLayout->addWidget(timers[i], 1+i, 1); connect(timers[i], &TimerPanel::modified, this, &SetupPanel::modified); connect(timers[i], &TimerPanel::nameChanged, this, &SetupPanel::onTimerNameChanged); @@ -1279,8 +1293,8 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge SetupPanel::~SetupPanel() { delete ui; - delete rawSwitchFilteredModel; - delete thrSourceFilteredModel; + delete panelFilteredModels; + delete panelItemModels; } void SetupPanel::on_extendedLimits_toggled(bool checked) diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 7409d7b25..24b1625f7 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -18,17 +18,15 @@ * GNU General Public License for more details. */ -#ifndef _SETUP_H_ -#define _SETUP_H_ +#pragma once #include "modeledit.h" #include "eeprominterface.h" +#include "compounditemmodels.h" +#include "filtereditemmodels.h" constexpr char MIMETYPE_TIMER[] = "application/x-companion-timer"; -class CompoundItemModelFactory; -class FilteredItemModel; - namespace Ui { class Setup; class Timer; @@ -41,7 +39,7 @@ class TimerPanel : public ModelPanel public: TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, - QWidget *prevFocus, FilteredItemModel * switchModel); + QWidget *prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels); virtual ~TimerPanel(); virtual void update(); @@ -55,6 +53,7 @@ class TimerPanel : public ModelPanel void on_name_editingFinished(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); + void on_countdownStart_currentIndexChanged(int index); signals: void nameChanged(); @@ -63,6 +62,7 @@ class TimerPanel : public ModelPanel TimerData & timer; Ui::Timer * ui; void connectItemModelEvents(const FilteredItemModel * itemModel); + int modelsUpdateCnt; }; class ModulePanel : public ModelPanel @@ -184,7 +184,7 @@ class SetupPanel : public ModelPanel QVector startupSwitchesCheckboxes; QVector potWarningCheckboxes; QVector centerBeepCheckboxes; - ModulePanel * modules[CPN_MAX_MODULES+1]; + ModulePanel * modules[CPN_MAX_MODULES + 1]; TimerPanel * timers[CPN_MAX_TIMERS]; void updateStartupSwitches(); void updatePotWarnings(); @@ -199,10 +199,8 @@ class SetupPanel : public ModelPanel bool moveTimerUpAllowed() const; void swapTimerData(int idx1, int idx2); CompoundItemModelFactory * sharedItemModels; - FilteredItemModel * rawSwitchFilteredModel; - FilteredItemModel * thrSourceFilteredModel; void updateItemModels(); void connectItemModelEvents(const FilteredItemModel * itemModel); + CompoundItemModelFactory * panelItemModels; + FilteredItemModelFactory * panelFilteredModels; }; - -#endif // _SETUP_H_ diff --git a/companion/src/modeledit/setup_timer.ui b/companion/src/modeledit/setup_timer.ui index 11f566b45..989e7074e 100644 --- a/companion/src/modeledit/setup_timer.ui +++ b/companion/src/modeledit/setup_timer.ui @@ -9,7 +9,7 @@ 0 0 - 675 + 874 33 @@ -33,7 +33,7 @@ 0 - + 80 @@ -68,11 +68,18 @@ + + + + Start + + + - + Minute Call @@ -109,6 +116,16 @@ QComboBox
autocombobox.h
+ + AutoLineEdit + QLineEdit +
autolineedit.h
+
+ + AutoCheckBox + QCheckBox +
autocheckbox.h
+
diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp index 282f53550..7da624e1e 100644 --- a/companion/src/modelprinter.cpp +++ b/companion/src/modelprinter.cpp @@ -938,36 +938,6 @@ QString ModelPrinter::printFailsafeMode(unsigned int fsmode) } } -QString ModelPrinter::printTimerCountdownBeep(unsigned int countdownBeep) -{ - switch (countdownBeep) { - case TimerData::COUNTDOWN_SILENT: - return tr("Silent"); - case TimerData::COUNTDOWN_BEEPS: - return tr("Beeps"); - case TimerData::COUNTDOWN_VOICE: - return tr("Voice"); - case TimerData::COUNTDOWN_HAPTIC: - return tr("Haptic"); - default: - return CPN_STR_UNKNOWN_ITEM; - } -} - -QString ModelPrinter::printTimerPersistent(unsigned int persistent) -{ - switch (persistent) { - case 0: - return tr("OFF"); - case 1: - return tr("Flight"); - case 2: - return tr("Manual reset"); - default: - return CPN_STR_UNKNOWN_ITEM; - } -} - QString ModelPrinter::printSettingsTrim() { QStringList str; @@ -1042,16 +1012,6 @@ QString ModelPrinter::printTimerName(int idx) return result; } -QString ModelPrinter::printTimerTimeValue(unsigned int val) -{ - return printTimeValue(val, MASK_TIMEVALUE_HRSMINS | MASK_TIMEVALUE_ZEROHRS); -} - -QString ModelPrinter::printTimerMinuteBeep(bool mb) -{ - return printBoolean(mb, BOOLEAN_YESNO); -} - QString ModelPrinter::printTelemetryProtocol(unsigned int val) { switch (val) { diff --git a/companion/src/modelprinter.h b/companion/src/modelprinter.h index ea2eab2d8..97d697509 100644 --- a/companion/src/modelprinter.h +++ b/companion/src/modelprinter.h @@ -104,13 +104,9 @@ class ModelPrinter: public QObject QString printFailsafe(int idx); QString printFailsafeMode(unsigned int fsmode); QString printFailsafeValue(int val); - QString printTimerCountdownBeep(unsigned int countdownBeep); - QString printTimerPersistent(unsigned int persistent); QString printPPMFrameLength(int ppmFL); QString printTimerName(int idx); QString printTimeValue(const int value, const unsigned int mask); - QString printTimerMinuteBeep(bool mb); - QString printTimerTimeValue(unsigned int val); QString printTelemetryProtocol(unsigned int val); QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false); QString printLabelValues(const QString & lbl, const QStringList & vals, const bool sep = false); diff --git a/companion/src/multimodelprinter.cpp b/companion/src/multimodelprinter.cpp index 17cb30be4..472354d84 100644 --- a/companion/src/multimodelprinter.cpp +++ b/companion/src/multimodelprinter.cpp @@ -341,11 +341,11 @@ QString MultiModelPrinter::printTimers() columns.appendCellStart(20, true); COMPARE(modelPrinter->printTimerName(i)); columns.appendCellEnd(true); - COMPARECELLWIDTH(modelPrinter->printTimerTimeValue(model->timers[i].val), 15); + COMPARECELLWIDTH(DataHelpers::timeToString(model->timers[i].val, TIMESTR_MASK_HRSMINS), 15); COMPARECELLWIDTH(model->timers[i].mode.toString(), 15); - COMPARECELLWIDTH(modelPrinter->printTimerCountdownBeep(model->timers[i].countdownBeep), 15); - COMPARECELLWIDTH(modelPrinter->printTimerMinuteBeep(model->timers[i].minuteBeep), 15); - COMPARECELLWIDTH(modelPrinter->printTimerPersistent(model->timers[i].persistent), 20); + COMPARECELLWIDTH(model->timers[i].countdownBeepToString(), 15); + COMPARECELLWIDTH(DataHelpers::boolToString(model->timers[i].minuteBeep, DataHelpers::BOOL_FMT_YESNO), 15); + COMPARECELLWIDTH(model->timers[i].persistentToString(false), 20); columns.appendRowEnd(); } columns.appendTableEnd(); From e0cd919c3e555ee713b1eea5bf0c39b214cece04 Mon Sep 17 00:00:00 2001 From: Risto Date: Sun, 14 Mar 2021 13:39:15 +0100 Subject: [PATCH 129/188] Minor issues of old startup_stm32f42_43xx STM32F429/439 are Cortex M4 processors. By comparing this file with the appropriate startup_stm32f429bitx.s file generated by the current STM32CubeIDE for STM32F429BI (as in TX16S, T16 & T18) , I can see that the present OpenTX version misses an initial stack pointer setting. Both issues fixed herewith. --- radio/src/targets/horus/startup_stm32f42_43xxx.s | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/radio/src/targets/horus/startup_stm32f42_43xxx.s b/radio/src/targets/horus/startup_stm32f42_43xxx.s index e87226bf2..ad8a89264 100644 --- a/radio/src/targets/horus/startup_stm32f42_43xxx.s +++ b/radio/src/targets/horus/startup_stm32f42_43xxx.s @@ -1,16 +1,16 @@ /** ****************************************************************************** - * @file startup_stm32f40_41xxx.s + * @file startup_stm32f42_43xx.s * @author MCD Application Team * @version V1.3.0 * @date 08-November-2013 - * @brief STM32F40xxx/41xxx Devices vector table for RIDE7 toolchain. + * @brief STM32F42xxx/43xxx Devices vector table for RIDE7 toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Configure the clock system and the external SRAM mounted on - * STM324xG-EVAL board to be used as data memory (optional, + * STM32F4xG-EVAL board to be used as data memory (optional, * to be enabled by user) * - Branches to main in the C library (which eventually * calls main()). @@ -37,7 +37,7 @@ */ .syntax unified - .cpu cortex-m3 + .cpu cortex-m4 .fpu softvfp .thumb @@ -69,9 +69,9 @@ defined in linker script */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function -Reset_Handler: - - bl pwrResetHandler /*jump to WDT reset handler where soft power control pin is turned on as soon as possible */ +Reset_Handler: + ldr sp, =_estack /* set stack pointer */ + bl pwrResetHandler /* jump to WDT reset handler where soft power control pin is turned on as soon as possible */ /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 @@ -113,7 +113,7 @@ LoopPaintMainStack: /* Call the clock system intitialization function.*/ bl SystemInit -/* Call C++ constructors for static objects */ +/* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main From 61bf14977b8161ca674feaefa9f4ff61da235ab2 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 15 Mar 2021 19:37:14 +0100 Subject: [PATCH 130/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index c3cc61a76..8825be55b 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2185,3 +2185,4 @@ Antoine Soulie Tjeerd Jager Bertold Van den Bergh Stefanie Zerbe +James Mandelbaum From 3c5ee61fefc7972c5f6f3f72148577cf615090bc Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 15 Mar 2021 19:38:35 +0100 Subject: [PATCH 131/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8825be55b..b4f7eb581 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2186,3 +2186,4 @@ Tjeerd Jager Bertold Van den Bergh Stefanie Zerbe James Mandelbaum +Javier J. Cordovez From 099d5f76085eab1763611b4f5c1f3330f541148e Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 16 Mar 2021 09:50:00 +1100 Subject: [PATCH 132/188] Refactor setup and modelprinter --- companion/src/firmwares/timerdata.cpp | 31 +++++++++++++++++++---- companion/src/firmwares/timerdata.h | 3 +++ companion/src/modeledit/setup.cpp | 36 ++++++++++++++++++--------- companion/src/modeledit/setup.h | 1 + companion/src/modelprinter.cpp | 31 ----------------------- companion/src/modelprinter.h | 3 --- companion/src/multimodelprinter.cpp | 15 +++++------ 7 files changed, 62 insertions(+), 58 deletions(-) diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp index c46351df8..8e85455fa 100644 --- a/companion/src/firmwares/timerdata.cpp +++ b/companion/src/firmwares/timerdata.cpp @@ -57,7 +57,10 @@ QString TimerData::countdownBeepToString() const QString TimerData::countdownStartToString() const { - return countdownStartToString(countdownStart); + if (countdownBeep == COUNTDOWNBEEP_SILENT) + return ""; + else + return countdownStartToString(countdownStart); } QString TimerData::persistentToString(const bool verbose) const @@ -70,6 +73,18 @@ QString TimerData::pvalueToString() const return pvalueToString(pvalue); } +QString TimerData::valToString() const +{ + return valToString(val); +} + +void TimerData::setCountdownBeep(const unsigned int value) +{ + countdownBeep = value; + if (value == COUNTDOWNBEEP_SILENT) + countdownStart = 0; +} + // static QString TimerData::countdownBeepToString(const int value) { @@ -122,7 +137,13 @@ QString TimerData::persistentToString(const int value, const bool verbose) // static QString TimerData::pvalueToString(const int value) { - return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS); + return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS | TIMESTR_MASK_HRSMINS); +} + +// static +QString TimerData::valToString(const int value) +{ + return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS | TIMESTR_MASK_ZEROHRS); } // static @@ -132,7 +153,7 @@ AbstractStaticItemModel * TimerData::countdownBeepItemModel() mdl->setName(AIM_TIMER_COUNTDOWNBEEP); for (int i = 0; i < COUNTDOWNBEEP_COUNT; i++) { - QString str = countdownBeepToString(i); + mdl->appendToItemList(countdownBeepToString(i), i); } mdl->loadItemList(); @@ -146,7 +167,7 @@ AbstractStaticItemModel * TimerData::countdownStartItemModel() mdl->setName(AIM_TIMER_COUNTDOWNSTART); for (int i = COUNTDOWNSTART_LAST - 1; i >= COUNTDOWNSTART_FIRST; i--) { - QString str = countdownStartToString(i); + mdl->appendToItemList(countdownStartToString(i), i); } mdl->loadItemList(); @@ -160,7 +181,7 @@ AbstractStaticItemModel * TimerData::persistentItemModel() mdl->setName(AIM_TIMER_PERSISTENT); for (int i = 0; i < PERSISTENT_COUNT; i++) { - QString str = persistentToString(i); + mdl->appendToItemList(persistentToString(i), i); } mdl->loadItemList(); diff --git a/companion/src/firmwares/timerdata.h b/companion/src/firmwares/timerdata.h index fcd1ab87d..03694120c 100644 --- a/companion/src/firmwares/timerdata.h +++ b/companion/src/firmwares/timerdata.h @@ -83,11 +83,14 @@ class TimerData { QString countdownStartToString() const; QString persistentToString(const bool verbose = true) const; QString pvalueToString() const; + QString valToString() const; + void setCountdownBeep(const unsigned int value); static QString countdownBeepToString(const int value); static QString countdownStartToString(const int value); static QString persistentToString(const int value, const bool verbose = true); static QString pvalueToString(const int value); + static QString valToString(const int value); static AbstractStaticItemModel * countdownBeepItemModel(); static AbstractStaticItemModel * countdownStartItemModel(); static AbstractStaticItemModel * persistentItemModel(); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index d3d199cc0..55489933e 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -70,7 +70,6 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge else { ui->persistent->setModel(panelItemModels->getItemModel(AIM_TIMER_PERSISTENT)); ui->persistent->setField(timer.persistent, this); - ui->persistentValue->setText(timer.pvalueToString()); } ui->countdownStart->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNSTART)); @@ -108,9 +107,15 @@ void TimerPanel::update() ui->countdownBeep->updateValue(); ui->minuteBeep->updateValue(); - if (firmware->getCapability(PermTimers)) + if (firmware->getCapability(PermTimers)) { ui->persistent->updateValue(); + ui->persistentValue->setText(timer.pvalueToString()); + } ui->countdownStart->updateValue(); + if(timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) + ui->countdownStart->setEnabled(false); + else + ui->countdownStart->setEnabled(true); lock = false; } @@ -122,14 +127,10 @@ QWidget * TimerPanel::getLastFocus() void TimerPanel::on_countdownBeep_currentIndexChanged(int index) { if (!lock) { - const int start = ui->countdownStart->itemData(index).toInt(); - if (start != timer.countdownStart) { - timer.countdownStart = start; + const unsigned int val = ui->countdownStart->itemData(index).toUInt(); + if (val != timer.countdownBeep) { + timer.setCountdownBeep(val); emit modified(); - if(index == TimerData::COUNTDOWNBEEP_SILENT) - ui->countdownStart->setEnabled(false); - else - ui->countdownStart->setEnabled(true); } } } @@ -201,9 +202,20 @@ void TimerPanel::onItemModelUpdateComplete() void TimerPanel::on_countdownStart_currentIndexChanged(int index) { if (!lock) { - const int start = ui->countdownStart->itemData(index).toInt(); - if (start != timer.countdownStart) { - timer.countdownStart = start; + const int val = ui->countdownStart->itemData(index).toInt(); + if (val != timer.countdownStart) { + timer.countdownStart = val; + emit modified(); + } + } +} + +void TimerPanel::on_persistent_currentIndexChanged(int index) +{ + if (!lock) { + const unsigned int val = ui->persistent->itemData(index).toUInt(); + if (val != timer.persistent) { + timer.persistent = val; emit modified(); } } diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 24b1625f7..72350bf4f 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -54,6 +54,7 @@ class TimerPanel : public ModelPanel void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); void on_countdownStart_currentIndexChanged(int index); + void on_persistent_currentIndexChanged(int index); signals: void nameChanged(); diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp index 7da624e1e..1d7df4f93 100644 --- a/companion/src/modelprinter.cpp +++ b/companion/src/modelprinter.cpp @@ -298,27 +298,6 @@ QString ModelPrinter::printCenterBeep() return (strl.isEmpty() ? tr("None") : strl.join(" ")); } -QString ModelPrinter::printTimer(int idx) -{ - return printTimer(model.timers[idx]); -} - -QString ModelPrinter::printTimer(const TimerData & timer) -{ - QStringList result; - if (firmware->getCapability(TimersName) && timer.name[0]) - result += tr("Name") + QString("(%1)").arg(timer.name); - result += printTimeValue(timer.val, MASK_TIMEVALUE_HRSMINS | MASK_TIMEVALUE_ZEROHRS); - result += timer.mode.toString(); - if (timer.countdownBeep) - result += tr("Countdown") + QString("(%1)").arg(printTimerCountdownBeep(timer.countdownBeep)); - if (timer.minuteBeep) - result += tr("Minute call"); - if (timer.persistent) - result += tr("Persistent") + QString("(%1)").arg(printTimerPersistent(timer.persistent)); - return result.join(", "); -} - QString ModelPrinter::printTrim(int flightModeIndex, int stickIndex) { const FlightModeData & fm = model.flightModeData[flightModeIndex]; @@ -1002,16 +981,6 @@ QString ModelPrinter::printPPMFrameLength(int ppmFL) return QString::number(result); } -QString ModelPrinter::printTimerName(int idx) -{ - QString result; - result = tr("Tmr") + QString("%1").arg(idx+1); - if (firmware->getCapability(TimersName) && model.timers[idx].name[0]) - result.append(":" + QString(model.timers[idx].name)); - - return result; -} - QString ModelPrinter::printTelemetryProtocol(unsigned int val) { switch (val) { diff --git a/companion/src/modelprinter.h b/companion/src/modelprinter.h index 97d697509..8be56bd64 100644 --- a/companion/src/modelprinter.h +++ b/companion/src/modelprinter.h @@ -67,8 +67,6 @@ class ModelPrinter: public QObject QString printTrim(int flightModeIndex, int stickIndex); QString printGlobalVar(int flightModeIndex, int gvarIndex); QString printRotaryEncoder(int flightModeIndex, int reIndex); - QString printTimer(int idx); - QString printTimer(const TimerData & timer); QString printInputName(int idx); QString printInputLine(int idx); QString printInputLine(const ExpoData & ed); @@ -105,7 +103,6 @@ class ModelPrinter: public QObject QString printFailsafeMode(unsigned int fsmode); QString printFailsafeValue(int val); QString printPPMFrameLength(int ppmFL); - QString printTimerName(int idx); QString printTimeValue(const int value, const unsigned int mask); QString printTelemetryProtocol(unsigned int val); QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false); diff --git a/companion/src/multimodelprinter.cpp b/companion/src/multimodelprinter.cpp index 472354d84..0ebef1884 100644 --- a/companion/src/multimodelprinter.cpp +++ b/companion/src/multimodelprinter.cpp @@ -334,18 +334,19 @@ QString MultiModelPrinter::printTimers() QString str; MultiColumns columns(modelPrinterMap.size()); columns.appendSectionTableStart(); - columns.appendRowHeader(QStringList() << tr("Timers") << tr("Time") << tr("Switch") << tr("Countdown") << tr("Min.call") << tr("Persist")); + columns.appendRowHeader(QStringList() << tr("Timers") << tr("Time") << tr("Switch") << tr("Countdown") << tr("Start") << tr("Min.call") << tr("Persist")); for (int i=0; igetCapability(Timers); i++) { columns.appendRowStart(); columns.appendCellStart(20, true); - COMPARE(modelPrinter->printTimerName(i)); + COMPARE(model->timers[i].nameToString(i)); columns.appendCellEnd(true); - COMPARECELLWIDTH(DataHelpers::timeToString(model->timers[i].val, TIMESTR_MASK_HRSMINS), 15); - COMPARECELLWIDTH(model->timers[i].mode.toString(), 15); - COMPARECELLWIDTH(model->timers[i].countdownBeepToString(), 15); - COMPARECELLWIDTH(DataHelpers::boolToString(model->timers[i].minuteBeep, DataHelpers::BOOL_FMT_YESNO), 15); - COMPARECELLWIDTH(model->timers[i].persistentToString(false), 20); + COMPARECELLWIDTH(model->timers[i].valToString(), 10); + COMPARECELLWIDTH(model->timers[i].mode.toString(), 10); + COMPARECELLWIDTH(model->timers[i].countdownBeepToString(), 10); + COMPARECELLWIDTH(model->timers[i].countdownStartToString(), 10); + COMPARECELLWIDTH(DataHelpers::boolToString(model->timers[i].minuteBeep, DataHelpers::BOOL_FMT_YESNO), 10); + COMPARECELLWIDTH(model->timers[i].persistentToString(false), 15); columns.appendRowEnd(); } columns.appendTableEnd(); From 9693d87c9fb6fd1191dacc16a8202fbd31348d37 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 16 Mar 2021 09:25:50 +0100 Subject: [PATCH 133/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index b4f7eb581..d81b22303 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2187,3 +2187,4 @@ Bertold Van den Bergh Stefanie Zerbe James Mandelbaum Javier J. Cordovez +Jess Barkley From 38f1d249c94e946aeddcd4f649c424c9546deebe Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 16 Mar 2021 23:16:11 +1100 Subject: [PATCH 134/188] Tweaks to auto objects and fixup filesyncdialog compile --- companion/src/dialogs/filesyncdialog.cpp | 2 + companion/src/firmwares/timerdata.cpp | 2 +- companion/src/modeledit/setup.cpp | 61 +++--------------------- companion/src/modeledit/setup.h | 5 -- companion/src/shared/autocheckbox.h | 31 +++++++----- companion/src/shared/autocombobox.h | 19 +++++--- 6 files changed, 39 insertions(+), 81 deletions(-) diff --git a/companion/src/dialogs/filesyncdialog.cpp b/companion/src/dialogs/filesyncdialog.cpp index 3927a3ffd..30026c931 100644 --- a/companion/src/dialogs/filesyncdialog.cpp +++ b/companion/src/dialogs/filesyncdialog.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include FileSyncDialog::FileSyncDialog(QWidget * parent, const SyncProcess::SyncOptions & syncOptions) : QDialog(parent), diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp index 8e85455fa..eeac00b69 100644 --- a/companion/src/firmwares/timerdata.cpp +++ b/companion/src/firmwares/timerdata.cpp @@ -137,7 +137,7 @@ QString TimerData::persistentToString(const int value, const bool verbose) // static QString TimerData::pvalueToString(const int value) { - return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS | TIMESTR_MASK_HRSMINS); + return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS | TIMESTR_MASK_ZEROHRS); } // static diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 55489933e..43c7cbaca 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -112,10 +112,14 @@ void TimerPanel::update() ui->persistentValue->setText(timer.pvalueToString()); } ui->countdownStart->updateValue(); - if(timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) + if(timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) { + ui->countdownStartLabel->setEnabled(false); ui->countdownStart->setEnabled(false); - else + } + else { + ui->countdownStartLabel->setEnabled(true); ui->countdownStart->setEnabled(true); + } lock = false; } @@ -124,17 +128,6 @@ QWidget * TimerPanel::getLastFocus() return ui->persistent; } -void TimerPanel::on_countdownBeep_currentIndexChanged(int index) -{ - if (!lock) { - const unsigned int val = ui->countdownStart->itemData(index).toUInt(); - if (val != timer.countdownBeep) { - timer.setCountdownBeep(val); - emit modified(); - } - } -} - void TimerPanel::on_value_editingFinished() { if (!lock) { @@ -158,26 +151,6 @@ void TimerPanel::onModeChanged(int index) } } -void TimerPanel::on_minuteBeep_toggled(bool checked) -{ - if (!lock) { - timer.minuteBeep = checked; - emit modified(); - } -} - -void TimerPanel::on_name_editingFinished() -{ - if (!lock) { - if (QString(timer.name) != ui->name->text()) { - int length = ui->name->maxLength(); - strncpy(timer.name, ui->name->text().toLatin1(), length); - emit nameChanged(); - emit modified(); - } - } -} - void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel) { connect(itemModel, &FilteredItemModel::aboutToBeUpdated, this, &TimerPanel::onItemModelAboutToBeUpdated); @@ -199,28 +172,6 @@ void TimerPanel::onItemModelUpdateComplete() } } -void TimerPanel::on_countdownStart_currentIndexChanged(int index) -{ - if (!lock) { - const int val = ui->countdownStart->itemData(index).toInt(); - if (val != timer.countdownStart) { - timer.countdownStart = val; - emit modified(); - } - } -} - -void TimerPanel::on_persistent_currentIndexChanged(int index) -{ - if (!lock) { - const unsigned int val = ui->persistent->itemData(index).toUInt(); - if (val != timer.persistent) { - timer.persistent = val; - emit modified(); - } - } -} - /******************************************************************************/ #define FAILSAFE_CHANNEL_HOLD 2000 diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 72350bf4f..b4e3b19c7 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -48,13 +48,8 @@ class TimerPanel : public ModelPanel private slots: void onModeChanged(int index); void on_value_editingFinished(); - void on_minuteBeep_toggled(bool checked); - void on_countdownBeep_currentIndexChanged(int index); - void on_name_editingFinished(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); - void on_countdownStart_currentIndexChanged(int index); - void on_persistent_currentIndexChanged(int index); signals: void nameChanged(); diff --git a/companion/src/shared/autocheckbox.h b/companion/src/shared/autocheckbox.h index f5b233fed..a9e70d255 100644 --- a/companion/src/shared/autocheckbox.h +++ b/companion/src/shared/autocheckbox.h @@ -21,23 +21,23 @@ #pragma once #include -#include "modeledit/modeledit.h" +#include "genericpanel.h" class AutoCheckBox: public QCheckBox { Q_OBJECT public: - explicit AutoCheckBox(QWidget *parent = 0): + explicit AutoCheckBox(QWidget * parent = nullptr): QCheckBox(parent), - field(NULL), - panel(NULL), + field(nullptr), + panel(nullptr), lock(false) { connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool))); } - void setField(bool & field, ModelPanel * panel=NULL) + void setField(bool & field, GenericPanel * panel = nullptr) { this->field = &field; this->panel = panel; @@ -51,26 +51,31 @@ class AutoCheckBox: public QCheckBox void updateValue() { + if (!field) + return; lock = true; - if (field) { - setChecked(*field); - } + setChecked(*field); lock = false; } + signals: + void currentDataChanged(bool value); + protected slots: void onToggled(bool checked) { + if (panel && panel->lock) + return; if (field && !lock) { *field = checked; - if (panel) { + emit currentDataChanged(checked); + if (panel) emit panel->modified(); - } } } protected: - bool * field; - ModelPanel * panel; - bool lock; + bool *field = nullptr; + GenericPanel *panel = nullptr; + bool lock = false; }; diff --git a/companion/src/shared/autocombobox.h b/companion/src/shared/autocombobox.h index 784abaefa..a257f35d5 100644 --- a/companion/src/shared/autocombobox.h +++ b/companion/src/shared/autocombobox.h @@ -28,8 +28,13 @@ class AutoComboBox: public QComboBox Q_OBJECT public: - explicit AutoComboBox(QWidget *parent = nullptr): - QComboBox(parent) + explicit AutoComboBox(QWidget * parent = nullptr): + QComboBox(parent), + field(nullptr), + panel(nullptr), + next(0), + lock(false), + hasModel(false) { connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int))); } @@ -69,14 +74,14 @@ class AutoComboBox: public QComboBox } } - void setField(unsigned int & field, GenericPanel * panel=nullptr) + void setField(unsigned int & field, GenericPanel * panel = nullptr) { this->field = (int *)&field; this->panel = panel; updateValue(); } - void setField(int & field, GenericPanel * panel=nullptr) + void setField(int & field, GenericPanel * panel = nullptr) { this->field = &field; this->panel = panel; @@ -122,16 +127,16 @@ class AutoComboBox: public QComboBox const int val = itemData(index).toInt(); if (field && !lock) { *field = val; + emit currentDataChanged(val); if (panel) emit panel->modified(); } - emit currentDataChanged(val); } } protected: - int * field = nullptr; - GenericPanel * panel = nullptr; + int *field = nullptr; + GenericPanel *panel = nullptr; int next = 0; bool lock = false; bool hasModel = false; From 42f6828bb4e52fb8770a52e1a2e0fd23ba9719f7 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 06:06:10 +1100 Subject: [PATCH 135/188] More timer tweaks --- companion/src/firmwares/timerdata.cpp | 7 +++---- companion/src/firmwares/timerdata.h | 2 +- companion/src/modeledit/setup.cpp | 29 +++++++++++++++++---------- companion/src/modeledit/setup.h | 5 +++-- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/companion/src/firmwares/timerdata.cpp b/companion/src/firmwares/timerdata.cpp index eeac00b69..9034ed7e0 100644 --- a/companion/src/firmwares/timerdata.cpp +++ b/companion/src/firmwares/timerdata.cpp @@ -78,10 +78,9 @@ QString TimerData::valToString() const return valToString(val); } -void TimerData::setCountdownBeep(const unsigned int value) +void TimerData::countdownBeepChanged() { - countdownBeep = value; - if (value == COUNTDOWNBEEP_SILENT) + if (countdownBeep == COUNTDOWNBEEP_SILENT) countdownStart = 0; } @@ -166,7 +165,7 @@ AbstractStaticItemModel * TimerData::countdownStartItemModel() AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); mdl->setName(AIM_TIMER_COUNTDOWNSTART); - for (int i = COUNTDOWNSTART_LAST - 1; i >= COUNTDOWNSTART_FIRST; i--) { + for (int i = COUNTDOWNSTART_LAST; i >= COUNTDOWNSTART_FIRST; i--) { mdl->appendToItemList(countdownStartToString(i), i); } diff --git a/companion/src/firmwares/timerdata.h b/companion/src/firmwares/timerdata.h index 03694120c..07cc1eedd 100644 --- a/companion/src/firmwares/timerdata.h +++ b/companion/src/firmwares/timerdata.h @@ -84,7 +84,7 @@ class TimerData { QString persistentToString(const bool verbose = true) const; QString pvalueToString() const; QString valToString() const; - void setCountdownBeep(const unsigned int value); + void countdownBeepChanged(); static QString countdownBeepToString(const int value); static QString countdownStartToString(const int value); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 43c7cbaca..7d887173f 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -33,7 +33,7 @@ constexpr char FIM_TIMERSWITCH[] {"Timer Switch"}; constexpr char FIM_THRSOURCE[] {"Throttle Source"}; -TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, +TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels): ModelPanel(parent, model, generalSettings, firmware), timer(timer), @@ -58,19 +58,20 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP)); ui->countdownBeep->setField(timer.countdownBeep, this); + connect(ui->countdownBeep, SIGNAL(currentDataChanged(int)), this, SLOT(onCountdownBeepDataChanged(int))); ui->value->setMaximumTime(firmware->getMaxTimerStart()); ui->minuteBeep->setField(timer.minuteBeep, this); - if (!firmware->getCapability(PermTimers)) { - ui->persistent->hide(); - ui->persistentValue->hide(); - } - else { + if (firmware->getCapability(PermTimers)) { ui->persistent->setModel(panelItemModels->getItemModel(AIM_TIMER_PERSISTENT)); ui->persistent->setField(timer.persistent, this); } + else { + ui->persistent->hide(); + ui->persistentValue->hide(); + } ui->countdownStart->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNSTART)); ui->countdownStart->setField(timer.countdownStart, this); @@ -107,12 +108,8 @@ void TimerPanel::update() ui->countdownBeep->updateValue(); ui->minuteBeep->updateValue(); - if (firmware->getCapability(PermTimers)) { - ui->persistent->updateValue(); - ui->persistentValue->setText(timer.pvalueToString()); - } ui->countdownStart->updateValue(); - if(timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) { + if (timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) { ui->countdownStartLabel->setEnabled(false); ui->countdownStart->setEnabled(false); } @@ -120,6 +117,10 @@ void TimerPanel::update() ui->countdownStartLabel->setEnabled(true); ui->countdownStart->setEnabled(true); } + if (firmware->getCapability(PermTimers)) { + ui->persistent->updateValue(); + ui->persistentValue->setText(timer.pvalueToString()); + } lock = false; } @@ -172,6 +173,12 @@ void TimerPanel::onItemModelUpdateComplete() } } +void TimerPanel::onCountdownBeepDataChanged(int index) +{ + timer.countdownBeepChanged(); + update(); +} + /******************************************************************************/ #define FAILSAFE_CHANNEL_HOLD 2000 diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index b4e3b19c7..41c3b45c7 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -38,8 +38,8 @@ class TimerPanel : public ModelPanel Q_OBJECT public: - TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, - QWidget *prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels); + TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, + QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels); virtual ~TimerPanel(); virtual void update(); @@ -50,6 +50,7 @@ class TimerPanel : public ModelPanel void on_value_editingFinished(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); + void onCountdownBeepDataChanged(int index); signals: void nameChanged(); From e801f490b349afeed3e7d49f2dcc4f3f30f24b8a Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 06:23:41 +1100 Subject: [PATCH 136/188] Check panel lock on update --- companion/src/shared/autobitsetcheckbox.h | 23 ++++++++++++++++------- companion/src/shared/genericpanel.h | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/companion/src/shared/autobitsetcheckbox.h b/companion/src/shared/autobitsetcheckbox.h index ea86db956..af831948e 100644 --- a/companion/src/shared/autobitsetcheckbox.h +++ b/companion/src/shared/autobitsetcheckbox.h @@ -34,7 +34,8 @@ class AutoBitsetCheckBox: public QCheckBox Q_PROPERTY(int toggleMask READ toggleMask WRITE setToggleMask) public: - explicit AutoBitsetCheckBox(QWidget *parent = nullptr) : AutoBitsetCheckBox(QString(), parent) {} + explicit AutoBitsetCheckBox(QWidget *parent = nullptr) : + AutoBitsetCheckBox(QString(), parent) {} explicit AutoBitsetCheckBox(const QString &text, QWidget *parent = nullptr) : QCheckBox(text, parent) { @@ -42,26 +43,32 @@ class AutoBitsetCheckBox: public QCheckBox } // int field constructors - explicit AutoBitsetCheckBox(int & field, int bitmask, const QString &text = QString(), QWidget *parent = nullptr) : AutoBitsetCheckBox(field, bitmask, false, text, parent) {} - explicit AutoBitsetCheckBox(int & field, int bitmask, bool invert, const QString &text = QString(), QWidget *parent = nullptr) : QCheckBox(text, parent) + explicit AutoBitsetCheckBox(int & field, int bitmask, const QString &text = QString(), QWidget *parent = nullptr) : + AutoBitsetCheckBox(field, bitmask, false, text, parent) {} + explicit AutoBitsetCheckBox(int & field, int bitmask, bool invert, const QString &text = QString(), QWidget *parent = nullptr) : + QCheckBox(text, parent) { setField(field, bitmask, invert); init(); } - explicit AutoBitsetCheckBox(int & field, int bitmask, int toggleMask, const QString &text = QString(), QWidget *parent = nullptr) : QCheckBox(text, parent) + explicit AutoBitsetCheckBox(int & field, int bitmask, int toggleMask, const QString &text = QString(), QWidget *parent = nullptr) : + QCheckBox(text, parent) { setField(field, bitmask, false, toggleMask); init(); } // unsigned field constructors - explicit AutoBitsetCheckBox(unsigned & field, int bitmask, const QString &text = QString(), QWidget *parent = nullptr) : AutoBitsetCheckBox(field, bitmask, false, text, parent) {} - explicit AutoBitsetCheckBox(unsigned & field, int bitmask, bool invert, const QString &text = QString(), QWidget *parent = nullptr) : QCheckBox(text, parent) + explicit AutoBitsetCheckBox(unsigned & field, int bitmask, const QString &text = QString(), QWidget *parent = nullptr) : + AutoBitsetCheckBox(field, bitmask, false, text, parent) {} + explicit AutoBitsetCheckBox(unsigned & field, int bitmask, bool invert, const QString &text = QString(), QWidget *parent = nullptr) : + QCheckBox(text, parent) { setField(field, bitmask, invert); init(); } - explicit AutoBitsetCheckBox(unsigned & field, int bitmask, int toggleMask, const QString &text = QString(), QWidget *parent = nullptr) : QCheckBox(text, parent) + explicit AutoBitsetCheckBox(unsigned & field, int bitmask, int toggleMask, const QString &text = QString(), QWidget *parent = nullptr) : + QCheckBox(text, parent) { setField(field, bitmask, false, toggleMask); init(); @@ -104,6 +111,8 @@ class AutoBitsetCheckBox: public QCheckBox void updateValue() { + if (m_panel && m_panel->lock) + return; if (!m_field) return; const bool oldLock = setLocked(true); diff --git a/companion/src/shared/genericpanel.h b/companion/src/shared/genericpanel.h index bbb9b7254..fe749b659 100644 --- a/companion/src/shared/genericpanel.h +++ b/companion/src/shared/genericpanel.h @@ -39,6 +39,7 @@ class GenericPanel : public QWidget friend class AutoLineEdit; friend class GVarGroup; friend class AutoPrecisionComboBox; + friend class AutoBitsetCheckBox; public: GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware); From 60ac1550f40d1b9cdd5a58cc438774dc1765d706 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 09:53:32 +1100 Subject: [PATCH 137/188] Standardisation of auto widgets --- companion/src/shared/autocheckbox.h | 10 +++---- companion/src/shared/autodoublespinbox.h | 28 +++++++++++++------- companion/src/shared/autohexspinbox.h | 24 +++++++++++------ companion/src/shared/autolineedit.h | 16 +++++------ companion/src/shared/autoprecisioncombobox.h | 12 ++++----- 5 files changed, 53 insertions(+), 37 deletions(-) diff --git a/companion/src/shared/autocheckbox.h b/companion/src/shared/autocheckbox.h index a9e70d255..1c1a7207c 100644 --- a/companion/src/shared/autocheckbox.h +++ b/companion/src/shared/autocheckbox.h @@ -51,11 +51,11 @@ class AutoCheckBox: public QCheckBox void updateValue() { - if (!field) - return; - lock = true; - setChecked(*field); - lock = false; + if (field) { + lock = true; + setChecked(*field); + lock = false; + } } signals: diff --git a/companion/src/shared/autodoublespinbox.h b/companion/src/shared/autodoublespinbox.h index 6560b6ea2..a6466269e 100644 --- a/companion/src/shared/autodoublespinbox.h +++ b/companion/src/shared/autodoublespinbox.h @@ -21,7 +21,7 @@ #pragma once #include -#include "modeledit/modeledit.h" +#include "genericpanel.h" #if __GNUC__ #include #endif @@ -31,23 +31,23 @@ class AutoDoubleSpinBox: public QDoubleSpinBox Q_OBJECT public: - explicit AutoDoubleSpinBox(QWidget *parent = 0): + explicit AutoDoubleSpinBox(QWidget * parent = nullptr): QDoubleSpinBox(parent), - field(NULL), - panel(NULL), + field(nullptr), + panel(nullptr), lock(false) { connect(this, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double))); } - void setField(int & field, ModelPanel * panel=NULL) + void setField(int & field, GenericPanel * panel = nullptr) { this->field = &field; this->panel = panel; updateValue(); } - void setField(unsigned int & field, ModelPanel * panel=NULL) + void setField(unsigned int & field, GenericPanel * panel = nullptr) { this->field = (int *)&field; this->panel = panel; @@ -57,7 +57,9 @@ class AutoDoubleSpinBox: public QDoubleSpinBox void updateValue() { if (field) { - setValue(float(*field)/multiplier()); + lock = true; + setValue(float(*field) / multiplier()); + lock = false; } } @@ -80,11 +82,17 @@ class AutoDoubleSpinBox: public QDoubleSpinBox } } + signals: + void currentDataChanged(double value); + protected slots: void onValueChanged(double value) { + if (panel && panel->lock) + return; if (field && !lock) { *field = round(value * multiplier()); + emit currentDataChanged(value); if (panel) { emit panel->modified(); } @@ -92,7 +100,7 @@ class AutoDoubleSpinBox: public QDoubleSpinBox } protected: - int * field; - ModelPanel * panel; - bool lock; + int * field = nullptr; + GenericPanel * panel = nullptr; + bool lock = false; }; diff --git a/companion/src/shared/autohexspinbox.h b/companion/src/shared/autohexspinbox.h index d7df46bd6..40cc24da4 100644 --- a/companion/src/shared/autohexspinbox.h +++ b/companion/src/shared/autohexspinbox.h @@ -21,23 +21,23 @@ #pragma once #include "hexspinbox.h" -#include "modeledit/modeledit.h" +#include "genericpanel.h" class AutoHexSpinBox: public HexSpinBox { Q_OBJECT public: - explicit AutoHexSpinBox(QWidget *parent = 0): + explicit AutoHexSpinBox(QWidget * parent = nullptr): HexSpinBox(parent), - field(NULL), - panel(NULL), + field(nullptr), + panel(nullptr), lock(false) { connect(this, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int))); } - void setField(unsigned int & field, ModelPanel * panel=NULL) + void setField(unsigned int & field, GenericPanel * panel = nullptr) { this->field = &field; this->panel = panel; @@ -47,15 +47,23 @@ class AutoHexSpinBox: public HexSpinBox void updateValue() { if (field) { + lock = true; setValue(*field); + lock = false; } } + signals: + void currentDataChanged(int value); + protected slots: void onValueChanged(int value) { + if (panel && panel->lock) + return; if (field && !lock) { *field = value; + emit currentDataChanged(value); if (panel) { emit panel->modified(); } @@ -63,7 +71,7 @@ class AutoHexSpinBox: public HexSpinBox } protected: - unsigned int * field; - ModelPanel * panel; - bool lock; + unsigned int * field = nullptr; + GenericPanel * panel = nullptr; + bool lock = false; }; diff --git a/companion/src/shared/autolineedit.h b/companion/src/shared/autolineedit.h index 0f888e6df..173d16e95 100644 --- a/companion/src/shared/autolineedit.h +++ b/companion/src/shared/autolineedit.h @@ -29,11 +29,11 @@ class AutoLineEdit: public QLineEdit Q_OBJECT public: - explicit AutoLineEdit(QWidget *parent = nullptr, bool updateOnChange = false): + explicit AutoLineEdit(QWidget * parent = nullptr, bool updateOnChange = false): QLineEdit(parent), field(NULL), - strField(NULL), - panel(NULL), + strField(nullptr), + panel(nullptr), lock(false) { if (updateOnChange) @@ -86,15 +86,15 @@ class AutoLineEdit: public QLineEdit else return; + emit currentDataChanged(); + if (panel) emit panel->modified(); - - emit currentDataChanged(); } protected: char * field; - QString * strField; - GenericPanel * panel; - bool lock; + QString * strField = nullptr; + GenericPanel * panel = nullptr; + bool lock = false; }; diff --git a/companion/src/shared/autoprecisioncombobox.h b/companion/src/shared/autoprecisioncombobox.h index e93059199..72dd89406 100644 --- a/companion/src/shared/autoprecisioncombobox.h +++ b/companion/src/shared/autoprecisioncombobox.h @@ -123,7 +123,7 @@ class AutoPrecisionComboBox: public QComboBox if (*m_field != val) { *m_field = rangecheckDecimals(val); updateValue(); - emit valueChanged(); + emit currentDataChanged(value); } } @@ -134,7 +134,7 @@ class AutoPrecisionComboBox: public QComboBox if (*m_field != value) { *m_field = rangecheckDecimals(value); updateValue(); - emit valueChanged(); + emit currentDataChanged((int)value); } } @@ -160,7 +160,7 @@ class AutoPrecisionComboBox: public QComboBox } signals: - void valueChanged(); + void currentDataChanged(int index); protected slots: void init() @@ -203,13 +203,13 @@ class AutoPrecisionComboBox: public QComboBox void onCurrentIndexChanged(int index) { - if (index < 0) + if (index < 0 || (m_panel && m_panel->lock) || m_lock) return; - if (m_field && !m_lock) { + if (m_field) { *m_field = itemData(index).toUInt(); + emit currentDataChanged(index); if (m_panel) emit m_panel->modified(); - emit valueChanged(); } } From 3eed78dbd56e645a61cdfca7897d1796dd33352b Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 10:07:04 +1100 Subject: [PATCH 138/188] Introduce autotimeedit widget --- companion/src/shared/CMakeLists.txt | 1 + companion/src/shared/autotimeedit.h | 97 +++++++++++++++++++++++++++++ companion/src/shared/genericpanel.h | 1 + 3 files changed, 99 insertions(+) create mode 100644 companion/src/shared/autotimeedit.h diff --git a/companion/src/shared/CMakeLists.txt b/companion/src/shared/CMakeLists.txt index 2fbbafbf9..ffd5942bf 100644 --- a/companion/src/shared/CMakeLists.txt +++ b/companion/src/shared/CMakeLists.txt @@ -16,6 +16,7 @@ set(shared_HDRS genericpanel.h hexspinbox.h autoprecisioncombobox.h + autotimeedit.h ) qt5_wrap_cpp(shared_SRCS ${shared_HDRS}) diff --git a/companion/src/shared/autotimeedit.h b/companion/src/shared/autotimeedit.h new file mode 100644 index 000000000..ef419ac95 --- /dev/null +++ b/companion/src/shared/autotimeedit.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include +#include "genericpanel.h" + +class AutoTimeEdit: public QTimeEdit +{ + Q_OBJECT + + public: + explicit AutoTimeEdit(QWidget * parent = nullptr): + QTimeEdit(parent), + field(nullptr), + panel(nullptr), + lock(false) + { + connect(this, SIGNAL(timeChanged(QTime)), this, SLOT(onTimeChanged(QTime))); + } + + void setField(int & field, GenericPanel * panel = nullptr) + { + this->field = &field; + this->panel = panel; + updateValue(); + } + + void setMinimumTime(QTime time) + { + QTimeEdit::setMinimumTime(QTime time); + } + + void setMaximumTime(QTime time) + { + QTimeEdit::setMaximumTime(QTime time); + } + + void setEnabled(bool enabled) + { + QTimeEdit::setEnabled(enabled); + } + + void updateValue() + { + if (field) { + lock = true; + int hour = *field / 3600; + int min = (*field - (hour * 3600)) / 60; + int sec = (*field - (hour * 3600)) % 60; + setTime(QTime(hour, min, sec)); + lock = false; + } + } + + signals: + void currentDataChanged(unsigned int value); + + protected slots: + void onTimeChanged(QTime time) + { + if ((panel && panel->lock) || !field || lock) + return; + + unsigned int val = time.hour() * 3600 + time.minute() * 60 + time.second(); + if (*field != val) { + *field = val; + emit currentDataChanged(val); + if (panel) + emit panel->modified(); + } + } + + protected: + int *field = nullptr; + GenericPanel *panel = nullptr; + bool lock = false; +}; + diff --git a/companion/src/shared/genericpanel.h b/companion/src/shared/genericpanel.h index fe749b659..88c7f841b 100644 --- a/companion/src/shared/genericpanel.h +++ b/companion/src/shared/genericpanel.h @@ -40,6 +40,7 @@ class GenericPanel : public QWidget friend class GVarGroup; friend class AutoPrecisionComboBox; friend class AutoBitsetCheckBox; + friend class AutoTimeEdit; public: GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware); From 521bdde1fd01a8679de8387113ac08e699104b4d Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 20:26:11 +1100 Subject: [PATCH 139/188] Use autotimeedit in setup timers --- companion/src/modeledit/setup.cpp | 31 ++++++++++---------------- companion/src/modeledit/setup.h | 2 +- companion/src/modeledit/setup_timer.ui | 7 +++++- companion/src/shared/autotimeedit.h | 12 +++++----- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 7d887173f..cb4312965 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -48,8 +48,13 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G int length = firmware->getCapability(TimersName); if (length == 0) ui->name->hide(); - else + else { ui->name->setField(timer.name, length, this); + connect(ui->name, SIGNAL(currentDataChanged()), this, SLOT(onNameChanged())); + } + + ui->value->setField(timer.val, this); + ui->value->setMaximumTime(firmware->getMaxTimerStart()); // Mode ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); @@ -60,8 +65,6 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G ui->countdownBeep->setField(timer.countdownBeep, this); connect(ui->countdownBeep, SIGNAL(currentDataChanged(int)), this, SLOT(onCountdownBeepDataChanged(int))); - ui->value->setMaximumTime(firmware->getMaxTimerStart()); - ui->minuteBeep->setField(timer.minuteBeep, this); if (firmware->getCapability(PermTimers)) { @@ -100,11 +103,7 @@ void TimerPanel::update() ui->name->updateValue(); ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); - - int hour = timer.val / 3600; - int min = (timer.val - (hour * 3600)) / 60; - int sec = (timer.val - (hour * 3600)) % 60; - ui->value->setTime(QTime(hour, min, sec)); + ui->value->updateValue(); ui->countdownBeep->updateValue(); ui->minuteBeep->updateValue(); @@ -129,17 +128,6 @@ QWidget * TimerPanel::getLastFocus() return ui->persistent; } -void TimerPanel::on_value_editingFinished() -{ - if (!lock) { - unsigned val = ui->value->time().hour() * 3600 + ui->value->time().minute() * 60 + ui->value->time().second(); - if (timer.val != val) { - timer.val = val; - emit modified(); - } - } -} - void TimerPanel::onModeChanged(int index) { if (!lock) { @@ -173,6 +161,11 @@ void TimerPanel::onItemModelUpdateComplete() } } +void TimerPanel::onNameChanged() +{ + emit nameChanged(); +} + void TimerPanel::onCountdownBeepDataChanged(int index) { timer.countdownBeepChanged(); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 41c3b45c7..67c97f669 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -47,7 +47,7 @@ class TimerPanel : public ModelPanel private slots: void onModeChanged(int index); - void on_value_editingFinished(); + void onNameChanged(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); void onCountdownBeepDataChanged(int index); diff --git a/companion/src/modeledit/setup_timer.ui b/companion/src/modeledit/setup_timer.ui index 989e7074e..a772c6d30 100644 --- a/companion/src/modeledit/setup_timer.ui +++ b/companion/src/modeledit/setup_timer.ui @@ -43,7 +43,7 @@
- + true @@ -126,6 +126,11 @@ QCheckBox
autocheckbox.h
+ + AutoTimeEdit + QTimeEdit +
autotimeedit.h
+
diff --git a/companion/src/shared/autotimeedit.h b/companion/src/shared/autotimeedit.h index ef419ac95..8e2dff2d8 100644 --- a/companion/src/shared/autotimeedit.h +++ b/companion/src/shared/autotimeedit.h @@ -37,21 +37,21 @@ class AutoTimeEdit: public QTimeEdit connect(this, SIGNAL(timeChanged(QTime)), this, SLOT(onTimeChanged(QTime))); } - void setField(int & field, GenericPanel * panel = nullptr) + void setField(unsigned int & field, GenericPanel * panel = nullptr) { this->field = &field; this->panel = panel; updateValue(); } - void setMinimumTime(QTime time) + void setMinimumTime(const QTime time) { - QTimeEdit::setMinimumTime(QTime time); + QTimeEdit::setMinimumTime(time); } - void setMaximumTime(QTime time) + void setMaximumTime(const QTime time) { - QTimeEdit::setMaximumTime(QTime time); + QTimeEdit::setMaximumTime(time); } void setEnabled(bool enabled) @@ -90,7 +90,7 @@ class AutoTimeEdit: public QTimeEdit } protected: - int *field = nullptr; + unsigned int *field = nullptr; GenericPanel *panel = nullptr; bool lock = false; }; From aac6c74e59f6183b467b6bf5ca944bc1764d5025 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 20:26:45 +1100 Subject: [PATCH 140/188] Fix custom function reset model refresh --- companion/src/datamodels/compounditemmodels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index b243bf09a..2f04a34fb 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -444,7 +444,7 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin AbstractDynamicItemModel(generalSettings, modelData, firmware, board, boardType) { setId(IMID_CustomFuncResetParam); - setUpdateMask(IMUE_TeleSensors); + setUpdateMask(IMUE_TeleSensors | IMUE_Timers); for (int i = 0; i < CustomFunctionData::resetParamCount(); i++) { QStandardItem * modelItem = new QStandardItem(); From 950fa3d10501abce591cb9cfe1b51a9914d3a8f9 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 21:40:13 +1100 Subject: [PATCH 141/188] Add support for rawsource and rawswitch in autocombobox --- companion/src/shared/autocombobox.h | 72 ++++++++++++++++++++++++----- companion/src/shared/autolineedit.h | 4 +- companion/src/shared/autotimeedit.h | 4 +- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/companion/src/shared/autocombobox.h b/companion/src/shared/autocombobox.h index a257f35d5..ca6054555 100644 --- a/companion/src/shared/autocombobox.h +++ b/companion/src/shared/autocombobox.h @@ -22,6 +22,8 @@ #include #include "genericpanel.h" +#include "rawsource.h" +#include "rawswitch.h" class AutoComboBox: public QComboBox { @@ -34,7 +36,9 @@ class AutoComboBox: public QComboBox panel(nullptr), next(0), lock(false), - hasModel(false) + hasModel(false), + rawSource(nullptr), + rawSwitch(nullptr) { connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int))); } @@ -77,6 +81,8 @@ class AutoComboBox: public QComboBox void setField(unsigned int & field, GenericPanel * panel = nullptr) { this->field = (int *)&field; + this->rawSource = nullptr; + this->rawSwitch = nullptr; this->panel = panel; updateValue(); } @@ -84,6 +90,26 @@ class AutoComboBox: public QComboBox void setField(int & field, GenericPanel * panel = nullptr) { this->field = &field; + this->rawSource = nullptr; + this->rawSwitch = nullptr; + this->panel = panel; + updateValue(); + } + + void setField(RawSource & field, GenericPanel * panel = nullptr) + { + this->rawSource = &field; + this->rawSwitch = nullptr; + this->field = nullptr; + this->panel = panel; + updateValue(); + } + + void setField(RawSwitch & field, GenericPanel * panel = nullptr) + { + this->rawSwitch = &field; + this->rawSource = nullptr; + this->field = nullptr; this->panel = panel; updateValue(); } @@ -108,10 +134,18 @@ class AutoComboBox: public QComboBox void updateValue() { - if (!field) + if (!field && !rawSource && !rawSwitch) return; + lock = true; - setCurrentIndex(findData(*field)); + + if (field) + setCurrentIndex(findData(*field)); + else if (rawSource) + setCurrentIndex(findData(rawSource->toValue())); + else if (rawSwitch) + setCurrentIndex(findData(rawSwitch->toValue())); + lock = false; } @@ -123,15 +157,29 @@ class AutoComboBox: public QComboBox { if (panel && panel->lock) return; - if (index > -1) { - const int val = itemData(index).toInt(); - if (field && !lock) { - *field = val; - emit currentDataChanged(val); - if (panel) - emit panel->modified(); - } + if (lock || index < 0) + return; + + bool ok; + const int val = itemData(index).toInt(&ok); + if (!ok) + return; + + if (field && *field != val) { + *field = val; } + else if (rawSource && rawSource->toValue() != val) { + *rawSource = RawSource(val); + } + else if (rawSwitch && rawSwitch->toValue() != val) { + *rawSwitch = RawSwitch(val); + } + else + return; + + emit currentDataChanged(val); + if (panel) + emit panel->modified(); } protected: @@ -140,4 +188,6 @@ class AutoComboBox: public QComboBox int next = 0; bool lock = false; bool hasModel = false; + RawSource *rawSource = nullptr; + RawSwitch *rawSwitch = nullptr; }; diff --git a/companion/src/shared/autolineedit.h b/companion/src/shared/autolineedit.h index 173d16e95..b2815796c 100644 --- a/companion/src/shared/autolineedit.h +++ b/companion/src/shared/autolineedit.h @@ -76,7 +76,9 @@ class AutoLineEdit: public QLineEdit protected slots: void onEdited() { - if ((panel && panel->lock) || lock) + if (panel && panel->lock) + return; + if (lock) return; if (field) diff --git a/companion/src/shared/autotimeedit.h b/companion/src/shared/autotimeedit.h index 8e2dff2d8..2ba75d70e 100644 --- a/companion/src/shared/autotimeedit.h +++ b/companion/src/shared/autotimeedit.h @@ -77,7 +77,9 @@ class AutoTimeEdit: public QTimeEdit protected slots: void onTimeChanged(QTime time) { - if ((panel && panel->lock) || !field || lock) + if (panel && panel->lock) + return; + if (!field || lock) return; unsigned int val = time.hour() * 3600 + time.minute() * 60 + time.second(); From 44cfbd43fb793efcf0d5506545c29fd2e1e8f052 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 21:48:51 +1100 Subject: [PATCH 142/188] Use enhanced autocombobox for timer mode --- companion/src/modeledit/setup.cpp | 18 ++---------------- companion/src/modeledit/setup.h | 1 - companion/src/modeledit/setup_timer.ui | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index cb4312965..9d656348f 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -56,10 +56,8 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G ui->value->setField(timer.val, this); ui->value->setMaximumTime(firmware->getMaxTimerStart()); - // Mode ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); - ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); - connect(ui->mode, SIGNAL(activated(int)), this, SLOT(onModeChanged(int))); + ui->mode->setField(timer.mode, this); ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP)); ui->countdownBeep->setField(timer.countdownBeep, this); @@ -102,7 +100,7 @@ void TimerPanel::update() lock = true; ui->name->updateValue(); - ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue())); + ui->mode->updateValue(); ui->value->updateValue(); ui->countdownBeep->updateValue(); @@ -128,18 +126,6 @@ QWidget * TimerPanel::getLastFocus() return ui->persistent; } -void TimerPanel::onModeChanged(int index) -{ - if (!lock) { - bool ok; - const RawSwitch rs(ui->mode->itemData(index).toInt(&ok)); - if (ok && timer.mode.toValue() != rs.toValue()) { - timer.mode = rs; - emit modified(); - } - } -} - void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel) { connect(itemModel, &FilteredItemModel::aboutToBeUpdated, this, &TimerPanel::onItemModelAboutToBeUpdated); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 67c97f669..e62041dc6 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -46,7 +46,6 @@ class TimerPanel : public ModelPanel QWidget * getLastFocus(); private slots: - void onModeChanged(int index); void onNameChanged(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); diff --git a/companion/src/modeledit/setup_timer.ui b/companion/src/modeledit/setup_timer.ui index a772c6d30..67b929bdb 100644 --- a/companion/src/modeledit/setup_timer.ui +++ b/companion/src/modeledit/setup_timer.ui @@ -56,7 +56,7 @@
- + From 8576f25aff12900e71353767c8944095bff2aa8f Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 21:51:31 +1100 Subject: [PATCH 143/188] Rename function --- companion/src/modeledit/setup.cpp | 8 +++++--- companion/src/modeledit/setup.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 9d656348f..9bfd8fd3e 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -61,7 +61,7 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP)); ui->countdownBeep->setField(timer.countdownBeep, this); - connect(ui->countdownBeep, SIGNAL(currentDataChanged(int)), this, SLOT(onCountdownBeepDataChanged(int))); + connect(ui->countdownBeep, SIGNAL(currentDataChanged(int)), this, SLOT(onCountdownBeepChanged(int))); ui->minuteBeep->setField(timer.minuteBeep, this); @@ -102,10 +102,10 @@ void TimerPanel::update() ui->name->updateValue(); ui->mode->updateValue(); ui->value->updateValue(); - ui->countdownBeep->updateValue(); ui->minuteBeep->updateValue(); ui->countdownStart->updateValue(); + if (timer.countdownBeep == TimerData::COUNTDOWNBEEP_SILENT) { ui->countdownStartLabel->setEnabled(false); ui->countdownStart->setEnabled(false); @@ -114,10 +114,12 @@ void TimerPanel::update() ui->countdownStartLabel->setEnabled(true); ui->countdownStart->setEnabled(true); } + if (firmware->getCapability(PermTimers)) { ui->persistent->updateValue(); ui->persistentValue->setText(timer.pvalueToString()); } + lock = false; } @@ -152,7 +154,7 @@ void TimerPanel::onNameChanged() emit nameChanged(); } -void TimerPanel::onCountdownBeepDataChanged(int index) +void TimerPanel::onCountdownBeepChanged(int index) { timer.countdownBeepChanged(); update(); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index e62041dc6..eeb34aef6 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -49,7 +49,7 @@ class TimerPanel : public ModelPanel void onNameChanged(); void onItemModelAboutToBeUpdated(); void onItemModelUpdateComplete(); - void onCountdownBeepDataChanged(int index); + void onCountdownBeepChanged(int index); signals: void nameChanged(); From 9caba6bfcf085fd1f6eaceb94d05a165b6669b73 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 17 Mar 2021 12:18:18 +0100 Subject: [PATCH 144/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index d81b22303..897bd6700 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2188,3 +2188,4 @@ Stefanie Zerbe James Mandelbaum Javier J. Cordovez Jess Barkley +Schneider Modell From 1678753c9b19d745dc7dde7a7d500f8962fc1aa6 Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 22:39:14 +1100 Subject: [PATCH 145/188] Use data model for throttle src --- companion/src/modeledit/setup.cpp | 35 ++++--------------------------- companion/src/modeledit/setup.h | 2 -- companion/src/modeledit/setup.ui | 2 +- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 9bfd8fd3e..db3fb8b33 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -1113,6 +1113,9 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge ui->toplcdTimer->hide(); } + ui->throttleSource->setModel(panelFilteredModels->getItemModel(FIM_THRSOURCE)); + ui->throttleSource->setField(model.thrTraceSrc, this); + if (!firmware->getCapability(HasDisplayText)) { ui->displayText->hide(); ui->editText->hide(); @@ -1279,14 +1282,6 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index) emit modified(); } -void SetupPanel::on_throttleSource_currentIndexChanged(int index) -{ - if (!lock) { - model->thrTraceSrc = ui->throttleSource->currentData().toUInt(); - emit modified(); - } -} - void SetupPanel::on_throttleTrimSwitch_currentIndexChanged(int index) { if (!lock) { @@ -1345,28 +1340,6 @@ void SetupPanel::on_image_currentIndexChanged(int index) } } -void SetupPanel::populateThrottleSourceCB() -{ - Board::Type board = firmware->getBoard(); - lock = true; - ui->throttleSource->clear(); - ui->throttleSource->addItem(tr("THR"), 0); - - int idx = 1; - for (int i = 0; i < getBoardCapability(board, Board::Pots) + getBoardCapability(board, Board::Sliders); i++, idx++) { - if (RawSource(SOURCE_TYPE_STICK, 4 + i).isAvailable(model, &generalSettings, board)) { - ui->throttleSource->addItem(firmware->getAnalogInputName(4 + i), idx); - } - } - for (int i = 0; i < firmware->getCapability(Outputs); i++, idx++) { - ui->throttleSource->addItem(RawSource(SOURCE_TYPE_CH, i).toString(model, &generalSettings), idx); - } - - int thrTraceSrcIdx = ui->throttleSource->findData(model->thrTraceSrc); - ui->throttleSource->setCurrentIndex(thrTraceSrcIdx); - lock = false; -} - void SetupPanel::populateThrottleTrimSwitchCB() { Board::Type board = firmware->getBoard(); @@ -1394,7 +1367,7 @@ void SetupPanel::update() { ui->name->setText(model->name); ui->throttleReverse->setChecked(model->throttleReversed); - populateThrottleSourceCB(); + ui->throttleSource->updateValue(); populateThrottleTrimSwitchCB(); ui->throttleWarning->setChecked(!model->disableThrottleWarning); ui->trimIncrement->setCurrentIndex(model->trimInc+2); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index eeb34aef6..82e69ec75 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -142,7 +142,6 @@ class SetupPanel : public ModelPanel private slots: void on_name_editingFinished(); - void on_throttleSource_currentIndexChanged(int index); void on_throttleTrimSwitch_currentIndexChanged(int index); void on_throttleTrim_toggled(bool checked); void on_extendedLimits_toggled(bool checked); @@ -185,7 +184,6 @@ class SetupPanel : public ModelPanel void updateStartupSwitches(); void updatePotWarnings(); void updateBeepCenter(); - void populateThrottleSourceCB(); void populateThrottleTrimSwitchCB(); int timersCount; int selectedTimerIndex; diff --git a/companion/src/modeledit/setup.ui b/companion/src/modeledit/setup.ui index 8b2409191..ee0ec28a3 100644 --- a/companion/src/modeledit/setup.ui +++ b/companion/src/modeledit/setup.ui @@ -604,7 +604,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - + 0 From 39407ed241844c5d668b49bb638540afc42a5504 Mon Sep 17 00:00:00 2001 From: elecpower Date: Thu, 18 Mar 2021 07:00:37 +1100 Subject: [PATCH 146/188] Fix timers refresh --- companion/src/modeledit/setup.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index db3fb8b33..40abc2f2f 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -1738,6 +1738,7 @@ void SetupPanel::onItemModelUpdateComplete() void SetupPanel::updateItemModels() { sharedItemModels->update(AbstractItemModel::IMUE_Timers); + emit updated(); } void SetupPanel::onModuleUpdateItemModels() From 2ce1ac73edb3323b71e0b7252a0064db738bc810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Charpentier?= Date: Thu, 18 Mar 2021 12:00:45 +0100 Subject: [PATCH 147/188] French translation update (#8372) * Update French translation. --- companion/src/translations/companion_fr.ts | 685 +++++++++++---------- 1 file changed, 365 insertions(+), 320 deletions(-) diff --git a/companion/src/translations/companion_fr.ts b/companion/src/translations/companion_fr.ts index 1d1b1b331..7f5c0618d 100644 --- a/companion/src/translations/companion_fr.ts +++ b/companion/src/translations/companion_fr.ts @@ -843,127 +843,127 @@ Manche Droit: Profondeur, Direction ChannelsPanel - + Name Nom - + Subtrim Subtrim - + Min - + Max - + Direction - + Curve Courbe - + PPM Center Neutre PPM - + Linear Subtrim Subtrim linéaire - + CH%1 VOIE%1 - + Popup menu available Menu contextuel disponible - + --- - + INV - + Delete Channel. Are you sure? Supprimer la Voie. Êtes-vous sûr? - + Cut Channel. Are you sure? Couper la Voie. Êtes-vous sûr? - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - + Clear Channel. Are you sure? Effacer la Voie. Êtes-vous sûr? - + Clear all Channels. Are you sure? Effacer toutes les Voies. Êtes-vous sûr? @@ -1118,37 +1118,37 @@ Manche Droit: Profondeur, Direction <p> Le type de radio sélectionnée dans le profil n'existe pas. Utilisez plutôt le type par défaut. </p> <p><b>Veuillez mettre à jour les paramètres de votre profil!</b></p>
- + Select or create a file for exported Settings: Sélectionnez ou créez un fichier pour les paramètres exportés: - + Press the 'Retry' button to choose another file. Appuyez sur le bouton 'Réessayer' pour choisir un autre fichier. - + Simulator for this firmware is not yet available Le simulateur n'est pas encore disponible pour ce firmware - + Uknown error during Simulator startup. Erreur inconnue pendant le démarrage du simulateur. - + Simulator Error Erreur Simulateur - + Data Load Error Erreur de chargement des données - + Error occurred while starting simulator. Une erreur s'est produite lors du démarrage du simulateur. @@ -1381,7 +1381,7 @@ Si vous avez un fichier de sauvegarde des paramètres, vous pouvez l'import CurveData - + CV CB @@ -1614,219 +1614,297 @@ Si vous avez un fichier de sauvegarde des paramètres, vous pouvez l'import CustomFunctionData - + GF FG - + SF FS - + Override %1 Remplacer %1 - + Trainer Sticks Manches Écolage - + Trainer RUD Écolage Direction - + Trainer ELE Écolage Profondeur - + Trainer THR Écolage Gaz - + Trainer AIL Écolage Ailerons - + Trainer Channels Écolage Channels - + Instant Trim Trims instantanés - + Play Sound Jouer Son - + Haptic Vibreur - + Reset Remise à zéro - + Set %1 Activer %1 - + Vario - + Play Track Jouer fichier - + Play Both Jouer les deux - + Play Value Lire valeur - - Play Script - Exécuter script + + Lua Script + Script Lua - + + Range Check Int. Module + Test Portée Module Int. + + + + Range Check Ext. Module + Test Portée Module Ext. + + + + Beep 1 + + + + + Beep 2 + + + + + Beep 3 + + + + + Warn 1 + Alerte 1 + + + + Warn 2 + Alerte 2 + + + + Cheep + Piauler + + + + Ratata + + + + + Tick + Tic-tac + + + + Siren + Sirène + + + + Ring + Sonner + + + + Sci Fi + + + + + Robot + + + + + Chirp + Gazouiller + + + + Tada + + + + + Cricket + Criquet + + + + Alarm Clock + Réveil + + + + Value + Valeur + + + + Source + + + + + Global Variable + Variable Globale + + + + Inc/Decrement + Inc/Décrémenter + + + SD Logs Logs SD - + Volume - + Backlight Rétroéclairage - + Screenshot Capture d'écran - + Background Music Musique de fond - + Background Music Pause Pause musique de fond - + Adjust %1 Ajuster %1 - + Set Failsafe Définir Failsafe - - RangeCheck Int. Module - Test portée module interne - - - - RangeCheck Ext. Module - Test portée module externe - - - + Bind Int. Module Bind module interne - + Bind Ext. Module Bind module externe - + + Played once, not during startup + Lu une fois, mais pas à la mise en route + + + + No repeat + Lu une fois + + + + Repeat %1s + Répéter %1s + + + Flight Vol - + Telemetry Télémétrie - - Rotary Encoder - Sélecteur Rotatif - - - - REa - - - - - REb - - - - + s - - - - <font color=red><b>Inconsistent parameter</b></font> - <font color=red><b>Paramètre inconsistant</b></font> - - - - Value - Valeur - - - - played once, not during startup - !1x Lu une fois, mais pas à la mise en route - - - - repeat(%1s) - Répéter chaque %1s - - - + DISABLED DESACTIVE - + CFN FPN @@ -1834,139 +1912,119 @@ Si vous avez un fichier de sauvegarde des paramètres, vous pouvez l'import CustomFunctionsPanel - + Switch Interrupteur - + Action - + Parameters Paramètres - - Enable - Actif - - - + Popup menu available Menu contextuel disponible - + SF%1 FS%1 - + GF%1 FG%1 - + + GV + VG + + + ON - + Error occurred while trying to play sound, possibly the file is already opened. (Err: %1 [%2]) Une erreur s'est produite lors de la lecture du son, le fichier est peut-être déjà ouvert. (Err: %1 [%2]) - + Unable to find or open sound file: %1 Impossible de trouver ou d'ouvrir le fichier son: %1 - + Delete Function. Are you sure? Supprimer la Fonction. Êtes-vous sûr? - + Cut Special Function. Are you sure? Couper la Fonction. Êtes-vous sûr? - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - - Value - Valeur - - - - Source - Source - - - - GVAR - VG - - - - Increment - Incrément - - - + Clear Function. Are you sure? Effacer la Fonction. Êtes-vous sûr? - + Clear all Functions. Are you sure? Effacer toutes les Fonctions. Êtes-vous sûr? @@ -2386,12 +2444,12 @@ Vérifier la sélection (M64/M128) ExpoData - + INP ENT - + (@%1) @@ -2513,22 +2571,22 @@ Si vide, la ligne est toujours active. Éditer %1 - + Popup menu available Menu contextuel disponible - + Clear All Effacer Tout - + Set All Définir Tout - + Invert All Inverser Tout @@ -3672,7 +3730,7 @@ Vous utilisez actuellement: FlightModeData - + FM PV @@ -4143,12 +4201,12 @@ p, li { white-space: pre-wrap; } VG - + Own value Valeur indépendante - + Flight mode %1 value Valeur de la phase de vol %1 @@ -4701,6 +4759,17 @@ Mode 4: A T E R A G P D + + + Battery warning voltage. +This is the threashhold where the battery warning sounds. + +Acceptable values are 3v..12v + Tension d'alerte de batterie. +Seuil auquel se déclenche l'alarme de batterie. + +Plage de valeurs: 3v...12v + Power Off Delay @@ -4871,17 +4940,6 @@ Mode 4: All Tous - - - Battery warning voltage. -This is the threashhold where the battery warning sounds. - -Acceptable values are 5v..10v - Tension d'alerte de batterie. -Seuil auquel se déclenche l'alarme de batterie. - -Plage de valeurs: 5v...10v - Standard @@ -5739,27 +5797,27 @@ Cette fonction ne peut pas être désactivée sur la radio. InputsPanel - - + + Move Up Monter - + Ctrl+Up Ctrl+Haut - - + + Move Down Descendre - + Ctrl+Down Ctrl+Bas @@ -5784,113 +5842,113 @@ Cette fonction ne peut pas être désactivée sur la radio. Couper les lignes Entrée sélectionnées. Êtes-vous sûr? - + Lines Linéaire - + &Add &Ajouter - + Ctrl+A Ctrl+A - + &Edit &Édition - + Enter Entrée - + &Delete &Supprimer - - + + Delete Supprimer - + &Copy &Copier - + Ctrl+C - + &Cut &Couper - + Ctrl+X - + &Paste &Coller - + Ctrl+V - + Du&plicate Du&pliquer - + Ctrl+U - + Input Entrée - + Insert Insérer - + Clear Effacer - + Clear All Effacer Tout - + Clear all Input lines. Are you sure? Effacer toutes les lignes Entrée. Êtes-vous sûr? - + Clear all lines for the selected Inputs. Are you sure? Effacer toutes les lignes Entrée sélectionnées. Êtes-vous sûr? - + Delete all lines for the selected Inputs. Are you sure? Supprimer toutes les lignes Entrée sélectionnées. Êtes-vous sûr? @@ -5898,17 +5956,17 @@ Cette fonction ne peut pas être désactivée sur la radio. LimitData - + INV - + NOR - + CH VOIE @@ -5916,7 +5974,7 @@ Cette fonction ne peut pas être désactivée sur la radio. LimitsGroup - + GV VG @@ -7677,12 +7735,12 @@ Enregistrer les changements ? MixData - + MIX - + (@%1) @@ -7884,22 +7942,22 @@ Mixage actif par défaut si non-renseigné. - + Click to access popup menu Cliquez pour accéder au menu contextuel - + Clear All Effacer Tout - + Set All Définir Tout - + Invert All Inverser Tout @@ -7946,25 +8004,25 @@ Mixage actif par défaut si non-renseigné. MixesPanel - + Move Up Monter - + Ctrl+Up Ctrl+Haut - + Move Down Descendre - + Ctrl+Down Ctrl+Bas @@ -7989,92 +8047,92 @@ Mixage actif par défaut si non-renseigné. Couper les lignes Mixeur sélectionnées. Êtes-vous sûr? - + &Add &Ajouter - + Ctrl+A - + &Edit &Édition - + Enter Entrée - + Ctrl+T - + &Toggle highlight &(Dé)sélectionner - + &Delete &Supprimer - + Delete Supprimer - + &Copy &Copier - + Ctrl+C - + Ctrl+X - + C&ut &Couper - + &Paste &Coller - + Ctrl+V - + Du&plicate &Dupliquer - + Ctrl+U - + Clear Mixes? Effacer tous les mixages ? - + Really clear all the mixes? Êtes-vous sûr de vraiment vouloir effacer tous les mixages ? @@ -8105,32 +8163,32 @@ Mixage actif par défaut si non-renseigné. Simulation - + Heli Paramètres hélico - + Inputs Entrées - + Mixes Mixages - + Logical Switches Inters logiques - + Setup Configuration - + Curves Courbes @@ -8140,22 +8198,22 @@ Mixage actif par défaut si non-renseigné. Dialogue - + Flight Modes Phases de vol - + Outputs Sorties - + Special Functions Fonctions spéciales - + Telemetry Télémesure @@ -9857,12 +9915,12 @@ Mixage actif par défaut si non-renseigné. QObject - + WARNING ATTENTION - + <p>Importing JumperTX data into OpenTX 2.3 is <b>not supported and dangerous.</b></p> <p>It is unfortunately not possible for us to differentiate JumperTX data from legitimate FrSky X10 data, but <b>You should only continue here if the file you opened comes from a real FrSky X10.</b></p> <p>Do you really want to continue?</p> <p>L'importation de données JumperTX dans OpenTX 2.3 est <b> non prise en charge et dangereuse.</b></p> <p>Il n'est malheureusement pas possible pour nous de différencier les données JumperTX des données légitimes FrSky X10, donc <b>Vous devez continuer uniquement si le fichier que vous avez ouvert provient d’une véritable radio FrSky X10.</b></p> <p>Voulez-vous vraiment continuer?</p> @@ -10434,24 +10492,6 @@ E Notes de version d'OpenTX - - RepeatComboBox - - - Played once, not during startup - 1x Lu une fois, mais pas à la mise en route - - - - No repeat - 1x Lu une fois - - - - %1s - - - RudderPage @@ -10801,6 +10841,11 @@ E Delta + + + (default) + (défaut) + Y @@ -10994,92 +11039,92 @@ Si cette option est cochée, la voie des gaz est inversée: le ralenti est &apo SetupPanel - + Popup menu available Menu contextuel disponible - + Timer %1 Chrono %1 - + THR GAZ - + Profile Settings Paramètres du profil - + SD structure path not specified or invalid Chemin de la structure SD non spécifié ou invalide - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - + Clear Timer. Are you sure? Effacer le Chrono. Êtes-vous sûr? - + Clear all Timers. Are you sure? Effacer tous les Chronos. Êtes-vous sûr? - + Cut Timer. Are you sure? Couper le Chrono. Êtes-vous sûr? - + Delete Timer. Are you sure? Supprimer le Chrono. Êtes-vous sûr? @@ -12513,22 +12558,22 @@ Trop d'erreurs, abandon. Type d'écran personnalisé - + None Aucun - + Numbers Chiffres - + Bars Barres - + Script @@ -12556,52 +12601,52 @@ Trop d'erreurs, abandon. TelemetryPanel - + FrSky S.PORT - + FrSky D - + FrSky D (cable) FrSky D (câble) - + Telemetry screen %1 Ecran de télémesure %1 - + Source - + Low Alarm Alarme basse - + Critical Alarm Alarme critique - + Winged Shadow How High - + Winged Shadow How High (not supported) Winged Shadow How High (non supporté) - + Delete Sensor. Are you sure? Supprimer le Capteur. Êtes-vous sûr? @@ -12719,72 +12764,72 @@ Trop d'erreurs, abandon. TelemetrySensorPanel - + TELE%1 - + Popup menu available Menu contextuel disponible - + Copy Copier - + Cut Couper - + Paste Coller - + Clear Effacer - + Insert Insérer - + Delete Supprimer - + Move Up Monter - + Move Down Descendre - + Clear All Effacer Tout - + Cut Telemetry Sensor. Are you sure? Couper le capteur de télémétrie. Êtes-vous sûr? - + Clear Telemetry Sensor. Are you sure? Effacer le capteur de télémétrie. Êtes-vous sûr? - + Clear all Telemetry Sensors. Are you sure? Effacez tous les capteurs de télémétrie. Êtes-vous sûr? From 4e62d0b1b7ebfd6dd69a525e575f033fcdafc69d Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 19 Mar 2021 06:17:35 +1100 Subject: [PATCH 148/188] Fix model upd refs custom function reset timer --- companion/src/firmwares/modeldata.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 3efb7ae6a..969485081 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1356,7 +1356,6 @@ void ModelData::sortMixes() void ModelData::updateResetParam(CustomFunctionData * cfd) { - if (cfd->func != FuncReset) return; @@ -1367,6 +1366,11 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) switch (updRefInfo.type) { + case REF_UPD_TYPE_TIMER: + if (cfd->param < 0 || cfd->param > 2) + return; + idxAdj = -2; // reverse earlier offset required for rawsource + break; case REF_UPD_TYPE_SENSOR: idxAdj = 5/*3 Timers + Flight + Telemetery*/ + firmware->getCapability(RotaryEncoders); if (cfd->param < idxAdj || cfd->param > (idxAdj + firmware->getCapability(Sensors))) @@ -1376,6 +1380,8 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) return; } + qDebug() << "index1" << updRefInfo.index1 << "shift:" << updRefInfo.shift << "cfd->param:" << cfd->param << "idxAdj:" << idxAdj; + switch (updRefInfo.action) { case REF_UPD_ACT_CLEAR: From 772564ccd3c06e6ad802ef1dba85d348365fbb0c Mon Sep 17 00:00:00 2001 From: elecpower Date: Wed, 17 Mar 2021 20:26:45 +1100 Subject: [PATCH 149/188] Fix custom function reset model refresh --- companion/src/datamodels/compounditemmodels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/companion/src/datamodels/compounditemmodels.cpp b/companion/src/datamodels/compounditemmodels.cpp index ab0ba83ba..b64efb7b5 100644 --- a/companion/src/datamodels/compounditemmodels.cpp +++ b/companion/src/datamodels/compounditemmodels.cpp @@ -444,7 +444,7 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin AbstractDynamicItemModel(generalSettings, modelData, firmware, board, boardType) { setId(IMID_CustomFuncResetParam); - setUpdateMask(IMUE_TeleSensors); + setUpdateMask(IMUE_TeleSensors | IMUE_Timers); for (int i = 0; i < CustomFunctionData::resetParamCount(); i++) { QStandardItem * modelItem = new QStandardItem(); From 1547cad595a14fc1c80cca4cd456669c4929be3f Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 19 Mar 2021 06:17:35 +1100 Subject: [PATCH 150/188] Fix model upd refs custom function reset timer --- companion/src/firmwares/modeldata.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 7657e2798..04552a6e4 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1381,7 +1381,6 @@ void ModelData::sortMixes() void ModelData::updateResetParam(CustomFunctionData * cfd) { - if (cfd->func != FuncReset) return; @@ -1392,6 +1391,11 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) switch (updRefInfo.type) { + case REF_UPD_TYPE_TIMER: + if (cfd->param < 0 || cfd->param > 2) + return; + idxAdj = -2; // reverse earlier offset required for rawsource + break; case REF_UPD_TYPE_SENSOR: idxAdj = 5/*3 Timers + Flight + Telemetery*/ + firmware->getCapability(RotaryEncoders); if (cfd->param < idxAdj || cfd->param > (idxAdj + firmware->getCapability(Sensors))) @@ -1401,6 +1405,8 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) return; } + qDebug() << "index1" << updRefInfo.index1 << "shift:" << updRefInfo.shift << "cfd->param:" << cfd->param << "idxAdj:" << idxAdj; + switch (updRefInfo.action) { case REF_UPD_ACT_CLEAR: From 227ef21bd4164cb550318fc0d90b2fa55b7b94c3 Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 19 Mar 2021 06:31:54 +1100 Subject: [PATCH 151/188] Remove debug line --- companion/src/firmwares/modeldata.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 04552a6e4..f5061b567 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1405,8 +1405,6 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) return; } - qDebug() << "index1" << updRefInfo.index1 << "shift:" << updRefInfo.shift << "cfd->param:" << cfd->param << "idxAdj:" << idxAdj; - switch (updRefInfo.action) { case REF_UPD_ACT_CLEAR: From 1747f9aa172aef6e012169987f90d150659c797f Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 19 Mar 2021 06:34:10 +1100 Subject: [PATCH 152/188] Remove debug line --- companion/src/firmwares/modeldata.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 969485081..5863890f3 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1380,8 +1380,6 @@ void ModelData::updateResetParam(CustomFunctionData * cfd) return; } - qDebug() << "index1" << updRefInfo.index1 << "shift:" << updRefInfo.shift << "cfd->param:" << cfd->param << "idxAdj:" << idxAdj; - switch (updRefInfo.action) { case REF_UPD_ACT_CLEAR: From 96825d04a0113d7ad3add51a745b93631354caa0 Mon Sep 17 00:00:00 2001 From: elecpower Date: Fri, 19 Mar 2021 07:13:25 +1100 Subject: [PATCH 153/188] Initialise variable --- companion/src/modeledit/setup.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 40abc2f2f..3a3a7e910 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -37,7 +37,8 @@ TimerPanel::TimerPanel(QWidget * parent, ModelData & model, TimerData & timer, G QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels): ModelPanel(parent, model, generalSettings, firmware), timer(timer), - ui(new Ui::Timer) + ui(new Ui::Timer), + modelsUpdateCnt(0) { ui->setupUi(this); connectItemModelEvents(panelFilteredModels->getItemModel(FIM_TIMERSWITCH)); From ce0e31436c764dc802c16e9b4d29b33c7c435bac Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 19 Mar 2021 12:18:56 +0100 Subject: [PATCH 154/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 897bd6700..418aae071 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2189,3 +2189,4 @@ James Mandelbaum Javier J. Cordovez Jess Barkley Schneider Modell +Michael Hasselgaard From f5e34c12776b19df0e0c98890ff4f252f6bb7aa6 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 19 Mar 2021 12:19:12 +0100 Subject: [PATCH 155/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 418aae071..ffe08c617 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2190,3 +2190,4 @@ Javier J. Cordovez Jess Barkley Schneider Modell Michael Hasselgaard +Thomas Young From 1624d5b69cec3601d4ff3442ba4cc4b7f071e6f4 Mon Sep 17 00:00:00 2001 From: Risto Date: Fri, 19 Mar 2021 18:55:47 +0100 Subject: [PATCH 156/188] STM32 WordLength 9b -> 8b data + parity Fixed comment. STM32 WordLength 9b is here necessary due to parity bit (8b data + 1b parity) and not due to 2 stop bits. --- radio/src/targets/common/arm/stm32/aux_serial_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp index 9cc558b51..86082f7f8 100644 --- a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp +++ b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp @@ -124,7 +124,7 @@ void auxSerialInit(unsigned int mode, unsigned int protocol) break; case UART_MODE_SBUS_TRAINER: - auxSerialSetup(SBUS_BAUDRATE, true, USART_WordLength_9b, USART_Parity_Even, USART_StopBits_2); // 2 stop bits requires USART_WordLength_9b + auxSerialSetup(SBUS_BAUDRATE, true, USART_WordLength_9b, USART_Parity_Even, USART_StopBits_2); // USART_WordLength_9b due to parity bit AUX_SERIAL_POWER_ON(); break; From 6a7ffd50bb2ad4568d7c757bc53dbf0a7e2e89f7 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 22 Mar 2021 09:44:04 +0100 Subject: [PATCH 157/188] Update CREDITS.txt --- CREDITS.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index ffe08c617..7d9f9fda6 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2191,3 +2191,11 @@ Jess Barkley Schneider Modell Michael Hasselgaard Thomas Young +Непочатов Алексей +Thomas Goebel +Joseph Macias +Paw Melin-Nielsen +Liam O'Brien +Ronald B Backman +Corvus Inspection Services Inc +Stuart Posnett From 02c51a19dbe36994c8192deb86258ab51b688922 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 26 Mar 2021 18:38:56 +0100 Subject: [PATCH 158/188] Update CREDITS.txt --- CREDITS.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 7d9f9fda6..58ecae6a2 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2199,3 +2199,9 @@ Liam O'Brien Ronald B Backman Corvus Inspection Services Inc Stuart Posnett +Clark Emerick +Helmut Sippel +Jhon Lennon Silva do Nascimento +Peter McCarthy +Bob Brown +Claude Lawyer From a360963b511382f928eea76be7d7de5164b1768a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 26 Mar 2021 21:42:48 +0100 Subject: [PATCH 159/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index 58ecae6a2..bb524647a 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2205,3 +2205,4 @@ Jhon Lennon Silva do Nascimento Peter McCarthy Bob Brown Claude Lawyer +Peter Fithern From f03ebccfa87808389f376f57af45a2557d83cac1 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 27 Mar 2021 00:01:45 +0100 Subject: [PATCH 160/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index bb524647a..b535b828f 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2206,3 +2206,4 @@ Peter McCarthy Bob Brown Claude Lawyer Peter Fithern +Michael Hoffman From 9fd4d2873873e3987008c8d293b3cfdc543d5220 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 28 Mar 2021 07:56:52 +1100 Subject: [PATCH 161/188] Move limitdata array manipulation from ui to model --- companion/src/firmwares/modeldata.cpp | 76 +++++++++++++++++++++++++ companion/src/firmwares/modeldata.h | 8 +++ companion/src/firmwares/output_data.cpp | 3 +- companion/src/modeledit/channels.cpp | 60 +++++++------------ companion/src/modeledit/channels.h | 1 - 5 files changed, 106 insertions(+), 42 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 7657e2798..52244b342 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1478,3 +1478,79 @@ bool ModelData::isThrTraceSrcAvailable(const GeneralSettings * generalSettings, else return true; } + +void ModelData::limitsClear(const int index) +{ + if (index < 0 || index >= CPN_MAX_CHNOUT) + return; + + if (!limitData[index].isEmpty()) { + limitData[index].clear(); + updateAllReferences(REF_UPD_TYPE_CHANNEL, REF_UPD_ACT_CLEAR, index); + } +} + +void ModelData::limitsClearAll() +{ + for (int i = 0; i < CPN_MAX_CHNOUT; i++) { + limitsClear(i); + } +} + +void ModelData::limitsDelete(const int index) +{ + if (index < 0 || index >= CPN_MAX_CHNOUT) + return; + + memmove(&limitData[index], &limitData[index + 1], (CPN_MAX_CHNOUT - (index + 1)) * sizeof(LimitData)); + limitData[CPN_MAX_CHNOUT - 1].clear(); + updateAllReferences(REF_UPD_TYPE_CHANNEL, REF_UPD_ACT_SHIFT, index, 0, -1); +} + +void ModelData::limitsGet(const int index, QByteArray & data) +{ + if (index < 0 || index >= CPN_MAX_CHNOUT) + return; + + data.append((char*)&limitData[index], sizeof(LimitData)); +} + +void ModelData::limitsInsert(const int index) +{ + if (index < 0 || index >= CPN_MAX_CHNOUT) + return; + + memmove(&limitData[index + 1], &limitData[index], (CPN_MAX_CHNOUT - (index + 1)) * sizeof(LimitData)); + limitData[index].clear(); + updateAllReferences(REF_UPD_TYPE_CHANNEL, REF_UPD_ACT_SHIFT, index, 0, 1); +} + +void ModelData::limitsMove(const int index, const int offset) +{ + if (index + offset < 0 || index + offset >= CPN_MAX_CHNOUT) + return; + + int idx1 = index; + int idx2; + const int direction = offset < 0 ? -1 : 1; + const int cnt = abs(offset); + + for (int i = 1; i <= cnt; i++) { + idx2 = idx1 + direction; + LimitData chntmp = limitData[idx2]; + LimitData *chn1 = &limitData[idx1]; + LimitData *chn2 = &limitData[idx2]; + memcpy(chn2, chn1, sizeof(LimitData)); + memcpy(chn1, &chntmp, sizeof(LimitData)); + updateAllReferences(REF_UPD_TYPE_CHANNEL, REF_UPD_ACT_SWAP, idx1, idx2); + idx1 += direction; + } +} + +void ModelData::limitsSet(const int index, const QByteArray & data) +{ + if (index < 0 || index >= CPN_MAX_CHNOUT || data.size() < (int)sizeof(LimitData)) + return; + + memcpy(&limitData[index], data.constData(), sizeof(LimitData)); +} diff --git a/companion/src/firmwares/modeldata.h b/companion/src/firmwares/modeldata.h index 80b7d7353..4794ff232 100644 --- a/companion/src/firmwares/modeldata.h +++ b/companion/src/firmwares/modeldata.h @@ -294,6 +294,14 @@ class ModelData { int thrTraceSrcCount() const; bool isThrTraceSrcAvailable(const GeneralSettings * generalSettings, const int index) const; + void limitsClear(const int index); + void limitsClearAll(); + void limitsDelete(const int index); + void limitsGet(const int index, QByteArray & data); + void limitsInsert(const int index); + void limitsMove(const int index, const int offset); + void limitsSet(const int index, const QByteArray & data); + protected: void removeGlobalVar(int & var); diff --git a/companion/src/firmwares/output_data.cpp b/companion/src/firmwares/output_data.cpp index 63127d242..d5cc585ee 100644 --- a/companion/src/firmwares/output_data.cpp +++ b/companion/src/firmwares/output_data.cpp @@ -31,7 +31,8 @@ void LimitData::clear() bool LimitData::isEmpty() const { - return (min == -1000 && max == 1000 && !revert && !offset && !ppmCenter && !symetrical && name[0] == '\0' && !curve.isSet()); + LimitData tmp; + return !memcmp(this, &tmp, sizeof(LimitData)); } QString LimitData::minToString() const diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index 5ec77ce55..806ea144e 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -312,10 +312,9 @@ void ChannelsPanel::cmPaste() { QByteArray data; if (hasClipboardData(&data)) { - memcpy(&model->limitData[selectedIndex], data.constData(), sizeof(LimitData)); + model->limitsSet(selectedIndex, data); updateLine(selectedIndex); updateItemModels(); - emit modified(); } } @@ -324,22 +323,18 @@ void ChannelsPanel::cmDelete() if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Delete Channel. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; - memmove(&model->limitData[selectedIndex], &model->limitData[selectedIndex + 1], (CPN_MAX_CHNOUT - (selectedIndex + 1)) * sizeof(LimitData)); - model->limitData[chnCapability - 1].clear(); - model->updateAllReferences(ModelData::REF_UPD_TYPE_CHANNEL, ModelData::REF_UPD_ACT_SHIFT, selectedIndex, 0, -1); - + model->limitsDelete(selectedIndex); for (int i = selectedIndex; i < chnCapability; i++) { updateLine(i); } updateItemModels(); - emit modified(); } void ChannelsPanel::cmCopy() { QByteArray data; - data.append((char*)&model->limitData[selectedIndex], sizeof(LimitData)); + model->limitsGet(selectedIndex, data); QMimeData *mimeData = new QMimeData; mimeData->setData(MIMETYPE_CHANNEL, data); QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard); @@ -405,12 +400,18 @@ bool ChannelsPanel::moveUpAllowed() const void ChannelsPanel::cmMoveUp() { - swapData(selectedIndex, selectedIndex - 1); + model->limitsMove(selectedIndex, -1); + updateLine(selectedIndex - 1); + updateLine(selectedIndex); + updateItemModels(); } void ChannelsPanel::cmMoveDown() { - swapData(selectedIndex, selectedIndex + 1); + model->limitsMove(selectedIndex, 1); + updateLine(selectedIndex); + updateLine(selectedIndex + 1); + updateItemModels(); } void ChannelsPanel::cmClear(bool prompt) @@ -420,11 +421,9 @@ void ChannelsPanel::cmClear(bool prompt) return; } - model->limitData[selectedIndex].clear(); - model->updateAllReferences(ModelData::REF_UPD_TYPE_CHANNEL, ModelData::REF_UPD_ACT_CLEAR, selectedIndex); + model->limitsClear(selectedIndex); updateLine(selectedIndex); updateItemModels(); - emit modified(); } void ChannelsPanel::cmClearAll() @@ -432,39 +431,19 @@ void ChannelsPanel::cmClearAll() if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Channels. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; - for (int i = 0; i < chnCapability; i++) { - model->limitData[i].clear(); - model->updateAllReferences(ModelData::REF_UPD_TYPE_CHANNEL, ModelData::REF_UPD_ACT_CLEAR, i); - updateLine(i); - } + model->limitsClearAll(); + update(); updateItemModels(); - emit modified(); } void ChannelsPanel::cmInsert() { - memmove(&model->limitData[selectedIndex + 1], &model->limitData[selectedIndex], (CPN_MAX_CHNOUT - (selectedIndex + 1)) * sizeof(LimitData)); - model->limitData[selectedIndex].clear(); - model->updateAllReferences(ModelData::REF_UPD_TYPE_CHANNEL, ModelData::REF_UPD_ACT_SHIFT, selectedIndex, 0, 1); - update(); - updateItemModels(); - emit modified(); -} - -void ChannelsPanel::swapData(int idx1, int idx2) -{ - if ((idx1 != idx2) && (!model->limitData[idx1].isEmpty() || !model->limitData[idx2].isEmpty())) { - LimitData chntmp = model->limitData[idx2]; - LimitData *chn1 = &model->limitData[idx1]; - LimitData *chn2 = &model->limitData[idx2]; - memcpy(chn2, chn1, sizeof(LimitData)); - memcpy(chn1, &chntmp, sizeof(LimitData)); - model->updateAllReferences(ModelData::REF_UPD_TYPE_CHANNEL, ModelData::REF_UPD_ACT_SWAP, idx1, idx2); - updateLine(idx1); - updateLine(idx2); - updateItemModels(); - emit modified(); + model->limitsInsert(selectedIndex); + for (int i = selectedIndex; i < chnCapability; i++) { + updateLine(i); } + + updateItemModels(); } void ChannelsPanel::connectItemModelEvents(const FilteredItemModel * itemModel) @@ -487,4 +466,5 @@ void ChannelsPanel::onItemModelUpdateComplete() void ChannelsPanel::updateItemModels() { sharedItemModels->update(AbstractItemModel::IMUE_Channels); + emit modified(); } diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index 574e316d8..5d7600718 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -91,7 +91,6 @@ class ChannelsPanel : public ModelPanel bool insertAllowed() const; bool moveDownAllowed() const; bool moveUpAllowed() const; - void swapData(int idx1, int idx2); QLineEdit *name[CPN_MAX_CHNOUT]; LimitsGroup *chnOffset[CPN_MAX_CHNOUT]; LimitsGroup *chnMin[CPN_MAX_CHNOUT]; From 9372ff67c375acd92c164352d49178a78b383190 Mon Sep 17 00:00:00 2001 From: elecpower Date: Sun, 28 Mar 2021 08:40:49 +1100 Subject: [PATCH 162/188] Cosmetics --- companion/src/firmwares/modeldata.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 52244b342..1e5d4d59c 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1537,11 +1537,11 @@ void ModelData::limitsMove(const int index, const int offset) for (int i = 1; i <= cnt; i++) { idx2 = idx1 + direction; - LimitData chntmp = limitData[idx2]; - LimitData *chn1 = &limitData[idx1]; - LimitData *chn2 = &limitData[idx2]; - memcpy(chn2, chn1, sizeof(LimitData)); - memcpy(chn1, &chntmp, sizeof(LimitData)); + LimitData tmp = limitData[idx2]; + LimitData *d1 = &limitData[idx1]; + LimitData *d2 = &limitData[idx2]; + memcpy(d2, d1, sizeof(LimitData)); + memcpy(d1, &tmp, sizeof(LimitData)); updateAllReferences(REF_UPD_TYPE_CHANNEL, REF_UPD_ACT_SWAP, idx1, idx2); idx1 += direction; } From dbd432b3abdb7d3667b39b8b2f472c0062916663 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 28 Mar 2021 20:17:37 +0200 Subject: [PATCH 163/188] Update CREDITS.txt --- CREDITS.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index b535b828f..d04377815 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2207,3 +2207,6 @@ Bob Brown Claude Lawyer Peter Fithern Michael Hoffman +Tim Smith +OpenSki Institute +Simon Melov From 2cf7e3de89af17152b50ab25df48643108e736eb Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 29 Mar 2021 16:29:04 +0200 Subject: [PATCH 164/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index d04377815..ecf77e2ae 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2210,3 +2210,4 @@ Michael Hoffman Tim Smith OpenSki Institute Simon Melov +Richard Podolsky From eef1d5cc9ab24dc44123cf8b7e727558ec0da2a6 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 30 Mar 2021 17:47:15 +0200 Subject: [PATCH 165/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index ecf77e2ae..8057e9e66 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2211,3 +2211,4 @@ Tim Smith OpenSki Institute Simon Melov Richard Podolsky +James Wilson From 9a222e7ad00831f24bbb99b89d50a0816e55f1fe Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 30 Mar 2021 22:04:16 +0200 Subject: [PATCH 166/188] Update CREDITS.txt --- CREDITS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 8057e9e66..ced0fb4cf 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2212,3 +2212,5 @@ OpenSki Institute Simon Melov Richard Podolsky James Wilson +John Norrbin +James Goins From ece17bf5de628f4e2457d3e88fb59cceec3150e0 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 31 Mar 2021 10:08:52 +0200 Subject: [PATCH 167/188] Update CREDITS.txt --- CREDITS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.txt b/CREDITS.txt index ced0fb4cf..9a1f15566 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2214,3 +2214,4 @@ Richard Podolsky James Wilson John Norrbin James Goins +Phillip Nguyen From 874a06eeb6f12ed6215497b09ef6ace1752127ac Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 1 Apr 2021 08:25:02 +0200 Subject: [PATCH 168/188] Add space to SD edit name --- radio/src/gui/common/stdlcd/draw_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/gui/common/stdlcd/draw_functions.cpp b/radio/src/gui/common/stdlcd/draw_functions.cpp index 056a66b08..c7d9142ed 100644 --- a/radio/src/gui/common/stdlcd/draw_functions.cpp +++ b/radio/src/gui/common/stdlcd/draw_functions.cpp @@ -145,7 +145,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui if (c <= 0) v = -v; } else { - v = checkIncDec(event, abs(v), '0', 'z', 0); + v = checkIncDec(event, abs(v), ' ', 'z', 0); } } From b597634b7e0a4fceb3a9d119810e448b5cd84cb1 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 1 Apr 2021 08:29:42 +0200 Subject: [PATCH 169/188] Update CREDITS.txt --- CREDITS.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 9a1f15566..57c215c4c 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2215,3 +2215,6 @@ James Wilson John Norrbin James Goins Phillip Nguyen +Jeffrey M Engel +Richard Marotto +Greg Bell From 49c7d5312a12ef44d9e8643bbd396f7a8f3936f5 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 1 Apr 2021 09:20:40 +0200 Subject: [PATCH 170/188] TODO removed --- radio/src/targets/horus/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 8550d1517..1f81076e1 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -381,7 +381,7 @@ enum Analogs { SLIDER_LAST = SLIDER_FIRST + NUM_SLIDERS - 1, TX_VOLTAGE, #if defined(PCBX12S) - MOUSE1, // TODO why after voltage? + MOUSE1, // after voltage because previous ones come from SPI on X12S MOUSE2, #endif NUM_ANALOGS From a167ded9b534f373904e4424e053187b90237b8a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sat, 3 Apr 2021 10:27:22 +0200 Subject: [PATCH 171/188] Update CREDITS.txt --- CREDITS.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS.txt b/CREDITS.txt index 57c215c4c..f4eb7a375 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2218,3 +2218,6 @@ Phillip Nguyen Jeffrey M Engel Richard Marotto Greg Bell +Scott Geer +Thomas Abshier + From 78dd516069c7055bc27e5013b1565d985baea69b Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 4 Apr 2021 19:00:01 +0200 Subject: [PATCH 172/188] Allow PCBSKY9X compilation --- radio/src/opentx.h | 1 + radio/src/pulses/pulses.cpp | 43 ++++++++++++++++++++++++++++++++++- radio/src/tasks.cpp | 28 +++++++++++++++++++++++ radio/src/telemetry/multi.cpp | 3 ++- 4 files changed, 73 insertions(+), 2 deletions(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 3d3cc3ae7..ddfcb9830 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -502,6 +502,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms); void evalMixes(uint8_t tick10ms); void doMixerCalculations(); void doMixerPeriodicUpdates(); +void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms); void checkTrims(); extern uint8_t currentBacklightBright; diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 7292bb200..810fd9378 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -241,8 +241,12 @@ void enablePulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_DSM2_LP45: case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: +#if defined(PCBSKY9X) + extmoduleSerialStart(DSM2_BAUDRATE, DSM2_PERIOD * 2000, false); +#else extmoduleSerialStart(); mixerSchedulerSetPeriod(EXTERNAL_MODULE, DSM2_PERIOD); +#endif break; #endif @@ -274,15 +278,23 @@ void enablePulsesExternalModule(uint8_t protocol) #if defined(MULTIMODULE) case PROTOCOL_CHANNELS_MULTIMODULE: +#if defined(PCBSKY9X) + extmoduleSerialStart(MULTIMODULE_BAUDRATE, MULTIMODULE_PERIOD * 2000, true); +#else extmoduleSerialStart(); mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD); +#endif break; #endif #if defined(SBUS) case PROTOCOL_CHANNELS_SBUS: +#if defined(PCBSKY9X) + extmoduleSerialStart(SBUS_BAUDRATE, SBUS_PERIOD_HALF_US, false); +#else extmoduleSerialStart(); mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD); +#endif break; #endif @@ -314,12 +326,18 @@ bool setupPulsesExternalModule(uint8_t protocol) #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX_PULSES_PERIOD); +#endif return true; #endif #if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML) case PROTOCOL_CHANNELS_PXX1_SERIAL: extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD); +#endif return true; #endif @@ -327,13 +345,18 @@ bool setupPulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: case PROTOCOL_CHANNELS_PXX2_LOWSPEED: extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE); +#if defined(PCBSKY9X) + sheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_PERIOD); +#endif return true; #endif #if defined(SBUS) case PROTOCOL_CHANNELS_SBUS: setupPulsesSbus(); - +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD); +#endif // SBUS_PERIOD is not a constant! It can be set from UI mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD); return true; @@ -344,6 +367,9 @@ bool setupPulsesExternalModule(uint8_t protocol) case PROTOCOL_CHANNELS_DSM2_DSM2: case PROTOCOL_CHANNELS_DSM2_DSMX: setupPulsesDSM2(); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, DSM2_PERIOD); +#endif return true; #endif @@ -356,6 +382,9 @@ bool setupPulsesExternalModule(uint8_t protocol) else mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD); setupPulsesCrossfire(); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, CROSSFIRE_PERIOD); +#endif return true; } #endif @@ -369,6 +398,9 @@ bool setupPulsesExternalModule(uint8_t protocol) else mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD); setupPulsesGhost(); +#if defined(PCBSKPCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, GHOST_PERIOD); +#endif return true; } #endif @@ -382,6 +414,9 @@ bool setupPulsesExternalModule(uint8_t protocol) else mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD); setupPulsesMultiExternalModule(); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, MULTIMODULE_PERIOD); +#endif return true; } #endif @@ -389,12 +424,18 @@ bool setupPulsesExternalModule(uint8_t protocol) #if defined(PPM) case PROTOCOL_CHANNELS_PPM: setupPulsesPPMExternalModule(); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE)); +#endif return true; #endif #if defined(AFHDS3) case PROTOCOL_CHANNELS_AFHDS3: extmodulePulsesData.afhds3.setupFrame(); +#if defined(PCBSKY9X) + scheduleNextMixerCalculation(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT); +#endif return true; #endif diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index d0aa8e3d2..97f78c972 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -118,7 +118,9 @@ TASK_FUNCTION(mixerTask) s_pulses_paused = true; mixerSchedulerInit(); +#if !defined(PCBSKY9X) mixerSchedulerStart(); +#endif while (true) { #if defined(SBUS_TRAINER) @@ -142,8 +144,10 @@ TASK_FUNCTION(mixerTask) GPIO_ResetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN); #endif +#if !defined(PCBSKY9X) // re-enable trigger mixerSchedulerEnableTrigger(); +#endif #if defined(SIMU) if (pwrCheck() == e_power_off) { @@ -164,7 +168,11 @@ TASK_FUNCTION(mixerTask) doMixerCalculations(); // TODO: fix runMask +#if defined(PCBSKY9X) + sendSynchronousPulses(1 << EXTERNAL_MODULE); +#else sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE)); +#endif doMixerPeriodicUpdates(); @@ -200,12 +208,32 @@ TASK_FUNCTION(mixerTask) // TODO: // - check the cause of timeouts when switching // between protocols with multi-proto RF +#if defined(DEBUG) if (timeout) serialPrint("mix sched timeout!"); +#endif } } } +void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms) +{ + // Schedule next mixer calculation time, + + if (isModuleSynchronous(module)) { + nextMixerTime[module] += period_ms / RTOS_MS_PER_TICK; + if (nextMixerTime[module] < RTOS_GET_TIME()) { + // we are late ... let's add some small delay + nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK); + } + } + else { + // for now assume mixer calculation takes 2 ms. + nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK); + } + + DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage); +} #define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms diff --git a/radio/src/telemetry/multi.cpp b/radio/src/telemetry/multi.cpp index 1cb560b14..624effbba 100644 --- a/radio/src/telemetry/multi.cpp +++ b/radio/src/telemetry/multi.cpp @@ -252,8 +252,9 @@ static void processMultiSyncPacket(const uint8_t * data, uint8_t module) // inputLag -= refreshRate; status.update(refreshRate, inputLag); - +#if defined(DEBUG) serialPrint("MP ADJ: R %d, L %04d", refreshRate, inputLag); +#endif } #if defined(PCBTARANIS) || defined(PCBHORUS) From d30bcb0232573d0b56363948a5c683709acf0495 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 5 Apr 2021 10:13:59 +0200 Subject: [PATCH 173/188] Update CREDITS.txt --- CREDITS.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CREDITS.txt b/CREDITS.txt index f4eb7a375..d05842991 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -2220,4 +2220,7 @@ Richard Marotto Greg Bell Scott Geer Thomas Abshier - +Ernst Camenzind +Radomir Sterba +Ignacio Barrio +Bradley Murchie From 84387e7e0f99169fdf88247b4f819954505d29e6 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 11:16:17 +0200 Subject: [PATCH 174/188] Cosmetics --- radio/src/gui/gui_common.h | 1 - .../taranis/intmodule_pulses_driver.cpp | 8 --- radio/src/tasks.cpp | 4 -- radio/src/telemetry/crossfire.cpp | 1 - radio/src/telemetry/crossfire.h | 2 +- radio/src/telemetry/multi.cpp | 3 -- radio/src/telemetry/telemetry.cpp | 4 -- tools/commit-tests.sh | 52 +++++++++---------- 8 files changed, 27 insertions(+), 48 deletions(-) diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index b7d73d075..80b675b42 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -185,7 +185,6 @@ inline uint8_t MODULE_CHANNELS_ROWS(int moduleIdx) } #if defined(MULTIMODULE) - inline uint8_t MULTI_DISABLE_CHAN_MAP_ROW(uint8_t moduleIdx) { if (!isModuleMultimodule(moduleIdx)) diff --git a/radio/src/targets/taranis/intmodule_pulses_driver.cpp b/radio/src/targets/taranis/intmodule_pulses_driver.cpp index 588e1a448..5de2daa1b 100644 --- a/radio/src/targets/taranis/intmodule_pulses_driver.cpp +++ b/radio/src/targets/taranis/intmodule_pulses_driver.cpp @@ -42,14 +42,6 @@ void intmoduleSendNextFrame() #if defined(PXX1) case PROTOCOL_CHANNELS_PXX1_PULSES: { - // uint32_t last = intmodulePulsesData.pxx.getLast(); - // if (heartbeatCapture.valid) { - // if (getTmr2MHz() - heartbeatCapture.timestamp > HEARBEAT_OFFSET) - // last -= 21; - // else - // last += 19; - // intmodulePulsesData.pxx.setLast(last); - // } if (INTMODULE_DMA_STREAM->CR & DMA_SxCR_EN) return; diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index 97f78c972..e71d8829a 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -67,7 +67,6 @@ bool isForcePowerOffRequested() bool isModuleSynchronous(uint8_t moduleIdx) { switch(moduleState[moduleIdx].protocol) { - case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: case PROTOCOL_CHANNELS_PXX2_LOWSPEED: case PROTOCOL_CHANNELS_CROSSFIRE: @@ -109,8 +108,6 @@ void sendSynchronousPulses(uint8_t runMask) } } -//#define DEBUG_MIXER_SCHEDULER - uint32_t nextMixerTime[NUM_MODULES]; TASK_FUNCTION(mixerTask) @@ -181,7 +178,6 @@ TASK_FUNCTION(mixerTask) RTOS_UNLOCK_MUTEX(mixerMutex); DEBUG_TIMER_STOP(debugTimerMixer); - #if defined(STM32) && !defined(SIMU) if (getSelectedUsbMode() == USB_JOYSTICK_MODE) { usbJoystickUpdate(); diff --git a/radio/src/telemetry/crossfire.cpp b/radio/src/telemetry/crossfire.cpp index 173ea38f4..64dba983d 100644 --- a/radio/src/telemetry/crossfire.cpp +++ b/radio/src/telemetry/crossfire.cpp @@ -203,7 +203,6 @@ void processCrossfireTelemetryFrame() } break; - #if defined(LUA) default: if (luaInputTelemetryFifo && luaInputTelemetryFifo->hasSpace(telemetryRxBufferCount-2) ) { diff --git a/radio/src/telemetry/crossfire.h b/radio/src/telemetry/crossfire.h index fb68b8a1a..23d39947e 100644 --- a/radio/src/telemetry/crossfire.h +++ b/radio/src/telemetry/crossfire.h @@ -104,7 +104,7 @@ const uint8_t CROSSFIRE_PERIODS[] = { }; #if SPORT_MAX_BAUDRATE < 400000 || defined(DEBUG) #define CROSSFIRE_BAUDRATE CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate] -#define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate]*1000) +#define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate] * 1000) #else #define CROSSFIRE_BAUDRATE 400000 #define CROSSFIRE_PERIOD 4000 /* us; 250 Hz */ diff --git a/radio/src/telemetry/multi.cpp b/radio/src/telemetry/multi.cpp index 624effbba..d71cdad34 100644 --- a/radio/src/telemetry/multi.cpp +++ b/radio/src/telemetry/multi.cpp @@ -248,9 +248,6 @@ static void processMultiSyncPacket(const uint8_t * data, uint8_t module) uint16_t refreshRate = data[0] << 8 | data[1]; int16_t inputLag = data[2] << 8 | data[3]; - // if (inputLag > refreshRate/2) - // inputLag -= refreshRate; - status.update(refreshRate, inputLag); #if defined(DEBUG) serialPrint("MP ADJ: R %d, L %04d", refreshRate, inputLag); diff --git a/radio/src/telemetry/telemetry.cpp b/radio/src/telemetry/telemetry.cpp index 17777dc6a..700bf535a 100644 --- a/radio/src/telemetry/telemetry.cpp +++ b/radio/src/telemetry/telemetry.cpp @@ -378,23 +378,19 @@ Fifo * luaInputTelemetryFifo = NULL; #endif #if defined(HARDWARE_INTERNAL_MODULE) - static ModuleSyncStatus moduleSyncStatus[NUM_MODULES]; ModuleSyncStatus &getModuleSyncStatus(uint8_t moduleIdx) { return moduleSyncStatus[moduleIdx]; } - #else - static ModuleSyncStatus moduleSyncStatus; ModuleSyncStatus &getModuleSyncStatus(uint8_t moduleIdx) { return moduleSyncStatus; } - #endif ModuleSyncStatus::ModuleSyncStatus() diff --git a/tools/commit-tests.sh b/tools/commit-tests.sh index 9ecd88769..be5940308 100755 --- a/tools/commit-tests.sh +++ b/tools/commit-tests.sh @@ -58,32 +58,32 @@ COMMON_OPTIONS+=${EXTRA_OPTIONS} mkdir build || true cd build -#if [[ " SKY9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then -# # OpenTX on Sky9x -# rm -rf ./* -# cmake "${COMMON_OPTIONS}" -DPCB=SKY9X -DHELI=YES DLUA=YES -DTELEMETRY=FRSKY -DPPM_LIMITS_SYMETRICAL=YES -DVARIO=YES -DAUTOSWITCH=YES -DAUTOSOURCE=YES -DAUDIO=YES -DGPS=YES -DPPM_CENTER_ADJUSTABLE=YES -DFLIGHT_MODES=YES -DOVERRIDE_CHANNEL_FUNCTION=YES -DFRSKY_STICKS=YES -DGVARS=YES "${SRCDIR}" -# make -j"${CORES}" ${FIRMARE_TARGET} -# make -j"${CORES}" libsimulator -# make -j"${CORES}" tests-radio -#fi -# -#if [[ " AR9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then -# # OpenTX on AR9X -# rm -rf ./* -# cmake "${COMMON_OPTIONS}" -DPCB=AR9X -DHELI=YES -DGVARS=YES "${SRCDIR}" -# make -j"${CORES}" ${FIRMARE_TARGET} -# make -j"${CORES}" libsimulator -# make -j"${CORES}" tests-radio -#fi -# -#if [[ " 9XRPRO ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then -# # OpenTX on Sky9x -# rm -rf ./* -# cmake "${COMMON_OPTIONS}" -DPCB=9XRPRO -DHELI=YES -DGVARS=YES "${SRCDIR}" -# make -j"${CORES}" ${FIRMARE_TARGET} -# make -j"${CORES}" libsimulator -# make -j"${CORES}" tests-radio -#fi +if [[ " SKY9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then + # OpenTX on Sky9x + rm -rf ./* + cmake "${COMMON_OPTIONS}" -DPCB=SKY9X -DHELI=YES DLUA=YES -DTELEMETRY=FRSKY -DPPM_LIMITS_SYMETRICAL=YES -DVARIO=YES -DAUTOSWITCH=YES -DAUTOSOURCE=YES -DAUDIO=YES -DGPS=YES -DPPM_CENTER_ADJUSTABLE=YES -DFLIGHT_MODES=YES -DOVERRIDE_CHANNEL_FUNCTION=YES -DFRSKY_STICKS=YES -DGVARS=YES "${SRCDIR}" + make -j"${CORES}" ${FIRMARE_TARGET} + make -j"${CORES}" libsimulator + make -j"${CORES}" tests-radio +fi + +if [[ " AR9X ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then + # OpenTX on AR9X + rm -rf ./* + cmake "${COMMON_OPTIONS}" -DPCB=AR9X -DHELI=YES -DGVARS=YES "${SRCDIR}" + make -j"${CORES}" ${FIRMARE_TARGET} + make -j"${CORES}" libsimulator + make -j"${CORES}" tests-radio +fi + +if [[ " 9XRPRO ARM9X ALL " =~ \ ${FLAVOR}\ ]] ; then + # OpenTX on Sky9x + rm -rf ./* + cmake "${COMMON_OPTIONS}" -DPCB=9XRPRO -DHELI=YES -DGVARS=YES "${SRCDIR}" + make -j"${CORES}" ${FIRMARE_TARGET} + make -j"${CORES}" libsimulator + make -j"${CORES}" tests-radio +fi if [[ " X9LITE ALL " =~ \ ${FLAVOR}\ ]] ; then # OpenTX on X9LITE From 84f769dbe711f771d60408c5f303608c25a5e3f8 Mon Sep 17 00:00:00 2001 From: Risto Date: Mon, 5 Apr 2021 13:06:24 +0200 Subject: [PATCH 175/188] Fix building with TRACE_SD_CARD CMake option (#8391) --- radio/src/targets/common/arm/stm32/sdio_sd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/radio/src/targets/common/arm/stm32/sdio_sd.c b/radio/src/targets/common/arm/stm32/sdio_sd.c index f02916b44..83980ab64 100644 --- a/radio/src/targets/common/arm/stm32/sdio_sd.c +++ b/radio/src/targets/common/arm/stm32/sdio_sd.c @@ -1107,7 +1107,9 @@ OPTIMIZE("O0") SD_Error SD_WaitReadOperation(uint32_t timeout) delay_ms(1); timeout--; } +#ifndef BOOT TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_read, (TransferError << 8) + (DMAEndOfTransfer << 1) + TransferEnd); +#endif DMAEndOfTransfer = 0; @@ -1117,7 +1119,9 @@ OPTIMIZE("O0") SD_Error SD_WaitReadOperation(uint32_t timeout) delay_ms(1); timeout--; } +#ifndef BOOT TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_read, -1); +#endif if (StopCondition == 1) { errorstatus = SD_StopTransfer(); @@ -1332,8 +1336,10 @@ OPTIMIZE("O0") SD_Error SD_WaitWriteOperation(uint32_t timeout) delay_ms(1); timeout--; } +#ifndef BOOT TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_write, (TransferError << 8) + (DMAEndOfTransfer << 1) + TransferEnd); - +#endif + DMAEndOfTransfer = 0; timeout = 100; @@ -1342,7 +1348,9 @@ OPTIMIZE("O0") SD_Error SD_WaitWriteOperation(uint32_t timeout) delay_ms(1); timeout--; } +#ifndef BOOT TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_write, -1); +#endif if (StopCondition == 1) { errorstatus = SD_StopTransfer(); @@ -1474,7 +1482,9 @@ OPTIMIZE("O0") void SD_ProcessIRQ(void) SDIO_IT_TXFIFOHE | SDIO_IT_RXFIFOHF | SDIO_IT_TXUNDERR | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, DISABLE); +#ifndef BOOT TRACE_SD_CARD_EVENT((TransferError != SD_OK), sd_irq, TransferError); +#endif } /** From 6565cbd1df5eeb8169fd23dfa6768d998a46b640 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 13:09:21 +0200 Subject: [PATCH 176/188] Cosmetics --- radio/src/targets/common/arm/stm32/sdio_sd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/src/targets/common/arm/stm32/sdio_sd.c b/radio/src/targets/common/arm/stm32/sdio_sd.c index 83980ab64..f0f97b97f 100644 --- a/radio/src/targets/common/arm/stm32/sdio_sd.c +++ b/radio/src/targets/common/arm/stm32/sdio_sd.c @@ -1107,7 +1107,7 @@ OPTIMIZE("O0") SD_Error SD_WaitReadOperation(uint32_t timeout) delay_ms(1); timeout--; } -#ifndef BOOT +#if !defined(BOOT) TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_read, (TransferError << 8) + (DMAEndOfTransfer << 1) + TransferEnd); #endif @@ -1119,7 +1119,7 @@ OPTIMIZE("O0") SD_Error SD_WaitReadOperation(uint32_t timeout) delay_ms(1); timeout--; } -#ifndef BOOT +#if !defined(BOOT) TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_read, -1); #endif @@ -1336,7 +1336,7 @@ OPTIMIZE("O0") SD_Error SD_WaitWriteOperation(uint32_t timeout) delay_ms(1); timeout--; } -#ifndef BOOT +#if !defined(BOOT) TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_write, (TransferError << 8) + (DMAEndOfTransfer << 1) + TransferEnd); #endif @@ -1348,7 +1348,7 @@ OPTIMIZE("O0") SD_Error SD_WaitWriteOperation(uint32_t timeout) delay_ms(1); timeout--; } -#ifndef BOOT +#if !defined(BOOT) TRACE_SD_CARD_EVENT((timeout == 0), sd_wait_write, -1); #endif @@ -1482,7 +1482,7 @@ OPTIMIZE("O0") void SD_ProcessIRQ(void) SDIO_IT_TXFIFOHE | SDIO_IT_RXFIFOHF | SDIO_IT_TXUNDERR | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, DISABLE); -#ifndef BOOT +#if !defined(BOOT) TRACE_SD_CARD_EVENT((TransferError != SD_OK), sd_irq, TransferError); #endif } From cff8109d5a15f10ea7b2530d0eb3964db6b6109c Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 17:38:10 +0200 Subject: [PATCH 177/188] Cosmetics --- radio/src/mixer_scheduler.cpp | 6 +++--- radio/src/options.h | 1 - radio/src/pulses/pulses.cpp | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/src/mixer_scheduler.cpp b/radio/src/mixer_scheduler.cpp index 8132fe2f0..dcf95383b 100644 --- a/radio/src/mixer_scheduler.cpp +++ b/radio/src/mixer_scheduler.cpp @@ -42,7 +42,7 @@ uint16_t getMixerSchedulerPeriod() return mixerSchedules[INTERNAL_MODULE].period; } #endif -#if 1 //defined(HARDWARE_EXTERNAL_MODULE) +#if defined(HARDWARE_EXTERNAL_MODULE) if (mixerSchedules[EXTERNAL_MODULE].period) { return mixerSchedules[EXTERNAL_MODULE].period; } @@ -58,10 +58,10 @@ void mixerSchedulerInit() void mixerSchedulerSetPeriod(uint8_t moduleIdx, uint16_t periodUs) { - if ((periodUs > 0) && (periodUs < MIN_REFRESH_RATE)) { + if (periodUs > 0 && periodUs < MIN_REFRESH_RATE) { periodUs = MIN_REFRESH_RATE; } - else if ((periodUs > 0) && (periodUs > MAX_REFRESH_RATE)) { + else if (periodUs > 0 && periodUs > MAX_REFRESH_RATE) { periodUs = MAX_REFRESH_RATE; } diff --git a/radio/src/options.h b/radio/src/options.h index 8592897af..4f1a1a077 100644 --- a/radio/src/options.h +++ b/radio/src/options.h @@ -23,7 +23,6 @@ #define OPENTX_OPTIONS_H static const char * const options[] = { - "synced", #if defined(AUTOUPDATE) "autoupdate", #endif diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 810fd9378..128e11976 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -356,11 +356,12 @@ bool setupPulsesExternalModule(uint8_t protocol) setupPulsesSbus(); #if defined(PCBSKY9X) scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD); -#endif +#else // SBUS_PERIOD is not a constant! It can be set from UI mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD); return true; #endif +#endif #if defined(DSM2) case PROTOCOL_CHANNELS_DSM2_LP45: From 92fb19d89c2775a464bf0f0a71c0fbfc519796a2 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 17:40:55 +0200 Subject: [PATCH 178/188] Cosmetics --- radio/src/pulses/pxx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/pulses/pxx.h b/radio/src/pulses/pxx.h index b9536d723..e852de180 100644 --- a/radio/src/pulses/pxx.h +++ b/radio/src/pulses/pxx.h @@ -108,7 +108,7 @@ class PwmPxxBitTransport: public PulsesBuffer { void addTail() { // rest min value is 18000 - 200 * 48 = 8400 (4.2ms) - *(ptr - 1) = 60000;//+= rest; + *(ptr - 1) = 60000; } }; From 9ba3914ec464b600ef34381e3a950e99d53e9c25 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 17:51:13 +0200 Subject: [PATCH 179/188] Cosmetics --- radio/src/targets/taranis/extmodule_driver.cpp | 8 ++++---- radio/src/tasks.cpp | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/radio/src/targets/taranis/extmodule_driver.cpp b/radio/src/targets/taranis/extmodule_driver.cpp index b856cb309..512f16c5d 100644 --- a/radio/src/targets/taranis/extmodule_driver.cpp +++ b/radio/src/targets/taranis/extmodule_driver.cpp @@ -406,10 +406,10 @@ extern "C" void EXTMODULE_TIMER_DMA_STREAM_IRQHandler() DMA_ClearITPendingBit(EXTMODULE_TIMER_DMA_STREAM, EXTMODULE_TIMER_DMA_FLAG_TC); switch (moduleState[EXTERNAL_MODULE].protocol) { - case PROTOCOL_CHANNELS_PPM: - EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt - break; + case PROTOCOL_CHANNELS_PPM: + EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; } } diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index e71d8829a..a051cc509 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -164,7 +164,6 @@ TASK_FUNCTION(mixerTask) doMixerCalculations(); - // TODO: fix runMask #if defined(PCBSKY9X) sendSynchronousPulses(1 << EXTERNAL_MODULE); #else From 39ceda51ef76e724d5c8a3d47086d988a30601e1 Mon Sep 17 00:00:00 2001 From: Ruddy Date: Mon, 5 Apr 2021 12:02:24 -0400 Subject: [PATCH 180/188] Resolve two sets of repeated warnings when built with VS2019 (#8358) --- radio/src/gui/480x272/layouts/layout4+2.cpp | 10 +++++----- radio/src/opentx.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/radio/src/gui/480x272/layouts/layout4+2.cpp b/radio/src/gui/480x272/layouts/layout4+2.cpp index c9846ec04..d41a5f902 100644 --- a/radio/src/gui/480x272/layouts/layout4+2.cpp +++ b/radio/src/gui/480x272/layouts/layout4+2.cpp @@ -20,11 +20,11 @@ #include "opentx.h" -#define HAS_TOPBAR() (persistentData->options[0].boolValue == true) -#define HAS_FM() (persistentData->options[1].boolValue == true) -#define HAS_SLIDERS() (persistentData->options[2].boolValue == true) -#define HAS_TRIMS() (persistentData->options[3].boolValue == true) -#define IS_MIRRORED() (persistentData->options[4].boolValue == true) +#define HAS_TOPBAR() (OPTION_VALUE_BOOL(persistentData->options[0].boolValue) == true) +#define HAS_FM() (OPTION_VALUE_BOOL(persistentData->options[1].boolValue) == true) +#define HAS_SLIDERS() (OPTION_VALUE_BOOL(persistentData->options[2].boolValue) == true) +#define HAS_TRIMS() (OPTION_VALUE_BOOL(persistentData->options[3].boolValue) == true) +#define IS_MIRRORED() (OPTION_VALUE_BOOL(persistentData->options[4].boolValue) == true) const uint8_t LBM_LAYOUT_4P2[] = { #include "mask_layout4+2.lbm" diff --git a/radio/src/opentx.h b/radio/src/opentx.h index ddfcb9830..2a6409376 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -320,7 +320,7 @@ void memswap(void * a, void * b, uint8_t size); #define MASK_CFN_TYPE uint64_t // current max = 64 function switches #define MASK_FUNC_TYPE uint32_t // current max = 32 functions -typedef struct { +typedef struct _CustomFunctionsContext { MASK_FUNC_TYPE activeFunctions; MASK_CFN_TYPE activeSwitches; tmr10ms_t lastFunctionTime[MAX_SPECIAL_FUNCTIONS]; From 2dbdb325755c6ed59a1cc444eb1fbbd639a9661e Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 18:01:41 +0200 Subject: [PATCH 181/188] Cosmetics --- radio/src/targets/taranis/intmodule_pulses_driver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/radio/src/targets/taranis/intmodule_pulses_driver.cpp b/radio/src/targets/taranis/intmodule_pulses_driver.cpp index 5de2daa1b..9afacfda8 100644 --- a/radio/src/targets/taranis/intmodule_pulses_driver.cpp +++ b/radio/src/targets/taranis/intmodule_pulses_driver.cpp @@ -159,10 +159,10 @@ extern "C" void INTMODULE_DMA_STREAM_IRQHandler() DMA_ClearITPendingBit(INTMODULE_DMA_STREAM, INTMODULE_DMA_FLAG_TC); switch (moduleState[INTERNAL_MODULE].protocol) { - case PROTOCOL_CHANNELS_PPM: - INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag - INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt - break; + case PROTOCOL_CHANNELS_PPM: + INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // Clear flag + INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt + break; } } From 62c74049d018d8a96d87578e4b4073649973e2f9 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 18:03:24 +0200 Subject: [PATCH 182/188] Cosmetics --- radio/src/opentx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 2a6409376..e0e666b3c 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -320,7 +320,7 @@ void memswap(void * a, void * b, uint8_t size); #define MASK_CFN_TYPE uint64_t // current max = 64 function switches #define MASK_FUNC_TYPE uint32_t // current max = 32 functions -typedef struct _CustomFunctionsContext { +struct CustomFunctionContext { MASK_FUNC_TYPE activeFunctions; MASK_CFN_TYPE activeSwitches; tmr10ms_t lastFunctionTime[MAX_SPECIAL_FUNCTIONS]; From e0f65a0f0556bd9cdbd549fb3fcc80045adc93d6 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 18:56:00 +0200 Subject: [PATCH 183/188] Compile fix --- radio/src/opentx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index e0e666b3c..3d5a4868e 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -320,7 +320,7 @@ void memswap(void * a, void * b, uint8_t size); #define MASK_CFN_TYPE uint64_t // current max = 64 function switches #define MASK_FUNC_TYPE uint32_t // current max = 32 functions -struct CustomFunctionContext { +struct CustomFunctionsContext { MASK_FUNC_TYPE activeFunctions; MASK_CFN_TYPE activeSwitches; tmr10ms_t lastFunctionTime[MAX_SPECIAL_FUNCTIONS]; @@ -334,7 +334,7 @@ struct CustomFunctionContext { { memclear(this, sizeof(*this)); } -} CustomFunctionsContext; +}; #include "strhelpers.h" #include "gui.h" From 2c608ad719c165b9003b3626a56d1b51ab6aa218 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 5 Apr 2021 19:13:11 +0200 Subject: [PATCH 184/188] Compile fix --- radio/src/gui/480x272/layouts/layout4+2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/src/gui/480x272/layouts/layout4+2.cpp b/radio/src/gui/480x272/layouts/layout4+2.cpp index d41a5f902..c9846ec04 100644 --- a/radio/src/gui/480x272/layouts/layout4+2.cpp +++ b/radio/src/gui/480x272/layouts/layout4+2.cpp @@ -20,11 +20,11 @@ #include "opentx.h" -#define HAS_TOPBAR() (OPTION_VALUE_BOOL(persistentData->options[0].boolValue) == true) -#define HAS_FM() (OPTION_VALUE_BOOL(persistentData->options[1].boolValue) == true) -#define HAS_SLIDERS() (OPTION_VALUE_BOOL(persistentData->options[2].boolValue) == true) -#define HAS_TRIMS() (OPTION_VALUE_BOOL(persistentData->options[3].boolValue) == true) -#define IS_MIRRORED() (OPTION_VALUE_BOOL(persistentData->options[4].boolValue) == true) +#define HAS_TOPBAR() (persistentData->options[0].boolValue == true) +#define HAS_FM() (persistentData->options[1].boolValue == true) +#define HAS_SLIDERS() (persistentData->options[2].boolValue == true) +#define HAS_TRIMS() (persistentData->options[3].boolValue == true) +#define IS_MIRRORED() (persistentData->options[4].boolValue == true) const uint8_t LBM_LAYOUT_4P2[] = { #include "mask_layout4+2.lbm" From 2537cc878acfb6c2520df9b211cf9dd6d4db3b61 Mon Sep 17 00:00:00 2001 From: elecpower Date: Mon, 5 Apr 2021 22:59:32 +1000 Subject: [PATCH 185/188] Keep pre-existing inactive logical switches --- companion/src/firmwares/modeldata.cpp | 40 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 85a7f0473..432a375f7 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -653,29 +653,43 @@ int ModelData::updateReference() LogicalSwitchData *lsd = &logicalSw[i]; if (!lsd->isEmpty()) { bool clearlsd = false; + int oldval1; + int oldval2; CSFunctionFamily family = lsd->getFunctionFamily(); switch(family) { case LS_FAMILY_VOFS: - updateSourceIntRef(lsd->val1); - if (lsd->val1 == 0) - clearlsd = true; + if (lsd->val1 != 0) { + updateSourceIntRef(lsd->val1); + if (lsd->val1 == 0) + clearlsd = true; + } break; case LS_FAMILY_STICKY: case LS_FAMILY_VBOOL: - updateSwitchIntRef(lsd->val1); - updateSwitchIntRef(lsd->val2); - if (lsd->val1 == 0 && lsd->val2 == 0) + oldval1 = lsd->val1; + oldval2 = lsd->val2; + if (lsd->val1 != 0) + updateSwitchIntRef(lsd->val1); + if (lsd->val2 != 0) + updateSwitchIntRef(lsd->val2); + if (lsd->val1 == 0 && lsd->val2 == 0 && ((lsd->val1 != oldval1 && oldval2 == 0) || (lsd->val2 != oldval2 && oldval1 == 0))) clearlsd = true; break; case LS_FAMILY_EDGE: - updateSwitchIntRef(lsd->val1); - if (lsd->val1 == 0) - clearlsd = true; + if (lsd->val1 != 0) { + updateSwitchIntRef(lsd->val1); + if (lsd->val1 == 0) + clearlsd = true; + } break; case LS_FAMILY_VCOMP: - updateSourceIntRef(lsd->val1); - updateSourceIntRef(lsd->val2); - if (lsd->val1 == 0 && lsd->val2 == 0) + oldval1 = lsd->val1; + oldval2 = lsd->val2; + if (lsd->val1 != 0) + updateSourceIntRef(lsd->val1); + if (lsd->val2 != 0) + updateSourceIntRef(lsd->val2); + if (lsd->val1 == 0 && lsd->val2 == 0 && ((lsd->val1 != oldval1 && oldval2 == 0) || (lsd->val2 != oldval2 && oldval1 == 0))) clearlsd = true; break; default: @@ -685,7 +699,7 @@ int ModelData::updateReference() lsd->clear(); appendUpdateReferenceParams(REF_UPD_TYPE_LOGICAL_SWITCH, REF_UPD_ACT_CLEAR, i); } - else { + else if (lsd->andsw != 0) { updateSwitchIntRef(lsd->andsw); } } From b6ec55769c2488bc298250e72252d2b6f5a80d26 Mon Sep 17 00:00:00 2001 From: elecpower Date: Mon, 5 Apr 2021 23:28:13 +1000 Subject: [PATCH 186/188] Fix upd ref type so clears refs equal to the one selected for deletion --- companion/src/firmwares/modeldata.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 432a375f7..c90f90bd2 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -830,6 +830,7 @@ void ModelData::updateTypeIndexRef(R & curRef, const T type, const int idxAdj, c newRef.index = abs(curRef.index); div_t idx = div(newRef.index, updRefInfo.occurences); + div_t newidx; switch (updRefInfo.action) { @@ -847,9 +848,10 @@ void ModelData::updateTypeIndexRef(R & curRef, const T type, const int idxAdj, c if (idx.quot < (updRefInfo.index1 + idxAdj)) return; - newRef.index += updRefInfo.shift; + newRef.index = ((idx.quot + updRefInfo.shift) * updRefInfo.occurences) + idx.rem; + newidx = div(newRef.index, updRefInfo.occurences); - if (idx.quot < (updRefInfo.index1 + idxAdj) || idx.quot > (updRefInfo.maxindex + idxAdj)) { + if (newidx.quot < (updRefInfo.index1 + idxAdj) || newidx.quot > (updRefInfo.maxindex + idxAdj)) { if (defClear) newRef.clear(); else { From 066b4eb7d7d46c2e4373d893cde406b12485dd00 Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 6 Apr 2021 05:48:19 +1000 Subject: [PATCH 187/188] For inputs and mixes when updating refs set 'new' FMs to safer option of inactive --- companion/src/firmwares/modeldata.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index c90f90bd2..b24cb4975 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -1097,7 +1097,7 @@ void ModelData::updateFlightModeFlags(unsigned int & curRef) switch (updRefInfo.action) { case REF_UPD_ACT_CLEAR: - flag[updRefInfo.index1] = false; + flag[updRefInfo.index1] = true; break; case REF_UPD_ACT_SHIFT: if(updRefInfo.shift < 0) { @@ -1105,7 +1105,7 @@ void ModelData::updateFlightModeFlags(unsigned int & curRef) if (i - updRefInfo.shift <= updRefInfo.maxindex) flag[i] = flag[i - updRefInfo.shift]; else - flag[i] = false; + flag[i] = true; } } else { @@ -1113,7 +1113,7 @@ void ModelData::updateFlightModeFlags(unsigned int & curRef) if (i - updRefInfo.shift >= updRefInfo.index1) flag[i] = flag[i - updRefInfo.shift]; else - flag[i] = false; + flag[i] = true; } } break; From 43655faee250a12fbd52e3f114728263b32d0d96 Mon Sep 17 00:00:00 2001 From: elecpower Date: Tue, 6 Apr 2021 06:34:11 +1000 Subject: [PATCH 188/188] Check AND switch before clearing LS --- companion/src/firmwares/modeldata.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index b24cb4975..679e90f5f 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -695,13 +695,14 @@ int ModelData::updateReference() default: break; } - if (clearlsd) { + + if (lsd->andsw != 0) + updateSwitchIntRef(lsd->andsw); + + if (clearlsd && lsd->andsw == 0) { lsd->clear(); appendUpdateReferenceParams(REF_UPD_TYPE_LOGICAL_SWITCH, REF_UPD_ACT_CLEAR, i); } - else if (lsd->andsw != 0) { - updateSwitchIntRef(lsd->andsw); - } } } //s1.report("Logical Switches");