mirror of https://github.com/ArduPilot/ardupilot
AP_WindVane: convert analog sensor to use latest value
This commit is contained in:
parent
0628aa9e29
commit
ab1d54745d
|
@ -27,7 +27,7 @@ AP_WindVane_Analog::AP_WindVane_Analog(AP_WindVane &frontend) :
|
|||
void AP_WindVane_Analog::update_direction()
|
||||
{
|
||||
_dir_analog_source->set_pin(_frontend._dir_analog_pin);
|
||||
_current_analog_voltage = _dir_analog_source->voltage_average_ratiometric();
|
||||
_current_analog_voltage = _dir_analog_source->voltage_latest();
|
||||
|
||||
const float voltage_ratio = linear_interpolate(0.0f, 1.0f, _current_analog_voltage, _frontend._dir_analog_volt_min, _frontend._dir_analog_volt_max);
|
||||
const float direction = (voltage_ratio * radians(360 - _frontend._dir_analog_deadzone)) + radians(_frontend._dir_analog_bearing_offset);
|
||||
|
|
Loading…
Reference in New Issue