Browse Source

dronecan beeper: remove unneded var

v1.13.0-BW
Alessandro Simovic 3 years ago committed by Daniel Agar
parent
commit
510ad00024
  1. 10
      src/drivers/uavcan/beep.cpp
  2. 1
      src/drivers/uavcan/beep.hpp

10
src/drivers/uavcan/beep.cpp

@ -72,17 +72,13 @@ void UavcanBeepController::periodic_update(const uavcan::TimerEvent &) @@ -72,17 +72,13 @@ void UavcanBeepController::periodic_update(const uavcan::TimerEvent &)
_tune_control_sub.copy(&_tune);
if (_tune.timestamp > 0) {
Tunes::ControlResult result = _tunes.set_control(_tune);
if (result == Tunes::ControlResult::Success) {
_play_tone = true;
}
_tunes.set_control(_tune);
}
}
const hrt_abstime timestamp_now = hrt_absolute_time();
if ((timestamp_now - _interval_timestamp <= _duration) || !_play_tone) {
if ((timestamp_now - _interval_timestamp <= _duration)) {
return;
}
@ -92,7 +88,7 @@ void UavcanBeepController::periodic_update(const uavcan::TimerEvent &) @@ -92,7 +88,7 @@ void UavcanBeepController::periodic_update(const uavcan::TimerEvent &)
_duration = _silence_length;
_silence_length = 0;
} else if (_play_tone && (_tunes.get_next_note(_frequency, _duration, _silence_length) == Tunes::Status::Continue)) {
} else if (_tunes.get_next_note(_frequency, _duration, _silence_length) == Tunes::Status::Continue) {
// Start playing the note.
// A frequency of 0 corresponds to ToneAlarmInterface::stop_note()

1
src/drivers/uavcan/beep.hpp

@ -87,7 +87,6 @@ private: @@ -87,7 +87,6 @@ private:
hrt_abstime _interval_timestamp{0};
tune_control_s _tune{};
Tunes _tunes{};
bool _play_tone{false};
unsigned int _silence_length{0}; ///< If nonzero, silence before next note.
unsigned int _frequency{0};
unsigned int _duration{0};

Loading…
Cancel
Save