Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/flight/position.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {

if (haveGpsAlt && haveBaroAlt) {
estimatedAltitude = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust);
} else if (haveBaroAlt) {
estimatedAltitude = baroAlt;
}else if (haveGpsAlt) {
}else if (haveGpsAlt) {
estimatedAltitude = gpsAlt;
}else if (haveBaroAlt) {
estimatedAltitude = baroAlt;
}


Expand Down
8 changes: 6 additions & 2 deletions src/main/interface/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFnPtr
sbufWriteU16(dst, getRssi());
#endif
sbufWriteU16(dst, (int16_t)constrain(getAmperage(), -0x8000, 0x7FFF)); // send current in 0.01 A steps, range is -320A to 320A
sbufWriteU16(dst, getBatteryVoltage() * 10);
break;

case MSP_DEBUG:
Expand Down Expand Up @@ -563,6 +564,9 @@ bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFnPtr

// battery alerts
sbufWriteU8(dst, (uint8_t)getBatteryState());

// Additional battery voltage field (DJI osd etc) (in 0.01V steps)
sbufWriteU16(dst, getBatteryVoltage() * 10);
break;
}

Expand Down Expand Up @@ -927,7 +931,7 @@ bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
break;

case MSP_ALTITUDE:
#if defined(USE_BARO) || defined(USE_RANGEFINDER)
#if defined(USE_BARO) || defined(USE_RANGEFINDER) || defined(USE_GPS)
sbufWriteU32(dst, getEstimatedAltitude());
#else
sbufWriteU32(dst, 0);
Expand Down Expand Up @@ -1979,7 +1983,7 @@ mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
currentPidProfile->dFilter[YAW].Wc = sbufReadU8(src);
gyroConfigMutable()->dyn_notch_q_factor = sbufReadU16(src);
gyroConfigMutable()->dyn_notch_min_hz = sbufReadU16(src);

}

// reinitialize the gyro filters with the new values
Expand Down
2 changes: 1 addition & 1 deletion src/main/telemetry/crsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void crsfFrameGps(sbuf_t *dst)
sbufWriteU8(dst, CRSF_FRAMETYPE_GPS);
sbufWriteU32BigEndian(dst, gpsSol.llh.lat); // CRSF and betaflight use same units for degrees
sbufWriteU32BigEndian(dst, gpsSol.llh.lon);
sbufWriteU16BigEndian(dst, (gpsSol.groundSpeed * 36 + 5) / 10); // gpsSol.groundSpeed is in 0.1m/s
sbufWriteU16BigEndian(dst, (gpsSol.groundSpeed * 36 + 50) / 100); // gpsSol.groundSpeed is in cm/s
sbufWriteU16BigEndian(dst, gpsSol.groundCourse * 10); // gpsSol.groundCourse is degrees * 10
//Send real GPS altitude only if it's reliable (there's a GPS fix)
const uint16_t altitude = (constrain(getEstimatedAltitude(), 0 * 100, 5000 * 100) / 100) + 1000; // constrain altitude from 0 to 5,000m
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/telemetry_crsf_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ TEST(TelemetryCrsfTest, TestGPS)
gpsSol.llh.lon = 163 * GPS_DEGREES_DIVIDER;
ENABLE_STATE(GPS_FIX);
gpsSol.llh.alt = 2345 * 100; // altitude in cm
gpsSol.groundSpeed = 163; // speed in 0.1m/s, 16.3 m/s = 58.68 km/h, so CRSF (km/h *10) value is 587
gpsSol.groundSpeed = 1630; // speed in cm/s, 16.3 m/s = 58.68 km/h, so CRSF (km/h *10) value is 587
gpsSol.numSat = 9;
gpsSol.groundCourse = 1479; // degrees * 10
frameLen = getCrsfFrame(frame, CRSF_FRAMETYPE_GPS);
Expand Down