diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index a68a8858b6..d2bb893968 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -607,7 +607,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP_ALTITUDE: - sbufWriteU32(dst, lrintf(getEstimatedActualPosition(Z))); + sbufWriteU32(dst, lrintf(getEstimatedActualPosition(Z))); sbufWriteU16(dst, lrintf(getEstimatedActualVelocity(Z))); #if defined(USE_BARO) sbufWriteU32(dst, baroGetLatestAltitude()); @@ -2478,7 +2478,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) #ifdef USE_GPS case MSP_SET_RAW_GPS: if (dataSize == 14) { - if (sbufReadU8(src)) { + if (sbufReadU8(src)) { ENABLE_STATE(GPS_FIX); } else { DISABLE_STATE(GPS_FIX); @@ -3395,31 +3395,6 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu *ret = mspFcSafeHomeOutCommand(dst, src); break; - case MSP_TELEMETRY: - sbufWriteU8(dst, ARMING_FLAG(ARMED)); // arming status - sbufWriteU8(dst, 0); // modes - sbufWriteU32(dst, flightModeFlags); - - sbufWriteU8(dst, 1); // messages - char buff[50] = {" "}; - osdGetSystemMessage(buff, sizeof(buff), false); - const char *c = buff; - while (*c) { - sbufWriteU8(dst, *c++); - } - sbufWriteU8(dst, '\0'); // last symbol - - sbufWriteU8(dst, 2); // home position - sbufWriteU16(dst, GPS_distanceToHome); - sbufWriteU16(dst, GPS_directionToHome); - sbufWriteU32(dst, baro.BaroAlt); - sbufWriteU8(dst, 3); // throttle - sbufWriteU8(dst, getThrottlePercent()); - sbufWriteU8(dst, 4); // vario - sbufWriteU16(dst, getEstimatedActualVelocity(Z) + 32000); - - *ret = MSP_RESULT_ACK; - break; #ifdef USE_SIMULATOR case MSP_SIMULATOR: tmp_u8 = sbufReadU8(src); //MSP_SIMULATOR version diff --git a/src/main/flight/imu.c b/src/main/flight/imu.c index c1457ce5e9..3cc883f024 100644 --- a/src/main/flight/imu.c +++ b/src/main/flight/imu.c @@ -328,9 +328,9 @@ static void imuMahonyAHRSupdate(float dt, const fpVector3_t * gyroBF, const fpVe vectorNormalize(&vMag, &vMag); #ifdef USE_SIMULATOR - if (ARMING_FLAG(SIMULATOR_MODE)) { - imuSetMagneticDeclination(0); - } + if (ARMING_FLAG(SIMULATOR_MODE)) { + imuSetMagneticDeclination(0); + } #endif // Reference mag field vector heading is Magnetic North in EF. We compute that by rotating True North vector by declination and assuming Z-component is zero diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index 79eb01f1dd..6295b04d3e 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -246,6 +246,7 @@ void writeServos(void) void servoMixer(float dT) { int16_t input[INPUT_SOURCE_COUNT]; // Range [-500:+500] + if (FLIGHT_MODE(MANUAL_MODE)) { input[INPUT_STABILIZED_ROLL] = rcCommand[ROLL]; input[INPUT_STABILIZED_PITCH] = rcCommand[PITCH]; diff --git a/src/main/io/osd.c b/src/main/io/osd.c index e7dbbd368d..57332e9c24 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -846,10 +846,8 @@ static const char * osdArmingDisabledReasonMessage(void) FALLTHROUGH; case ARMED: FALLTHROUGH; -#ifdef USE_SIMULATOR case SIMULATOR_MODE: FALLTHROUGH; -#endif case WAS_EVER_ARMED: break; } diff --git a/src/main/io/osd_dji_hd.c b/src/main/io/osd_dji_hd.c index b5e9d4dcca..269ea0cd7b 100644 --- a/src/main/io/osd_dji_hd.c +++ b/src/main/io/osd_dji_hd.c @@ -537,10 +537,8 @@ static char * osdArmingDisabledReasonMessage(void) FALLTHROUGH; case ARMED: FALLTHROUGH; -#ifdef USE_SIMULATOR case SIMULATOR_MODE: FALLTHROUGH; -#endif case WAS_EVER_ARMED: break; } diff --git a/src/main/sensors/acceleration.c b/src/main/sensors/acceleration.c index 1f2f896e19..67cc84f7e0 100644 --- a/src/main/sensors/acceleration.c +++ b/src/main/sensors/acceleration.c @@ -505,8 +505,8 @@ void accUpdate(void) { #ifdef USE_SIMULATOR if (ARMING_FLAG(SIMULATOR_MODE)) { - //output: acc.accADCf - //unused: acc.dev.ADCRaw[], acc.accClipCount, acc.accVibeSq[] + //output: acc.accADCf + //unused: acc.dev.ADCRaw[], acc.accClipCount, acc.accVibeSq[] return; } #endif @@ -516,6 +516,7 @@ void accUpdate(void) for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) { accADC[axis] = acc.dev.ADCRaw[axis]; + DEBUG_SET(DEBUG_ACC, axis, accADC[axis]); } performAcclerationCalibration(); diff --git a/src/main/sensors/barometer.c b/src/main/sensors/barometer.c index 65f5819b53..dc7240f426 100644 --- a/src/main/sensors/barometer.c +++ b/src/main/sensors/barometer.c @@ -278,7 +278,7 @@ uint32_t baroUpdate(void) } #ifdef USE_SIMULATOR if (!ARMING_FLAG(SIMULATOR_MODE)) { - //output: baro.baroPressure, baro.baroTemperature + //output: baro.baroPressure, baro.baroTemperature baro.dev.calculate(&baro.dev, &baro.baroPressure, &baro.baroTemperature); } #else @@ -332,7 +332,7 @@ int32_t baroCalculateAltitude(void) } #endif // calculates height from ground via baro readings - baro.BaroAlt = pressureToAltitude(baro.baroPressure) - baroGroundAltitude; + baro.BaroAlt = pressureToAltitude(baro.baroPressure) - baroGroundAltitude; } return baro.BaroAlt; diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index bb64f0ea16..1f731d44b5 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -501,8 +501,8 @@ void FAST_CODE NOINLINE gyroUpdate() { #ifdef USE_SIMULATOR if (ARMING_FLAG(SIMULATOR_MODE)) { - //output: gyro.gyroADCf[axis] - //unused: dev->gyroADCRaw[], dev->gyroZero[]; + //output: gyro.gyroADCf[axis] + //unused: dev->gyroADCRaw[], dev->gyroZero[]; return; } #endif diff --git a/src/main/target/common.h b/src/main/target/common.h index d3cfa2d3b3..d73f4a4ea2 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -184,6 +184,8 @@ // Wind estimator #define USE_WIND_ESTIMATOR +#define USE_SIMULATOR + //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) @@ -193,6 +195,4 @@ #define USE_TELEMETRY_HOTT #define USE_HOTT_TEXTMODE -#define USE_SIMULATOR - #endif