From 2b5e2a00e14e94df0aaa6c2d5f987a41894dc1ab Mon Sep 17 00:00:00 2001 From: Josh Henderson Date: Sun, 26 Sep 2021 04:19:36 -0400 Subject: [PATCH] SITL: NMEA Depthfinder add temperature simulation --- libraries/SITL/SIM_RF_NMEA.cpp | 11 +++++++++++ libraries/SITL/SIM_RF_NMEA.h | 3 +++ libraries/SITL/SIM_SerialRangeFinder.cpp | 19 +++++++++++++++++++ libraries/SITL/SIM_SerialRangeFinder.h | 5 +++++ 4 files changed, 38 insertions(+) diff --git a/libraries/SITL/SIM_RF_NMEA.cpp b/libraries/SITL/SIM_RF_NMEA.cpp index 5e1bae4104..6f5f1aceff 100644 --- a/libraries/SITL/SIM_RF_NMEA.cpp +++ b/libraries/SITL/SIM_RF_NMEA.cpp @@ -38,3 +38,14 @@ uint32_t RF_NMEA::packet_for_alt(uint16_t alt_cm, uint8_t *buffer, uint8_t bufle ret += snprintf((char*)&buffer[ret], buflen-ret, "*%02X\r\n", checksum); return ret; } + +uint32_t RF_NMEA::packet_for_temperature(float temperature, uint8_t *buffer, uint8_t buflen) +{ + ssize_t ret = snprintf((char*)buffer, buflen, "$SMMTW,%f %f", temperature, 0.01); + uint8_t checksum = 0; + for (uint8_t i=1; i