From a76d0e30022c7ca8b14450ae602153f885bd037c Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 31 Mar 2020 12:11:08 +0530 Subject: [PATCH] Plane: Remove SONR messages logging --- ArduPlane/Log.cpp | 40 ---------------------------------------- ArduPlane/Plane.h | 1 - ArduPlane/defines.h | 1 - ArduPlane/sensors.cpp | 4 ---- 4 files changed, 46 deletions(-) diff --git a/ArduPlane/Log.cpp b/ArduPlane/Log.cpp index 13dc6b6a13..8aeb82e160 100644 --- a/ArduPlane/Log.cpp +++ b/ArduPlane/Log.cpp @@ -181,35 +181,6 @@ void Plane::Log_Write_Status() logger.WriteBlock(&pkt, sizeof(pkt)); } -struct PACKED log_Sonar { - LOG_PACKET_HEADER; - uint64_t time_us; - float distance; - float voltage; - uint8_t count; - float correction; -}; - -// Write a sonar packet. Note that RFND log messages are written by -// RangeFinder itself as part of update(). -void Plane::Log_Write_Sonar() -{ - uint16_t distance = 0; - if (rangefinder.status_orient(ROTATION_PITCH_270) == RangeFinder::Status::Good) { - distance = rangefinder.distance_cm_orient(ROTATION_PITCH_270); - } - - struct log_Sonar pkt = { - LOG_PACKET_HEADER_INIT(LOG_SONAR_MSG), - time_us : AP_HAL::micros64(), - distance : (float)distance*0.01f, - voltage : rangefinder.voltage_mv_orient(ROTATION_PITCH_270)*0.001f, - count : rangefinder_state.in_range_count, - correction : rangefinder_state.correction - }; - logger.WriteBlock(&pkt, sizeof(pkt)); -} - struct PACKED log_AETR { LOG_PACKET_HEADER; uint64_t time_us; @@ -287,16 +258,6 @@ const struct LogStructure Plane::log_structure[] = { { LOG_NTUN_MSG, sizeof(log_Nav_Tuning), "NTUN", "QfcccfffLLii", "TimeUS,Dist,TBrg,NavBrg,AltErr,XT,XTi,AspdE,TLat,TLng,TAlt,TAspd", "smddmmmnDUmn", "F0BBB0B0GGBB" }, -// @LoggerMessage: SONR -// @Description: Sonar (downward facing rangefinder) related messages. -// @Field: TimeUS: Microseconds since system startup -// @Field: Dist: Distance as detected from the sensor -// @Field: Volt: Voltage at the sensor pin (only applicable for analog sensor) -// @Field: Cnt: Number of consecutive valid readings (maxes out at 10) -// @Field: Corr: Correction made to altitude reading from barometer reading - { LOG_SONAR_MSG, sizeof(log_Sonar), - "SONR", "QffBf", "TimeUS,Dist,Volt,Cnt,Corr", "smv--", "FB0--" }, - // @LoggerMessage: ATRP // @Description: Pitch/Roll AutoTune messages for Plane // @Field: TimeUS: Microseconds since system startup @@ -405,7 +366,6 @@ void Plane::Log_Write_Startup(uint8_t type) {} void Plane::Log_Write_Control_Tuning() {} void Plane::Log_Write_Nav_Tuning() {} void Plane::Log_Write_Status() {} -void Plane::Log_Write_Sonar() {} void Plane::Log_Write_RC(void) {} void Plane::Log_Write_Vehicle_Startup_Messages() {} diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index d3d2d9adbc..4efe051ab7 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -772,7 +772,6 @@ private: void Log_Write_Control_Tuning(); void Log_Write_Nav_Tuning(); void Log_Write_Status(); - void Log_Write_Sonar(); void Log_Write_RC(void); void Log_Write_Vehicle_Startup_Messages(); void Log_Write_AOA_SSA(); diff --git a/ArduPlane/defines.h b/ArduPlane/defines.h index b8db26b542..017b6d9d4c 100644 --- a/ArduPlane/defines.h +++ b/ArduPlane/defines.h @@ -83,7 +83,6 @@ enum log_messages { LOG_NTUN_MSG, LOG_STARTUP_MSG, TYPE_GROUNDSTART_MSG, - LOG_SONAR_MSG, LOG_STATUS_MSG, LOG_QTUN_MSG, LOG_PIQR_MSG, diff --git a/ArduPlane/sensors.cpp b/ArduPlane/sensors.cpp index 0850852173..eb35322133 100644 --- a/ArduPlane/sensors.cpp +++ b/ArduPlane/sensors.cpp @@ -31,10 +31,6 @@ void Plane::read_rangefinder(void) rangefinder.update(); - if ((rangefinder.num_sensors() > 0) && should_log(MASK_LOG_SONAR)) { - Log_Write_Sonar(); - } - rangefinder_height_update(); }