fix: Send correct internal CRSF modelid on change for BW screens (#1508)

This commit is contained in:
Bryan Mayland
2022-02-01 11:36:34 +10:00
committed by GitHub
parent d427817363
commit dd672dc0ea
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -1422,7 +1422,7 @@ void menuModelSetup(event_t event)
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], getMaxRxNum(moduleIdx));
if (checkIncDec_Ret) {
if (isModuleCrossfire(moduleIdx))
moduleState[EXTERNAL_MODULE].counter = CRSF_FRAME_MODELID;
moduleState[moduleIdx].counter = CRSF_FRAME_MODELID;
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx];
}
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
+1 -1
View File
@@ -1271,7 +1271,7 @@ void menuModelSetup(event_t event)
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], getMaxRxNum(moduleIdx));
if (checkIncDec_Ret) {
if (isModuleCrossfire(moduleIdx))
moduleState[EXTERNAL_MODULE].counter = CRSF_FRAME_MODELID;
moduleState[moduleIdx].counter = CRSF_FRAME_MODELID;
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx];
}
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
+3 -3
View File
@@ -30,7 +30,7 @@
#endif
uint8_t createCrossfireModelIDFrame(uint8_t * frame)
uint8_t createCrossfireModelIDFrame(uint8_t moduleIdx, uint8_t * frame)
{
uint8_t * buf = frame;
*buf++ = UART_SYNC; /* device address */
@@ -40,7 +40,7 @@ uint8_t createCrossfireModelIDFrame(uint8_t * frame)
*buf++ = RADIO_ADDRESS; /* Origin Address */
*buf++ = SUBCOMMAND_CRSF; /* sub command */
*buf++ = COMMAND_MODEL_SELECT_ID; /* command of set model/receiver id */
*buf++ = g_model.header.modelId[EXTERNAL_MODULE]; /* model ID */
*buf++ = g_model.header.modelId[moduleIdx]; /* model ID */
*buf++ = crc8_BA(frame + 2, 6);
*buf++ = crc8(frame + 2, 7);
return buf - frame;
@@ -83,7 +83,7 @@ static void setupPulsesCrossfire(uint8_t idx, CrossfirePulsesData* p_data,
#endif
{
if (moduleState[idx].counter == CRSF_FRAME_MODELID) {
p_data->length = createCrossfireModelIDFrame(p_data->pulses);
p_data->length = createCrossfireModelIDFrame(idx, p_data->pulses);
moduleState[idx].counter = CRSF_FRAME_MODELID_SENT;
} else {
p_data->length = createCrossfireChannelsFrame(
+3
View File
@@ -322,6 +322,9 @@ void telemetryWakeup()
if (isModuleCrossfire(EXTERNAL_MODULE)) {
moduleState[EXTERNAL_MODULE].counter = CRSF_FRAME_MODELID;
}
if (isModuleCrossfire(INTERNAL_MODULE)) {
moduleState[INTERNAL_MODULE].counter = CRSF_FRAME_MODELID;
}
#endif
}
telemetryState = TELEMETRY_OK;