chore: New module/serial API (#3055)
* WiP: new module interface * WiP: softserial timer DMA * WiP: setup() and send() in one step and remove methods specific to internal or external module * fixes and extra port config * horus targets * module ports have moved * T8 support (only internal module) * fix nv14 * stupid GCC.... * disable BT * remove nv14 telem driver * remove old aux serial driver * Move module buffers out of pulses.h * Soft serial fixes and PXX1 support * Fixed PPM module output * Fixed CLI * compilation fixes * Ported bluetooth and flysky gimbal to new serial driver * Re-enable soft-serial RX * fixes and cleanup * nv14 fixes * Fix flysky gimbals * Ghost module * 16 bytes of RAM * Remove getByte from module API * Ghost cleanup * fix: _half_duplex_input() must be called after usart init * WiP * more cleanup * Remove board specific settings from PXX1 / PXX2 drivers * A bit of PXX2 header cleanup * Add support for OVER8 and ONEBIT * Add some support for inverters (NV14 / EL18) * Support NV14 power fixes in generic board * Fix polarity handling * Fix RX DMA * Fix mixer not running * Add soft-serial polarity control * Quick fix for telemetry polling while module port is changed * Fix bootloader DEBUG * Fix MPM telemetry * Fix pulse start * DSM2 soft-serial fallback * DSMP async module restart * Fix CRSF LUA upstream * Remove global variable telemetryProtocol * Use HAL/LL constants * Fix various issue with AFHDS3 and NV14/EL18 internal module * Fixed S.PORT unit tests * fix: update widx after writing at current index * fix: init error condition * Fix: possible infinite loop in _find_port() * Add support for bidir S.PORT init * Add support for "getLastByte" in HW serial driver * PXX1: Add support for S.PORT based on IDLE callback * Fix rebase error * Fix softserial _rx_fifo_push() * Add softserial support for waitForTxCompleted() * Fix MPM flashing (internal / external) * Fixed external MPM * Activate RX DMA on internal module Seems to work with serial passthrough without issues, at least on the L3R PRO. * Fix softserial DMA on stdlcd F4 targets * Add softserial support for 32bit timers (mostly TIM2) * More precise soft-serial * Fix MPM update using inverters & HW uart * Raise S.PORT DMA/USART IRQ prio to achieve faster switching to input * Remove useless delays * Fix flashing external ELRS module * Added a retry mechanism for FrSky S.PORT update * Remove useless enableRx() * External FrSky modules are all flashed via S.PORT * Remove power management unit update This was only used on the first batch of X-lite.
This commit is contained in:
@@ -440,89 +440,16 @@ void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value,
|
||||
else if (telemetrySensor.unit == UNIT_GPS) {
|
||||
drawGPSSensorValue(x, y, telemetryItem, flags);
|
||||
}
|
||||
else if (telemetrySensor.unit == UNIT_BITFIELD) {
|
||||
if (IS_FRSKY_SPORT_PROTOCOL()) {
|
||||
if (telemetrySensor.id >= RBOX_STATE_FIRST_ID && telemetrySensor.id <= RBOX_STATE_LAST_ID) {
|
||||
if (telemetrySensor.subId == 0) {
|
||||
if (value == 0) {
|
||||
lcdDrawText(x, y, "OK", flags);
|
||||
}
|
||||
else {
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
if (value & (1u << i)) {
|
||||
char s[] = "CH__ KO";
|
||||
strAppendUnsigned(&s[2], i + 1, 2);
|
||||
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (value == 0) {
|
||||
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, "Rx OK", flags & ~DBLSIZE);
|
||||
}
|
||||
else {
|
||||
static const char * const RXS_STATUS[] = {
|
||||
"Rx1 Ovl",
|
||||
"Rx2 Ovl",
|
||||
"SBUS Ovl",
|
||||
"Rx1 FS",
|
||||
"Rx1 LF",
|
||||
"Rx2 FS",
|
||||
"Rx2 LF",
|
||||
"Rx1 Lost",
|
||||
"Rx2 Lost",
|
||||
"Rx1 NS",
|
||||
"Rx2 NS",
|
||||
"Rx3 FS",
|
||||
"Rx3 LF",
|
||||
"Rx3 Lost",
|
||||
"Rx3 NS"
|
||||
};
|
||||
for (uint8_t i = 0; i < DIM(RXS_STATUS); i++) {
|
||||
if (value & (1u << i)) {
|
||||
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, RXS_STATUS[i], flags & ~DBLSIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (telemetrySensor.id >= RB3040_OUTPUT_FIRST_ID && telemetrySensor.id <= RB3040_OUTPUT_LAST_ID) {
|
||||
if (telemetrySensor.subId == 0) {
|
||||
if (value == 0) {
|
||||
lcdDrawText(x, y, "OK", flags);
|
||||
}
|
||||
else {
|
||||
for (uint8_t i = 0; i < 9; i++) {
|
||||
if (value & (1u << i)) {
|
||||
if (i < 8) {
|
||||
char s[] = "CH__ KO";
|
||||
strAppendUnsigned(&s[2], i + 17, 2);
|
||||
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
char s[] = "S.P Ovl";
|
||||
lcdDrawText(x, flags & DBLSIZE ? y + 1 : y, s, flags & ~DBLSIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (telemetrySensor.unit == UNIT_TEXT) {
|
||||
lcdDrawSizedText(x, flags & DBLSIZE ? y + 1 : y, telemetryItem.text, sizeof(telemetryItem.text), flags & ~DBLSIZE);
|
||||
}
|
||||
else {
|
||||
lcdDrawSizedText(x, flags & DBLSIZE ? y + 1 : y, telemetryItem.text,
|
||||
sizeof(telemetryItem.text), flags & ~DBLSIZE);
|
||||
} else {
|
||||
if (telemetrySensor.prec > 0) {
|
||||
flags |= (telemetrySensor.prec == 1 ? PREC1 : PREC2);
|
||||
}
|
||||
drawValueWithUnit(x, y, value, telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit, flags);
|
||||
drawValueWithUnit(x, y, value,
|
||||
telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
@@ -51,7 +52,7 @@ bool reachExposLimit()
|
||||
int8_t s_currCh;
|
||||
void insertExpo(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
ExpoData * expo = expoAddress(idx);
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
memclear(expo, sizeof(ExpoData));
|
||||
@@ -65,16 +66,16 @@ void insertExpo(uint8_t idx)
|
||||
expo->mode = 3; // pos+neg
|
||||
expo->chn = s_currCh - 1;
|
||||
expo->weight = 100;
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void copyExpo(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
ExpoData * expo = expoAddress(idx);
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
@@ -112,9 +113,9 @@ bool swapExpos(uint8_t & idx, uint8_t up)
|
||||
return true;
|
||||
}
|
||||
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
memswap(x, y, sizeof(ExpoData));
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
|
||||
idx = tgt_idx;
|
||||
return true;
|
||||
@@ -122,7 +123,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
|
||||
|
||||
void deleteExpo(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
ExpoData * expo = expoAddress(idx);
|
||||
int input = expo->chn;
|
||||
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
@@ -130,7 +131,7 @@ void deleteExpo(uint8_t idx)
|
||||
if (!isInputAvailable(input)) {
|
||||
memclear(&g_model.inputNames[input], LEN_INPUT_NAME);
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
|
||||
#define _STR_MAX(x) "/" #x
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
@@ -49,17 +50,17 @@ bool reachMixesLimit()
|
||||
|
||||
void deleteMix(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
MixData * mix = mixAddress(idx);
|
||||
memmove(mix, mix+1, (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void insertMix(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
MixData * mix = mixAddress(idx);
|
||||
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
memclear(mix, sizeof(MixData));
|
||||
@@ -72,16 +73,16 @@ void insertMix(uint8_t idx)
|
||||
}
|
||||
}
|
||||
mix->weight = 100;
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void copyMix(uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
MixData * mix = mixAddress(idx);
|
||||
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
@@ -120,9 +121,9 @@ bool swapMixes(uint8_t & idx, uint8_t up)
|
||||
return true;
|
||||
}
|
||||
|
||||
pauseMixerCalculations();
|
||||
mixerTaskStop();
|
||||
memswap(x, y, sizeof(MixData));
|
||||
resumeMixerCalculations();
|
||||
mixerTaskStart();
|
||||
|
||||
idx = tgt_idx;
|
||||
return true;
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(GHOST)
|
||||
#include "telemetry/ghost.h"
|
||||
#endif
|
||||
#if defined(GHOST) && defined(HARDWARE_EXTERNAL_MODULE)
|
||||
|
||||
#include "telemetry/ghost.h"
|
||||
|
||||
void menuGhostModuleConfig(event_t event)
|
||||
{
|
||||
@@ -126,3 +126,5 @@ void menuGhostModuleConfig(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,12 +21,15 @@
|
||||
|
||||
#include <opentx.h>
|
||||
#include "hal/adc_driver.h"
|
||||
#include "aux_serial_driver.h"
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
#include "telemetry/crossfire.h"
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#include "bluetooth_driver.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
enum {
|
||||
ITEM_RADIO_HARDWARE_LABEL_STICKS,
|
||||
@@ -532,7 +535,7 @@ void menuRadioHardware(event_t event)
|
||||
case ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE: {
|
||||
g_eeGeneral.internalModule =
|
||||
editChoice(HW_SETTINGS_COLUMN2, y, STR_TYPE,
|
||||
STR_INTERNAL_MODULE_PROTOCOLS,
|
||||
STR_MODULE_PROTOCOLS,
|
||||
g_eeGeneral.internalModule, MODULE_TYPE_NONE,
|
||||
MODULE_TYPE_MAX, attr, event, isInternalModuleSupported);
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type !=
|
||||
@@ -663,14 +666,15 @@ void menuRadioHardware(event_t event)
|
||||
lcdDrawText(lcdNextPos, y, "---");
|
||||
break;
|
||||
|
||||
#if defined(SPORT_UPDATE_PWR_GPIO)
|
||||
case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
|
||||
g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
SPORT_UPDATE_POWER_INIT();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
// TODO: this is board specific, do something about it!
|
||||
// #if defined(SPORT_UPDATE_PWR_GPIO)
|
||||
// case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
|
||||
// g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
|
||||
// if (attr && checkIncDec_Ret) {
|
||||
// SPORT_UPDATE_POWER_INIT();
|
||||
// }
|
||||
// break;
|
||||
// #endif
|
||||
|
||||
case ITEM_RADIO_HARDWARE_DEBUG:
|
||||
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
||||
|
||||
@@ -92,6 +92,9 @@ void onSdFormatConfirm(const char * result)
|
||||
}
|
||||
|
||||
#if defined(PXX2)
|
||||
|
||||
#include "pulses/pxx2_ota.h"
|
||||
|
||||
void onUpdateConfirmation(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
@@ -108,26 +111,19 @@ void onUpdateStateChanged()
|
||||
{
|
||||
if (reusableBuffer.sdManager.otaUpdateInformation.step == BIND_INFO_REQUEST) {
|
||||
uint8_t modelId = reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.modelID;
|
||||
if (modelId > 0 && modelId < DIM(PXX2ReceiversNames)) {
|
||||
if (isPXX2ReceiverOptionAvailable(modelId, RECEIVER_OPTION_OTA)) {
|
||||
POPUP_CONFIRMATION(getPXX2ReceiverName(modelId), onUpdateConfirmation);
|
||||
char *tmp = strAppend(reusableBuffer.sdManager.otaReceiverVersion, TR_CURRENT_VERSION);
|
||||
tmp = strAppendUnsigned(tmp, 1 + reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.major);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.minor);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.revision);
|
||||
SET_WARNING_INFO(reusableBuffer.sdManager.otaReceiverVersion, tmp - reusableBuffer.sdManager.otaReceiverVersion, 0);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_OTA_UPDATE_ERROR);
|
||||
SET_WARNING_INFO(STR_UNSUPPORTED_RX, sizeof(TR_UNSUPPORTED_RX) - 1, 0);
|
||||
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
if (isPXX2ReceiverOptionAvailable(modelId, RECEIVER_OPTION_OTA)) {
|
||||
POPUP_CONFIRMATION(getPXX2ReceiverName(modelId), onUpdateConfirmation);
|
||||
char *tmp = strAppend(reusableBuffer.sdManager.otaReceiverVersion, TR_CURRENT_VERSION);
|
||||
tmp = strAppendUnsigned(tmp, 1 + reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.major);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.minor);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, reusableBuffer.sdManager.otaUpdateInformation.receiverInformation.swVersion.revision);
|
||||
SET_WARNING_INFO(reusableBuffer.sdManager.otaReceiverVersion, tmp - reusableBuffer.sdManager.otaReceiverVersion, 0);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_OTA_UPDATE_ERROR);
|
||||
SET_WARNING_INFO(STR_UNKNOWN_RX, sizeof(TR_UNKNOWN_RX) - 1, 0);
|
||||
SET_WARNING_INFO(STR_UNSUPPORTED_RX, sizeof(TR_UNSUPPORTED_RX) - 1, 0);
|
||||
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
}
|
||||
@@ -220,12 +216,14 @@ void onSdManagerMenu(const char * result)
|
||||
FrskyDeviceFirmwareUpdate device(INTERNAL_MODULE);
|
||||
device.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
else if (result == STR_FLASH_EXTERNAL_MODULE) {
|
||||
// needed on X-Lite (as the R9M needs 2S while the external device flashing port only provides 5V)
|
||||
getSelectionFullPath(lfn);
|
||||
FrskyDeviceFirmwareUpdate device(EXTERNAL_MODULE);
|
||||
device.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_FLASH_EXTERNAL_DEVICE) {
|
||||
getSelectionFullPath(lfn);
|
||||
FrskyDeviceFirmwareUpdate device(SPORT_MODULE);
|
||||
@@ -239,6 +237,7 @@ void onSdManagerMenu(const char * result)
|
||||
device.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#endif
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
else if (result == STR_FLASH_EXTERNAL_MULTI) {
|
||||
getSelectionFullPath(lfn);
|
||||
MultiDeviceFirmwareUpdate device(EXTERNAL_MODULE, MULTI_TYPE_MULTIMODULE);
|
||||
@@ -250,20 +249,14 @@ void onSdManagerMenu(const char * result)
|
||||
device.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if defined(BLUETOOTH)
|
||||
else if (result == STR_FLASH_BLUETOOTH_MODULE) {
|
||||
getSelectionFullPath(lfn);
|
||||
bluetooth.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#endif
|
||||
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
|
||||
else if (result == STR_FLASH_POWER_MANAGEMENT_UNIT) {
|
||||
getSelectionFullPath(lfn);
|
||||
FrskyChipFirmwareUpdate device;
|
||||
device.flashFirmware(lfn, drawProgressScreen);
|
||||
}
|
||||
#endif
|
||||
#if defined(PXX2)
|
||||
#if defined(PXX2) && defined(HARDWARE_EXTERNAL_MODULE)
|
||||
else if (result == STR_FLASH_RECEIVER_BY_INTERNAL_MODULE_OTA || result == STR_FLASH_RECEIVER_BY_EXTERNAL_MODULE_OTA) {
|
||||
memclear(&reusableBuffer.sdManager.otaUpdateInformation, sizeof(OtaUpdateInformation));
|
||||
getSelectionFullPath(reusableBuffer.sdManager.otaUpdateInformation.filename);
|
||||
@@ -432,29 +425,38 @@ void menuRadioSdManager(event_t _event)
|
||||
}
|
||||
}
|
||||
else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
||||
if (HAS_SPORT_UPDATE_CONNECTOR())
|
||||
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||
if (mod_desc && mod_desc->set_pwr)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||
#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
if (g_eeGeneral.internalModule == MODULE_TYPE_XJT_PXX1 ||
|
||||
g_eeGeneral.internalModule == MODULE_TYPE_ISRM_PXX2)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||
}
|
||||
else if (!READ_ONLY() && !strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
|
||||
FrSkyFirmwareInformation information;
|
||||
if (readFrSkyFirmwareInformation(line, information) == nullptr) {
|
||||
#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE)
|
||||
|
||||
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE &&
|
||||
(g_eeGeneral.internalModule == MODULE_TYPE_XJT_PXX1 ||
|
||||
g_eeGeneral.internalModule == MODULE_TYPE_ISRM_PXX2))
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
if (information.productFamily == FIRMWARE_FAMILY_EXTERNAL_MODULE)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER || information.productFamily == FIRMWARE_FAMILY_SENSOR) {
|
||||
if (HAS_SPORT_UPDATE_CONNECTOR())
|
||||
|
||||
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER ||
|
||||
information.productFamily == FIRMWARE_FAMILY_SENSOR) {
|
||||
|
||||
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||
if (mod_desc && mod_desc->set_pwr)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||
else
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||
}
|
||||
#if defined(PXX2)
|
||||
#if defined(PXX2) && defined(HARDWARE_EXTERNAL_MODULE)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER) {
|
||||
if (isReceiverOTAEnabledFromModule(INTERNAL_MODULE, information.productId))
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_RECEIVER_BY_INTERNAL_MODULE_OTA);
|
||||
@@ -469,10 +471,6 @@ void menuRadioSdManager(event_t _event)
|
||||
#if defined(BLUETOOTH)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_BLUETOOTH_CHIP)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_BLUETOOTH_MODULE);
|
||||
#endif
|
||||
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_POWER_MANAGEMENT_UNIT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ void menuRadioSpectrumAnalyser(event_t event)
|
||||
if (menuEvent) {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
|
||||
lcdRefresh();
|
||||
#if defined(PXX2)
|
||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
#endif
|
||||
/* wait 1s to resume normal operation before leaving */
|
||||
watchdogSuspend(500 /*5s*/);
|
||||
RTOS_WAIT_MS(1000);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "opentx.h"
|
||||
#include "hal/module_port.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
@@ -104,7 +105,7 @@ void menuRadioTools(event_t event)
|
||||
memclear(&reusableBuffer.radioTools, sizeof(reusableBuffer.radioTools));
|
||||
#if defined(PXX2)
|
||||
for (uint8_t module = 0; module < NUM_MODULES; module++) {
|
||||
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? IS_INTERNAL_MODULE_ON() : IS_EXTERNAL_MODULE_ON())) {
|
||||
if (isModulePXX2(module) && (module == INTERNAL_MODULE ? modulePortPowered(INTERNAL_MODULE) : modulePortPowered(EXTERNAL_MODULE))) {
|
||||
moduleState[module].readModuleInformation(&reusableBuffer.radioTools.modules[module], PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
}
|
||||
}
|
||||
@@ -161,12 +162,25 @@ void menuRadioTools(event_t event)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE) && defined(MULTIMODULE)
|
||||
if (g_eeGeneral.internalModule == MODULE_TYPE_MULTIMODULE)
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2) || defined(MULTIMODULE)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE))
|
||||
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
|
||||
#if (defined(PXX2) || defined(MULTIMODULE))
|
||||
bool has_spectrum_analyser = false;
|
||||
#if defined(PXX2)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.radioTools.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
|
||||
has_spectrum_analyser = true;
|
||||
#endif
|
||||
#if defined(MULTIMODULE)
|
||||
if (isModuleMultimodule(EXTERNAL_MODULE))
|
||||
has_spectrum_analyser = true;
|
||||
#endif
|
||||
if (has_spectrum_analyser)
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_EXT, menuRadioSpectrumAnalyser, EXTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2)
|
||||
@@ -177,6 +191,8 @@ void menuRadioTools(event_t event)
|
||||
#if defined(GHOST)
|
||||
if (isModuleGhost(EXTERNAL_MODULE))
|
||||
addRadioModuleTool(index++, "Ghost Menu", menuGhostModuleConfig, EXTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (index == 0) {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
#include "options.h"
|
||||
#include "hal/module_port.h"
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
#include "mixer_scheduler.h"
|
||||
#endif
|
||||
@@ -95,8 +97,9 @@ void drawPXX2FullVersion(coord_t x, coord_t y, PXX2Version hwVersion, PXX2Versio
|
||||
void menuRadioModulesVersion(event_t event)
|
||||
{
|
||||
if (menuEvent) {
|
||||
moduleState[INTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
moduleState[EXTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
for (uint8_t i = 0; i < MAX_MODULES; i++) {
|
||||
moduleState[i].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,13 +110,18 @@ void menuRadioModulesVersion(event_t event)
|
||||
}
|
||||
|
||||
if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
|
||||
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
if (isModulePXX2(INTERNAL_MODULE) && modulePortPowered(INTERNAL_MODULE)) {
|
||||
moduleState[INTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
if (isModulePXX2(EXTERNAL_MODULE) && modulePortPowered(EXTERNAL_MODULE)) {
|
||||
moduleState[EXTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms() + 1000 /* 10s*/;
|
||||
}
|
||||
@@ -123,18 +131,30 @@ void menuRadioModulesVersion(event_t event)
|
||||
for (uint8_t module=0; module<NUM_MODULES; module++) {
|
||||
// Label
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
if (module == INTERNAL_MODULE)
|
||||
lcdDrawTextAlignedLeft(y, STR_INTERNAL_MODULE);
|
||||
else if (module == EXTERNAL_MODULE)
|
||||
#endif
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
if (module == EXTERNAL_MODULE)
|
||||
lcdDrawTextAlignedLeft(y, STR_EXTERNAL_MODULE);
|
||||
#endif
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Module model
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_MODULE);
|
||||
if ((module == INTERNAL_MODULE && !IS_INTERNAL_MODULE_ON()) ||
|
||||
(module == EXTERNAL_MODULE && !IS_EXTERNAL_MODULE_ON())) {
|
||||
bool module_off = true;
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
if (module == INTERNAL_MODULE && modulePortPowered(INTERNAL_MODULE))
|
||||
module_off = false;
|
||||
#endif
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
if (module == EXTERNAL_MODULE && modulePortPowered(EXTERNAL_MODULE))
|
||||
module_off = false;
|
||||
#endif
|
||||
if (module_off) {
|
||||
lcdDrawText(COLUMN2_X, y, STR_OFF);
|
||||
y += FH;
|
||||
continue;
|
||||
@@ -152,7 +172,7 @@ void menuRadioModulesVersion(event_t event)
|
||||
if (isModuleCrossfire(module)) {
|
||||
char statusText[64] = "";
|
||||
sprintf(statusText, "%d Hz %zu Err",
|
||||
1000000 / getMixerSchedulerPeriod(), (size_t)telemetryErrors);
|
||||
1000000 / getMixerSchedulerPeriod(), (size_t)0/*telemetryErrors*/);
|
||||
lcdDrawText(COLUMN2_X, y, statusText);
|
||||
y += FH;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user