Commit 066ce669 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #311 from tstellanova/display_flt_modes

Display full flight modes
parents 38caf81a ee28a045
......@@ -3325,45 +3325,55 @@ QString UAS::getAudioModeTextFor(int id)
return mode;
}
/**
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given.
*/
/**
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given.
*/
QString UAS::getShortModeTextFor(int id)
{
QString mode;
QString mode = "";
uint8_t modeid = id;
qDebug() << "MODE:" << modeid;
// BASE MODE DECODING
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO)
{
mode += "|AUTO";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED)
{
mode += "|VECTOR";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE)
{
mode += "|STABILIZED";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST)
{
mode += "|TEST";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL)
{
mode += "|MANUAL";
}
else if (modeid == 0)
if (modeid == 0)
{
mode = "|PREFLIGHT";
}
else
else {
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO){
mode += "|AUTO";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL){
mode += "|MANUAL";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED){
mode += "|VECTOR";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE){
mode += "|STABILIZED";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST){
mode += "|TEST";
}
}
if (mode.length() == 0)
{
mode = "|UNKNOWN";
qDebug() << __FILE__ << __LINE__ << " Unknown modeid: " << modeid;
}
// ARMED STATE DECODING
......@@ -3382,6 +3392,8 @@ QString UAS::getShortModeTextFor(int id)
mode.prepend("HIL:");
}
qDebug() << "MODE: " << modeid << " " << mode;
return mode;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment