diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index 38d5d126ba..3738779796 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -3350,18 +3350,23 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, sbufReadU8(src); #endif + if (sbufBytesRemaining(src) >= 1) { #ifdef USE_RANGEFINDER - rangefinderConfigMutable()->rangefinder_hardware = sbufReadU8(src); + rangefinderConfigMutable()->rangefinder_hardware = sbufReadU8(src); #else - sbufReadU8(src); + sbufReadU8(src); #endif + } + if (sbufBytesRemaining(src) >= 1) { #ifdef USE_OPTICALFLOW - opticalflowConfigMutable()->opticalflow_hardware = sbufReadU8(src); + opticalflowConfigMutable()->opticalflow_hardware = sbufReadU8(src); #else - sbufReadU8(src); + sbufReadU8(src); #endif + } break; + #ifdef USE_ACC case MSP_ACC_CALIBRATION: if (!ARMING_FLAG(ARMED)) diff --git a/src/main/pg/pg_ids.h b/src/main/pg/pg_ids.h index 97e3d125d9..ee9fee1a0b 100644 --- a/src/main/pg/pg_ids.h +++ b/src/main/pg/pg_ids.h @@ -159,7 +159,6 @@ //#define PG_SOFTSERIAL_PIN_CONFIG 558 // removed, merged into SERIAL_PIN_CONFIG #define PG_GIMBAL_TRACK_CONFIG 559 #define PG_OPTICALFLOW_CONFIG 560 -#define PG_BETAFLIGHT_END 560 // OSD configuration (subject to change) diff --git a/src/main/sensors/opticalflow.c b/src/main/sensors/opticalflow.c index 27dc57e970..796e5383ad 100644 --- a/src/main/sensors/opticalflow.c +++ b/src/main/sensors/opticalflow.c @@ -68,8 +68,8 @@ PG_REGISTER_WITH_RESET_TEMPLATE(opticalflowConfig_t, opticalflowConfig, PG_OPTIC PG_RESET_TEMPLATE(opticalflowConfig_t, opticalflowConfig, .opticalflow_hardware = OPTICALFLOW_NONE, .rotation = 0, - .flow_lpf = 0, - .flip_x = 0 + .flip_x = 0, + .flow_lpf = 0 ); static opticalflow_t opticalflow;