From c0e6f2a7f9257cff740310eac7a2017acc7a7890 Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 10 Feb 2022 09:55:44 +0100 Subject: [PATCH] Compilation fixes --- radio/src/gui/128x64/model_setup.cpp | 2 +- radio/src/gui/colorlcd/radio_hardware.cpp | 15 --------- .../src/gui/common/stdlcd/radio_hardware.cpp | 15 +++++---- radio/src/pulses/pulses.cpp | 33 +++++++++++++++++++ radio/src/pulses/pulses.h | 1 + 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 400d76659..d014f4472 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1060,7 +1060,7 @@ void menuModelSetup(event_t event) } break; -#if defined(HARDWARE_INTERNAL_MODULE) && (defined(CROSSFIRE) || defined(GHOST)) +#if defined(HARDWARE_EXTERNAL_MODULE) && (defined(CROSSFIRE) || defined(GHOST)) case ITEM_MODEL_SETUP_EXTERNAL_MODULE_BAUDRATE: { ModuleData & moduleData = g_model.moduleData[moduleIdx]; lcdDrawText(INDENT_WIDTH, y, STR_BAUDRATE); diff --git a/radio/src/gui/colorlcd/radio_hardware.cpp b/radio/src/gui/colorlcd/radio_hardware.cpp index 939e21459..d2802a072 100644 --- a/radio/src/gui/colorlcd/radio_hardware.cpp +++ b/radio/src/gui/colorlcd/radio_hardware.cpp @@ -247,21 +247,6 @@ class SerialConfigWindow : public FormGroup } }; -void restartExternalModule() -{ - if (!IS_EXTERNAL_MODULE_ON()) { - return; - } - pauseMixerCalculations(); - pausePulses(); - EXTERNAL_MODULE_OFF(); - RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate - telemetryProtocol = 255; // force telemetry port + module reinitialization - EXTERNAL_MODULE_ON(); - resumePulses(); - resumeMixerCalculations(); -} - class InternalModuleWindow : public FormGroup { public: InternalModuleWindow(FormWindow *parent, const rect_t &rect) : diff --git a/radio/src/gui/common/stdlcd/radio_hardware.cpp b/radio/src/gui/common/stdlcd/radio_hardware.cpp index aad619f2b..59bc3f6c7 100644 --- a/radio/src/gui/common/stdlcd/radio_hardware.cpp +++ b/radio/src/gui/common/stdlcd/radio_hardware.cpp @@ -101,9 +101,9 @@ enum { ITEM_RADIO_HARDWARE_INTERNAL_MODULE_TYPE, ITEM_RADIO_HARDWARE_INTERNAL_MODULE_BAUDRATE, #endif - +#if defined(HARDWARE_EXTERNAL_MODULE) ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE, - +#endif #if defined(BLUETOOTH) ITEM_RADIO_HARDWARE_BLUETOOTH_MODE, ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE, @@ -233,8 +233,11 @@ enum { #else #define INTERNAL_MODULE_ROWS #endif - +#if defined(HARDWARE_EXTERNAL_MODULE) #define SERIAL_SAMPLE_MODE_ROWS 0, +#else +#define SERIAL_SAMPLE_MODE_ROWS +#endif #if defined(AUX_SERIAL) || defined(USB_SERIAL) static uint8_t _dispSerialPort(uint8_t port_nr) @@ -536,19 +539,19 @@ void menuRadioHardware(event_t event) if (attr) { g_eeGeneral.InternalModuleBaudrate = CROSSFIRE_INDEX_TO_STORE(checkIncDecModel(event, CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.InternalModuleBaudrate), 0, CROSSFIRE_MAX_INTERNAL_BAUDRATE)); if (checkIncDec_Ret) { - restartExternalModule(); + restartInternalModule(); } } break; #endif - +#if defined(HARDWARE_EXTERNAL_MODULE) case ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE: g_eeGeneral.uartSampleMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_SAMPLE_MODE, STR_SAMPLE_MODES, g_eeGeneral.uartSampleMode, 0, UART_SAMPLE_MODE_MAX, attr, event); if (attr && checkIncDec_Ret) { restartExternalModule(); } break; - +#endif #if defined(BLUETOOTH) case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE: lcdDrawTextAlignedLeft(y, STR_BLUETOOTH); diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 6226fea3a..78f82c997 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -69,6 +69,39 @@ void ModuleState::startBind(BindInformation* destination, #endif } +#if defined(HARDWARE_INTERNAL_MODULE) +void restartInternalModule() +{ + if (!IS_INTERNAL_MODULE_ON()) { + return; + } + pauseMixerCalculations(); + pausePulses(); + INTERNAL_MODULE_OFF(); + RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate + telemetryProtocol = 255; // force telemetry port + module reinitialization + INTERNAL_MODULE_ON(); + resumePulses(); + resumeMixerCalculations(); +} +#endif +#if defined(HARDWARE_EXTERNAL_MODULE) +void restartExternalModule() +{ + if (!IS_EXTERNAL_MODULE_ON()) { + return; + } + pauseMixerCalculations(); + pausePulses(); + EXTERNAL_MODULE_OFF(); + RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate + telemetryProtocol = 255; // force telemetry port + module reinitialization + EXTERNAL_MODULE_ON(); + resumePulses(); + resumeMixerCalculations(); +} +#endif + void ModuleState::readModuleInformation(ModuleInformation* destination, int8_t first, int8_t last) { diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index a8664d3b0..b0ce33c6d 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -254,6 +254,7 @@ void extmodulePxx1SerialStart(); void extmodulePpmStart(); void intmoduleStop(); void extmoduleStop(); +void restartInternalModule(); void restartExternalModule(); void getModuleStatusString(uint8_t moduleIdx, char * statusText); void getModuleSyncStatusString(uint8_t moduleIdx, char * statusText);