Stop bind on bind response received
This commit is contained in:
@@ -929,6 +929,12 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, l_posHorz==1 ? attr : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
#if defined(MULTIMODULE)
|
||||
if (spektrumBindFinished) {
|
||||
spektrumBindFinished = false;
|
||||
s_editMode=0;
|
||||
}
|
||||
#endif
|
||||
if (attr && l_posHorz>0 && s_editMode>0) {
|
||||
if (l_posHorz == 1)
|
||||
newFlag = MODULE_BIND;
|
||||
@@ -937,6 +943,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
moduleFlag[moduleIdx] = newFlag;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -257,6 +257,7 @@ bool isSpektrumValidValue(int32_t value, const SpektrumDataType type)
|
||||
}
|
||||
}
|
||||
|
||||
bool spektrumBindFinished = 0;
|
||||
void processSpektrumPacket(const uint8_t *packet)
|
||||
{
|
||||
setTelemetryValue(TELEM_PROTO_SPEKTRUM, (I2C_PSEUDO_TX << 8) + 0, 0, 0, packet[1], UNIT_RAW, 0);
|
||||
@@ -373,6 +374,11 @@ void processDSMBindPacket(const uint8_t *packet)
|
||||
/* log the bind packet as telemetry for quick debugging */
|
||||
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
|
||||
&& moduleFlag[EXTERNAL_MODULE] == MODULE_BIND) {
|
||||
spektrumBindFinished=true;
|
||||
}
|
||||
}
|
||||
|
||||
void processSpektrumTelemetryData(uint8_t data)
|
||||
|
||||
@@ -24,4 +24,5 @@
|
||||
void processSpektrumTelemetryData(uint8_t data);
|
||||
void spektrumSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
||||
|
||||
extern bool spektrumBindFinished;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user