From 380247168dabd2629bdca54b59dddccc37942868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 16 Oct 2019 14:26:20 +0200 Subject: [PATCH] mixer_module: avoid using an enum as px4::atomic argument Does not compile on MacOS. --- src/lib/mixer_module/mixer_module.cpp | 18 +++++++++--------- src/lib/mixer_module/mixer_module.hpp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/mixer_module/mixer_module.cpp b/src/lib/mixer_module/mixer_module.cpp index 5f4a3de00e..c547147cc9 100644 --- a/src/lib/mixer_module/mixer_module.cpp +++ b/src/lib/mixer_module/mixer_module.cpp @@ -571,11 +571,11 @@ int MixingOutput::loadMixer(const char *buf, unsigned len) void MixingOutput::handleCommands() { - if (_command.command.load() == Command::Type::None) { + if ((Command::Type)_command.command.load() == Command::Type::None) { return; } - switch (_command.command.load()) { + switch ((Command::Type)_command.command.load()) { case Command::Type::loadMixer: _command.result = loadMixer(_command.mixer_buf, _command.mixer_buf_length); break; @@ -590,12 +590,12 @@ void MixingOutput::handleCommands() } // mark as done - _command.command.store(Command::Type::None); + _command.command.store((int)Command::Type::None); } void MixingOutput::resetMixerThreadSafe() { - if (_command.command.load() != Command::Type::None) { + if ((Command::Type)_command.command.load() != Command::Type::None) { // Cannot happen, because we expect only one other thread to call this. // But as a safety precaution we return here. PX4_ERR("Command not None"); @@ -604,14 +604,14 @@ void MixingOutput::resetMixerThreadSafe() lock(); - _command.command.store(Command::Type::resetMixer); + _command.command.store((int)Command::Type::resetMixer); _interface.ScheduleNow(); unlock(); // wait until processed - while (_command.command.load() != Command::Type::None) { + while ((Command::Type)_command.command.load() != Command::Type::None) { usleep(1000); } @@ -619,7 +619,7 @@ void MixingOutput::resetMixerThreadSafe() int MixingOutput::loadMixerThreadSafe(const char *buf, unsigned len) { - if (_command.command.load() != Command::Type::None) { + if ((Command::Type)_command.command.load() != Command::Type::None) { // Cannot happen, because we expect only one other thread to call this. // But as a safety precaution we return here. PX4_ERR("Command not None"); @@ -630,14 +630,14 @@ int MixingOutput::loadMixerThreadSafe(const char *buf, unsigned len) _command.mixer_buf = buf; _command.mixer_buf_length = len; - _command.command.store(Command::Type::loadMixer); + _command.command.store((int)Command::Type::loadMixer); _interface.ScheduleNow(); unlock(); // wait until processed - while (_command.command.load() != Command::Type::None) { + while ((Command::Type)_command.command.load() != Command::Type::None) { usleep(1000); } diff --git a/src/lib/mixer_module/mixer_module.hpp b/src/lib/mixer_module/mixer_module.hpp index cc2039e298..3c422fcf7a 100644 --- a/src/lib/mixer_module/mixer_module.hpp +++ b/src/lib/mixer_module/mixer_module.hpp @@ -202,7 +202,7 @@ private: resetMixer, loadMixer }; - px4::atomic command{Type::None}; + px4::atomic command{(int)Type::None}; const char *mixer_buf; unsigned mixer_buf_length; int result;