Configurable priority in high-level protocol logic classes

This commit is contained in:
Pavel Kirienko
2015-07-05 09:54:54 +03:00
parent f48c16d1ef
commit 35fd634282
9 changed files with 19 additions and 15 deletions
@@ -48,7 +48,8 @@ public:
* @param short_reason Short ASCII string that describes the reason of the panic, 7 characters max.
* If the string exceeds 7 characters, it will be truncated.
*/
void panic(const char* short_reason_description)
void panic(const char* short_reason_description,
const TransferPriority priority = TransferPriority::Default)
{
msg_.reason_text.clear();
const char* p = short_reason_description;
@@ -64,6 +65,8 @@ public:
UAVCAN_TRACE("PanicBroadcaster", "Panicking with reason '%s'", getReason().c_str());
pub_.setPriority(priority);
publishOnce();
startPeriodic(MonotonicDuration::fromMSec(protocol::Panic::BROADCASTING_PERIOD_MS));
}