Line data Source code
1 : #pragma once 2 : 3 : #include "AP_RangeFinder_config.h" 4 : 5 : #if AP_RANGEFINDER_MAXBOTIX_SERIAL_ENABLED 6 : 7 : #include "AP_RangeFinder.h" 8 : #include "AP_RangeFinder_Backend_Serial.h" 9 : 10 : class AP_RangeFinder_MaxsonarSerialLV : public AP_RangeFinder_Backend_Serial 11 : { 12 : 13 : public: 14 : 15 1 : static AP_RangeFinder_Backend_Serial *create( 16 : RangeFinder::RangeFinder_State &_state, 17 : AP_RangeFinder_Params &_params) { 18 1 : return NEW_NOTHROW AP_RangeFinder_MaxsonarSerialLV(_state, _params); 19 : } 20 : 21 : protected: 22 : 23 337 : MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override { 24 337 : return MAV_DISTANCE_SENSOR_ULTRASOUND; 25 : } 26 : 27 : private: 28 : 29 : AP_RangeFinder_MaxsonarSerialLV(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params); 30 : 31 : // get a reading 32 : bool get_reading(float &reading_m) override; 33 : 34 1009 : uint16_t read_timeout_ms() const override { return 500; } 35 : 36 : char linebuf[10]; 37 : uint8_t linebuf_len = 0; 38 : }; 39 : 40 : #endif // AP_RANGEFINDER_MAXBOTIX_SERIAL_ENABLED