diff --git a/ground/openpilotgcs/src/plugins/systemhealth/html/AlarmOK.html b/ground/openpilotgcs/src/plugins/systemhealth/html/AlarmOK.html new file mode 100644 index 000000000..fee48402f --- /dev/null +++ b/ground/openpilotgcs/src/plugins/systemhealth/html/AlarmOK.html @@ -0,0 +1,13 @@ + + + + + + + +

Alarm: OK

+

+ There are no problems with this alarm. +

+ + diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealth.qrc b/ground/openpilotgcs/src/plugins/systemhealth/systemhealth.qrc index 30256626f..7ef754ecc 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealth.qrc +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealth.qrc @@ -3,5 +3,28 @@ html/Actuator-Critical.html html/ManualControl-Critical.html html/ManualControl-Warning.html + html/CPU-Critical.html + html/CPU-Warning.html + html/FlightTime-Error.html + html/Battery-Warning.html + html/BootFault-Critical.html + html/EventSystem-Warning.html + html/FlightTime-Critical.html + html/AlarmOK.html + html/Attitude-Critical.html + html/Attitude-Error.html + html/Battery-Critical.html + html/Battery-Error.html + html/FlightTime-Warning.html + html/GPS-Critical.html + html/GPS-Error.html + html/GPS-Warning.html + html/Guidance-Warning.html + html/Memory-Critical.html + html/Memory-Warning.html + html/Sensors-Critical.html + html/Stabilization-Warning.html + html/Stack-Critical.html + html/Telemetry-Error.html diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index 1f14d86e6..cd7e9ac37 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -63,6 +63,7 @@ SystemHealthGadgetWidget::SystemHealthGadgetWidget(QWidget *parent) : QGraphicsV connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect())); + setToolTip(tr("Displays flight system errors. Click on an alarm for more information.")); } /** @@ -206,12 +207,31 @@ void SystemHealthGadgetWidget::mousePressEvent ( QMouseEvent * event ) QGraphicsSvgItem *clickedItem = dynamic_cast(sceneItem); if(clickedItem && (clickedItem != foreground) && clickedItem != background){ - QFile alarmDescription(":/systemhealth/html/" + clickedItem->elementId() + ".html"); - if(alarmDescription.open(QIODevice::ReadOnly | QIODevice::Text)){ - QTextStream textStream(&alarmDescription); - QWhatsThis::showText(event->globalPos(), textStream.readAll()); + // Clicked an actual alarm + QString itemId = clickedItem->elementId(); + if(itemId.contains("OK")){ + // No alarm set for this item + showAlarmDescriptionForItemId("AlarmOK", event->globalPos()); + }else{ + // Warning, error or critical alarm + showAlarmDescriptionForItemId(itemId, event->globalPos()); } + }else if(clickedItem){ + // Clicked foreground or background + showAllAlarmDescriptions(); } } } } + +void SystemHealthGadgetWidget::showAlarmDescriptionForItemId(const QString itemId, const QPoint& location){ + QFile alarmDescription(":/systemhealth/html/" + itemId + ".html"); + if(alarmDescription.open(QIODevice::ReadOnly | QIODevice::Text)){ + QTextStream textStream(&alarmDescription); + QWhatsThis::showText(location, textStream.readAll()); + } +} + +void SystemHealthGadgetWidget::showAllAlarmDescriptions(){ + +} diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.h b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.h index dc9284196..bb3d21db2 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.h @@ -69,5 +69,8 @@ private: // Simple flag to skip rendering if the bool fgenabled; // layer does not exist. + void showAlarmDescriptionForItemId(const QString itemId, const QPoint& location); + void showAllAlarmDescriptions(); + }; #endif /* SYSTEMHEALTHGADGETWIDGET_H_ */