AP_RangeFinder: stop persisting detections in LeddarOne driver

We don't use these readings except immediately after where we store them - so don't store them persistently.
This commit is contained in:
Peter Barker 2022-06-22 11:15:51 +10:00 committed by Peter Barker
parent 65cfded501
commit 6923f20ce6
2 changed files with 1 additions and 4 deletions

View File

@ -172,12 +172,10 @@ LeddarOne_Status AP_RangeFinder_LeddarOne::parse_response(uint8_t &number_detect
return LEDDARONE_STATE_ERR_NUMBER_DETECTIONS;
}
memset(detections, 0, sizeof(detections));
sum_distance = 0;
for (index=0; index<number_detections; index++) {
// construct data word from two bytes and convert mm to cm
detections[index] = (static_cast<uint16_t>(read_buffer[index_offset])*256 + read_buffer[index_offset+1]) / 10;
sum_distance += detections[index];
sum_distance += (static_cast<uint16_t>(read_buffer[index_offset])*256 + read_buffer[index_offset+1]) / 10;
// add index offset (4) to read next detection data
index_offset += LEDDARONE_DETECTION_DATA_OFFSET;

View File

@ -69,7 +69,6 @@ private:
uint32_t last_sending_request_ms;
uint32_t last_available_ms;
uint16_t detections[LEDDARONE_DETECTIONS_MAX];
uint32_t sum_distance;
LeddarOne_ModbusStatus modbus_status = LEDDARONE_MODBUS_STATE_INIT;