Fix UAVCAN beep not started

This commit is contained in:
alexklimaj
2022-01-12 12:50:38 -07:00
committed by Daniel Agar
parent 0bb9cce1ce
commit cdb6a437a0
4 changed files with 16 additions and 7 deletions
+4 -4
View File
@@ -41,14 +41,14 @@
#include <lib/circuit_breaker/circuit_breaker.h>
UavcanBeep::UavcanBeep(uavcan::INode &node) :
UavcanBeepController::UavcanBeepController(uavcan::INode &node) :
_beep_pub(node),
_timer(node)
{
_beep_pub.setPriority(uavcan::TransferPriority::MiddleLower);
}
int UavcanBeep::init()
int UavcanBeepController::init()
{
// don't initialize if CBRK_BUZZER circuit breaker is enabled.
if (circuit_breaker_enabled("CBRK_BUZZER", CBRK_BUZZER_KEY)) {
@@ -59,14 +59,14 @@ int UavcanBeep::init()
* Setup timer and call back function for periodic updates
*/
if (!_timer.isRunning()) {
_timer.setCallback(TimerCbBinder(this, &UavcanBeep::periodic_update));
_timer.setCallback(TimerCbBinder(this, &UavcanBeepController::periodic_update));
_timer.startPeriodic(uavcan::MonotonicDuration::fromMSec(1000 / MAX_RATE_HZ));
}
return 0;
}
void UavcanBeep::periodic_update(const uavcan::TimerEvent &)
void UavcanBeepController::periodic_update(const uavcan::TimerEvent &)
{
if (_tune_control_sub.updated()) {
_tune_control_sub.copy(&_tune);