From ce0a58b79075a8c8c3d3a748a2339921b3ff11f8 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 16 Mar 2019 15:28:53 +0100 Subject: [PATCH] Multi fixes --- radio/src/gui/212x64/model_setup.cpp | 2 +- radio/src/gui/gui_common_arm.cpp | 5 +++++ radio/src/pulses/multi.cpp | 10 +++++----- radio/src/pulses/pulses.h | 1 + radio/src/telemetry/spektrum.cpp | 8 ++++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 9f2c0cf50..4e31ea4df 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -1081,7 +1081,7 @@ void menuModelSetup(event_t event) } moduleSettings[moduleIdx].mode = newFlag; #if defined(MULTIMODULE) - if (newFlag == MODULE_BIND) + if (newFlag == MODULE_MODE_BIND) multiBindStatus = MULTI_BIND_INITIATED; #endif } diff --git a/radio/src/gui/gui_common_arm.cpp b/radio/src/gui/gui_common_arm.cpp index b1feab19f..b48a718ef 100644 --- a/radio/src/gui/gui_common_arm.cpp +++ b/radio/src/gui/gui_common_arm.cpp @@ -545,6 +545,11 @@ bool isInternalModuleAvailable(int module) bool isExternalModuleAvailable(int module) { +#if !defined(PCBXLITE) + if (module == MODULE_TYPE_R9M_LITE || module == MODULE_TYPE_R9M_LITE2 || module == MODULE_TYPE_R9M_LITE_PRO2) { + return false; + } +#endif #if !defined(PXX1) if (module == MODULE_TYPE_XJT || module == MODULE_TYPE_R9M || module == MODULE_TYPE_R9M_LITE) { return false; diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index d75085b40..4465a9c08 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -57,7 +57,7 @@ static void sendFailsafeChannels(uint8_t port) uint8_t bitsavailable = 0; for (int i = 0; i < MULTI_CHANS; i++) { - int16_t failsafeValue = g_model.moduleData[port].failsafeChannels[i]; + int16_t failsafeValue = g_model.failsafeChannels[i]; int pulseValue; if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD) failsafeValue = FAILSAFE_CHANNEL_HOLD; @@ -106,7 +106,7 @@ void setupPulsesMultimodule() sendSetupFrame(); } else if (counter % 1000 == 0 && g_model.moduleData[EXTERNAL_MODULE].failsafeMode != FAILSAFE_NOT_SET && g_model.moduleData[EXTERNAL_MODULE].failsafeMode != FAILSAFE_RECEIVER) { sendFrameProtocolHeader(EXTERNAL_MODULE, true); - sendFailsafeChannels(port); + sendFailsafeChannels(EXTERNAL_MODULE); } else { // Normal Frame sendFrameProtocolHeader(EXTERNAL_MODULE, false); @@ -152,16 +152,16 @@ void sendFrameProtocolHeader(uint8_t port, bool failsafe) int8_t optionValue = g_model.moduleData[port].multi.optionValue; uint8_t protoByte = 0; - if (moduleSettings[port].mode == MODULE_BIND) + if (moduleSettings[port].mode == MODULE_MODE_BIND) protoByte |= MULTI_SEND_BIND; - else if (moduleSettings[port].mode == MODULE_RANGECHECK) + else if (moduleSettings[port].mode == MODULE_MODE_RANGECHECK) protoByte |= MULTI_SEND_RANGECHECK; // rfProtocol if (g_model.moduleData[port].getMultiProtocol(true) == MM_RF_PROTO_DSM2) { // Autobinding should always be done in DSMX 11ms - if (g_model.moduleData[port].multi.autoBindMode && moduleSettings[port].mode == MODULE_BIND) + if (g_model.moduleData[port].multi.autoBindMode && moduleSettings[port].mode == MODULE_MODE_BIND) subtype = MM_RF_DSM2_SUBTYPE_AUTO; // Multi module in DSM mode wants the number of channels to be used as option value diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 37eacb033..3308f30bf 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -202,6 +202,7 @@ void setupPulsesPPMTrainer(); void sendByteDsm2(uint8_t b); void putDsm2Flush(); void putDsm2SerialBit(uint8_t bit); +void sendByteSbus(uint8_t b); #if defined(HUBSAN) void Hubsan_Init(); diff --git a/radio/src/telemetry/spektrum.cpp b/radio/src/telemetry/spektrum.cpp index ad6762d20..96c7102d0 100644 --- a/radio/src/telemetry/spektrum.cpp +++ b/radio/src/telemetry/spektrum.cpp @@ -173,14 +173,14 @@ const SpektrumSensor spektrumSensors[] = { {I2C_CELLS, 8, uint16, ZSTR_CELLS, UNIT_VOLTS, 2}, {I2C_CELLS, 10, uint16, ZSTR_CELLS, UNIT_VOLTS, 2}, {I2C_CELLS, 12, uint16, ZSTR_TEMP2, UNIT_CELSIUS, 2}, - + // Vario-S {0x40, 0, int16, ZSTR_ALT, UNIT_METERS, 1}, {0x40, 2, int16, ZSTR_VSPD, UNIT_METERS_PER_SECOND, 1}, // 0x50-0x56 custom 3rd party sensors //{0x50, 0, int16, ZSTR_} - + // 0x7d are transmitter channels frame data [7], probably only available on the Spektrum // telemetry bus on the model itself @@ -333,7 +333,7 @@ void processSpektrumPacket(const uint8_t *packet) } telemetryStreaming = TELEMETRY_TIMEOUT10ms; } - + uint16_t pseudoId = (sensor->i2caddress << 8 | sensor->startByte); setTelemetryValue(TELEM_PROTO_SPEKTRUM, pseudoId, 0, instance, value, sensor->unit, sensor->precision); } @@ -400,7 +400,7 @@ void processDSMBindPacket(const uint8_t *packet) setTelemetryValue(TELEM_PROTO_SPEKTRUM, (I2C_PSEUDO_TX << 8) + 4, 0, 0, debugval, UNIT_RAW, 0); /* Finally stop binding as the rx just told us that it is bound */ - if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MM_RF_PROTO_DSM2 && moduleSettings[EXTERNAL_MODULE].mode == MODULE_BIND) { + if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MM_RF_PROTO_DSM2 && moduleSettings[EXTERNAL_MODULE].mode == MODULE_MODE_BIND) { multiBindStatus=MULTI_BIND_FINISHED; } }