rc_loss_alarm: sorting function definitions

This commit is contained in:
Alessandro Simovic
2018-07-05 14:17:55 +02:00
committed by Beat Küng
parent c8ff5f09d4
commit d2b9197587
+31 -31
View File
@@ -145,37 +145,6 @@ void RC_Loss_Alarm::cycle_trampoline(void *arg)
dev->cycle();
}
void RC_Loss_Alarm::pub_tune()
{
struct tune_control_s tune_control = {};
tune_control.tune_id = static_cast<int>(TuneID::ERROR_TUNE);
tune_control.strength = tune_control_s::STRENGTH_MAX;
tune_control.tune_override = 1;
tune_control.timestamp = hrt_absolute_time();
if (_tune_control_pub == nullptr) {
_tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control);
}else{
orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control);
}
}
void RC_Loss_Alarm::stop_tune()
{
struct tune_control_s tune_control = {};
tune_control.tune_id = static_cast<int>(TuneID::CUSTOM);
tune_control.frequency = 0;
tune_control.duration = 0;
tune_control.silence = 0;
tune_control.tune_override = true;
if (_tune_control_pub == nullptr) {
_tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control);
}else{
orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control);
}
}
void RC_Loss_Alarm::cycle()
{
// Subscribe if necessary
@@ -210,6 +179,37 @@ void RC_Loss_Alarm::cycle()
}
}
void RC_Loss_Alarm::pub_tune()
{
struct tune_control_s tune_control = {};
tune_control.tune_id = static_cast<int>(TuneID::ERROR_TUNE);
tune_control.strength = tune_control_s::STRENGTH_MAX;
tune_control.tune_override = 1;
tune_control.timestamp = hrt_absolute_time();
if (_tune_control_pub == nullptr) {
_tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control);
}else{
orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control);
}
}
void RC_Loss_Alarm::stop_tune()
{
struct tune_control_s tune_control = {};
tune_control.tune_id = static_cast<int>(TuneID::CUSTOM);
tune_control.frequency = 0;
tune_control.duration = 0;
tune_control.silence = 0;
tune_control.tune_override = true;
if (_tune_control_pub == nullptr) {
_tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control);
}else{
orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control);
}
}
int RC_Loss_Alarm::reset_module(){
RC_Loss_Alarm::_was_armed = false;
RC_Loss_Alarm::stop_tune();