QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ServoOutputMonitorController.cc
Go to the documentation of this file.
2
4#include "Vehicle.h"
5
6QGC_LOGGING_CATEGORY(ServoOutputMonitorControllerLog, "QMLControls.ServoOutputMonitorController")
7
9 : FactPanelController(parent)
10{
11 (void) connect(_vehicle, &Vehicle::servoOutputsChanged, this, &ServoOutputMonitorController::servoValuesChanged);
12}
13
14ServoOutputMonitorController::~ServoOutputMonitorController()
15{
16}
17
18int ServoOutputMonitorController::servoValue(int servoIndex) const
19{
20 if (servoIndex >= 0 && servoIndex < _servoValues.size()) {
21 return _servoValues[servoIndex];
22 }
23
24 return -1;
25}
26
27void ServoOutputMonitorController::servoValuesChanged(QVector<int> pwmValues)
28{
29 const int servoCount = pwmValues.size();
30
31 _servoValues = pwmValues;
32
33 if (_servoCount != servoCount) {
34 _servoCount = servoCount;
35 emit servoCountChanged(_servoCount);
36 }
37
38 for (int servo = 0; servo < servoCount; servo++) {
39 emit servoValueChanged(servo, pwmValues[servo]);
40 }
41}
#define QGC_LOGGING_CATEGORY(name, categoryStr)
Used for handling missing Facts from C++ code.
void servoValueChanged(int servo, int pwmValue)
void servoCountChanged(int servoCount)
void servoOutputsChanged(QVector< int > servoValues)