libtunes: Update tunes and mkblctrl to use the tune_definition

This commit is contained in:
Simone Guscetti
2017-08-07 17:01:59 +02:00
committed by Beat Küng
parent 26b721ac8b
commit 4c6daf0748
3 changed files with 9 additions and 19 deletions
+1 -1
View File
@@ -450,7 +450,7 @@ void
MK::play_beep(int count)
{
tune_control_s tune = {};
tune.tune_id = tune_control_s::TUNE_ID_SINGLE_BEEP;
tune.tune_id = static_cast<int>(TuneID::SINGLE_BEEP);
for (int i = 0; i < count; i++) {
orb_publish(ORB_ID(tune_control), _tune_control_sub, &tune);
+7 -16
View File
@@ -91,31 +91,22 @@ int Tunes::set_control(const tune_control_s &tune_control)
if (tune_control.tune_id < _default_tunes_size) {
switch (tune_control.tune_id) {
case tune_control_s::TUNE_ID_CUSTOM:
case static_cast<int>(TuneID::CUSTOM):
_frequency = (unsigned)tune_control.frequency;
_duration = (unsigned)tune_control.duration;
_silence = (unsigned)tune_control.silence;
_using_custom_msg = true;
break;
case tune_control_s::TUNE_ID_STARTUP:
case tune_control_s::TUNE_ID_ERROR:
case tune_control_s::TUNE_ID_NOTIFY_POSITIVE:
case tune_control_s::TUNE_ID_NOTIFY_NEUTRAL:
case tune_control_s::TUNE_ID_NOTIFY_NEGATIVE:
// tunes that have a high priority
case static_cast<int>(TuneID::STARTUP):
case static_cast<int>(TuneID::ERROR):
case static_cast<int>(TuneID::NOTIFY_POSITIVE):
case static_cast<int>(TuneID::NOTIFY_NEUTRAL):
case static_cast<int>(TuneID::NOTIFY_NEGATIVE):
reset_playing_tune = true;
config_tone(false);
/* FALLTHROUGH */
case tune_control_s::TUNE_ID_ARMING_WARNING:
case tune_control_s::TUNE_ID_BATTERY_WARNING_SLOW:
case tune_control_s::TUNE_ID_BATTERY_WARNING_FAST:
case tune_control_s::TUNE_ID_GPS_WARNING:
case tune_control_s::TUNE_ID_PARACHUTE_RELEASE:
case tune_control_s::TUNE_ID_EKF_WARNING:
case tune_control_s::TUNE_ID_BARO_WARNING:
case tune_control_s::TUNE_ID_SINGLE_BEEP:
case tune_control_s::TUNE_ID_HOME_SET:
default:
// TODO: come up with a better strategy
+1 -2
View File
@@ -39,8 +39,7 @@
#include <uORB/uORB.h>
#include <uORB/topics/tune_control.h>
// TODO: find better way to include the number of tunes, maybe include them in the lib directly?
#include <drivers/drv_tone_alarm.h>
#include "tune_definition.h"
#define TUNE_MAX_UPDATE_INTERVAL_US 100000