Commit 14efc602 authored by tstellanova's avatar tstellanova

show full flight mode status

parent b6c11a8d
...@@ -3325,45 +3325,55 @@ QString UAS::getAudioModeTextFor(int id) ...@@ -3325,45 +3325,55 @@ QString UAS::getAudioModeTextFor(int id)
return mode; 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. * The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given. * @return the short text of the mode for the id given.
*/ */
QString UAS::getShortModeTextFor(int id) QString UAS::getShortModeTextFor(int id)
{ {
QString mode; QString mode = "";
uint8_t modeid = id; uint8_t modeid = id;
qDebug() << "MODE:" << modeid;
// BASE MODE DECODING // BASE MODE DECODING
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO)
if (modeid == 0)
{ {
mode = "|PREFLIGHT";
}
else {
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO){
mode += "|AUTO"; mode += "|AUTO";
} }
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED)
{ if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL){
mode += "|MANUAL";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED){
mode += "|VECTOR"; mode += "|VECTOR";
} }
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE)
{ if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE){
mode += "|STABILIZED"; mode += "|STABILIZED";
} }
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST)
{
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST){
mode += "|TEST"; mode += "|TEST";
} }
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL)
{
mode += "|MANUAL";
}
else if (modeid == 0)
{
mode = "|PREFLIGHT";
} }
else
if (mode.length() == 0)
{ {
mode = "|UNKNOWN"; mode = "|UNKNOWN";
qDebug() << __FILE__ << __LINE__ << " Unknown modeid: " << modeid;
} }
// ARMED STATE DECODING // ARMED STATE DECODING
...@@ -3382,6 +3392,8 @@ QString UAS::getShortModeTextFor(int id) ...@@ -3382,6 +3392,8 @@ QString UAS::getShortModeTextFor(int id)
mode.prepend("HIL:"); mode.prepend("HIL:");
} }
qDebug() << "MODE: " << modeid << " " << mode;
return 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