diff --git a/src/ui/watchdog/WatchdogControl.cc b/src/ui/watchdog/WatchdogControl.cc index d9ec97d..18a627b 100644 --- a/src/ui/watchdog/WatchdogControl.cc +++ b/src/ui/watchdog/WatchdogControl.cc @@ -9,6 +9,7 @@ WatchdogControl::WatchdogControl(QWidget *parent) : QWidget(parent), mav(NULL), + updateInterval(2000000), ui(new Ui::WatchdogControl) { ui->setupUi(this); @@ -43,14 +44,20 @@ void WatchdogControl::setUAS(UASInterface* uas) void WatchdogControl::updateWatchdog(int systemId, int watchdogId, unsigned int processCount) { // request the watchdog with the given ID + // Get the watchdog and request the info for it WatchdogInfo& watchdog = this->getWatchdog(systemId, watchdogId); // if the proces count doesn't match, the watchdog is either new or has changed - create a new vector with new (and empty) ProcessInfo structs. if (watchdog.processes_.size() != processCount) + { watchdog.processes_ = std::vector(processCount); + // Create new UI widget + //WatchdogView* view = new Watch + } // start the timeout timer //watchdog.timeoutTimer_.reset(); + qDebug() << "WATCHDOG RECEIVED"; //qDebug() << "<-- received mavlink_watchdog_heartbeat_t " << msg->sysid << " / " << payload.watchdog_id << " / " << payload.process_count << std::endl; } diff --git a/src/ui/watchdog/WatchdogControl.h b/src/ui/watchdog/WatchdogControl.h index a91574b..4ad6510 100644 --- a/src/ui/watchdog/WatchdogControl.h +++ b/src/ui/watchdog/WatchdogControl.h @@ -67,6 +67,7 @@ public: uint16_t crashes_; ///< The number of crashes int32_t pid_; ///< The PID of the process + //quint64_t requestTimeout; // Timer requestTimer_; ///< Internal timer, used to repeat status and info requests after some time (in case of packet loss) // Timer updateTimer_; ///< Internal timer, used to measure the time since the last update (used only for graphics) }; @@ -92,6 +93,7 @@ public: ProcessInfo& getProcess(uint16_t index); std::vector processes_; ///< A vector containing all processes running on this watchdog + uint64_t timeout; QTimer* timeoutTimer_; ///< Internal timer, used to measure the time since the last heartbeat message }; @@ -116,6 +118,7 @@ protected: UASInterface* mav; QVBoxLayout* listLayout; + uint64_t updateInterval; private: Ui::WatchdogControl *ui;