2016-11-14 17:47:45 -04:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-10 22:47:38 -04:00
|
|
|
#include "AP_RangeFinder.h"
|
|
|
|
#include "AP_RangeFinder_Backend_Serial.h"
|
2016-11-14 17:47:45 -04:00
|
|
|
|
2019-11-01 07:35:23 -03:00
|
|
|
class AP_RangeFinder_uLanding : public AP_RangeFinder_Backend_Serial
|
2016-11-14 17:47:45 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2019-11-01 07:35:23 -03:00
|
|
|
using AP_RangeFinder_Backend_Serial::AP_RangeFinder_Backend_Serial;
|
2016-11-14 17:47:45 -04:00
|
|
|
|
2017-08-08 04:32:53 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_RADAR;
|
|
|
|
}
|
|
|
|
|
2019-11-01 07:35:23 -03:00
|
|
|
// baudrate used during object construction:
|
|
|
|
uint32_t initial_baudrate(uint8_t serial_instance) const override {
|
|
|
|
return 115200;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t rx_bufsize() const override { return 128; }
|
|
|
|
uint16_t tx_bufsize() const override { return 128; }
|
|
|
|
|
2016-11-14 17:47:45 -04:00
|
|
|
private:
|
2017-09-06 14:43:33 -03:00
|
|
|
// detect uLanding Firmware Version
|
|
|
|
bool detect_version(void);
|
|
|
|
|
2016-11-14 17:47:45 -04:00
|
|
|
// get a reading
|
2019-11-01 07:59:50 -03:00
|
|
|
bool get_reading(uint16_t &reading_cm) override;
|
2016-11-14 17:47:45 -04:00
|
|
|
|
2017-09-15 14:05:20 -03:00
|
|
|
uint8_t _linebuf[6];
|
|
|
|
uint8_t _linebuf_len;
|
|
|
|
bool _version_known;
|
|
|
|
uint8_t _header;
|
|
|
|
uint8_t _version;
|
2016-11-14 17:47:45 -04:00
|
|
|
};
|