From 3732645d967edd35687a4b05580987b4b95b0e66 Mon Sep 17 00:00:00 2001 From: Mariano Lizarraga Date: Sat, 5 Mar 2011 12:21:15 -0600 Subject: [PATCH] Added support for parameter interface to SLUGS --- src/uas/SlugsMAV.cc | 25 +++++++++++++++++++++---- src/uas/SlugsMAV.h | 19 +++++++++++++++++++ src/uas/UASWaypointManager.cc | 2 +- src/ui/SlugsDataSensorView.ui | 2 +- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc index 0831479456..7c71867229 100644 --- a/src/uas/SlugsMAV.cc +++ b/src/uas/SlugsMAV.cc @@ -90,10 +90,6 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) mavlink_msg_gps_raw_decode(&message, &mlGpsData); break; - case MAVLINK_MSG_ID_ACTION_ACK: // 62 - mavlink_msg_action_ack_decode(&message,&mlActionAck); - break; - case MAVLINK_MSG_ID_CPU_LOAD: //170 mavlink_msg_cpu_load_decode(&message,&mlCpuLoadData); break; @@ -151,6 +147,27 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) break; case MAVLINK_MSG_ID_SLUGS_ACTION: //183 + mavlink_msg_slugs_action_decode(&message, &mlAction); + + switch (mlAction.actionId){ + case SLUGS_ACTION_EEPROM: + if (mlAction.actionVal == SLUGS_ACTION_FAIL){ + emit textMessageReceived(message.sysid, message.compid, 255, "EEPROM Write Fail, Data was not saved in Memory!"); + } + break; + + case SLUGS_ACTION_PT_CHANGE: + if (mlAction.actionVal == SLUGS_ACTION_SUCCESS){ + emit textMessageReceived(message.sysid, message.compid, 0, "Passthrough Succesfully Changed"); + } + break; + + case SLUGS_ACTION_MLC_CHANGE: + if (mlAction.actionVal == SLUGS_ACTION_SUCCESS){ + emit textMessageReceived(message.sysid, message.compid, 0, "Mid-level Commands Succesfully Changed"); + } + break; + }// switch actionId break; diff --git a/src/uas/SlugsMAV.h b/src/uas/SlugsMAV.h index 99669fdaa5..28d0a1b6bd 100644 --- a/src/uas/SlugsMAV.h +++ b/src/uas/SlugsMAV.h @@ -33,6 +33,25 @@ class SlugsMAV : public UAS { Q_OBJECT Q_INTERFACES(UASInterface) + + enum SLUGS_ACTION { + SLUGS_ACTION_NONE, + SLUGS_ACTION_SUCCESS, + SLUGS_ACTION_FAIL, + SLUGS_ACTION_EEPROM, + SLUGS_ACTION_MODE_CHANGE, + SLUGS_ACTION_MODE_REPORT, + SLUGS_ACTION_PT_CHANGE, + SLUGS_ACTION_PT_REPORT, + SLUGS_ACTION_PID_CHANGE, + SLUGS_ACTION_PID_REPORT, + SLUGS_ACTION_WP_CHANGE, + SLUGS_ACTION_WP_REPORT, + SLUGS_ACTION_MLC_CHANGE, + SLUGS_ACTION_MLC_REPORT + }; + + public: SlugsMAV(MAVLinkProtocol* mavlink, int id = 0); diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 15a5adc3bf..d9a0ed3092 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -138,7 +138,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ if(wp->seq == current_wp_id) { - //qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_CMD) wp->command; + //qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << "Frame:"<< (MAV_FRAME) wp->frame << "Command:" << (MAV_CMD) wp->command; Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); addWaypoint(lwp, false); diff --git a/src/ui/SlugsDataSensorView.ui b/src/ui/SlugsDataSensorView.ui index 41bff8ec5e..577964de46 100644 --- a/src/ui/SlugsDataSensorView.ui +++ b/src/ui/SlugsDataSensorView.ui @@ -35,7 +35,7 @@ - 1 + 0 -- GitLab