diff --git a/src/ui/configuration/BatteryMonitorConfig.cc b/src/ui/configuration/BatteryMonitorConfig.cc index 5e74cedde21a4a1a71b0869b713dc93e816cadf9..05b6dc2343e896aa4ade956f4a51163f9fc5d6ec 100644 --- a/src/ui/configuration/BatteryMonitorConfig.cc +++ b/src/ui/configuration/BatteryMonitorConfig.cc @@ -32,6 +32,16 @@ BatteryMonitorConfig::BatteryMonitorConfig(QWidget *parent) : AP2ConfigWidget(pa } +void BatteryMonitorConfig::activeUASSet(UASInterface *uas) +{ + if (!uas) + { + return; + } + connect(uas,SIGNAL(batteryChanged(UASInterface*,double,double,double,int)),this,SLOT(batteryChanged(UASInterface*,double,double,double,int))); + AP2ConfigWidget::activeUASSet(uas); +} + void BatteryMonitorConfig::calcDividerSet() { if (!m_uas) @@ -222,6 +232,14 @@ void BatteryMonitorConfig::apmVerCurrentIndexChanged(int index) BatteryMonitorConfig::~BatteryMonitorConfig() { } +void BatteryMonitorConfig::batteryChanged(UASInterface* uas, double voltage, double current, double percent, int seconds) +{ + ui.calcVoltsLineEdit->setText(QString::number(voltage,'f',2)); + if (ui.measuredVoltsLineEdit->text() == "") + { + ui.measuredVoltsLineEdit->setText(ui.calcVoltsLineEdit->text()); + } +} void BatteryMonitorConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value) { diff --git a/src/ui/configuration/BatteryMonitorConfig.h b/src/ui/configuration/BatteryMonitorConfig.h index 183d782d236ab30fad476f0d6fcee5bc7a146421..2bbdb56f2ed7aa443802c2d98d532b1310b390e6 100644 --- a/src/ui/configuration/BatteryMonitorConfig.h +++ b/src/ui/configuration/BatteryMonitorConfig.h @@ -20,6 +20,8 @@ private slots: void calcDividerSet(); void ampsPerVoltSet(); void batteryCapacitySet(); + void activeUASSet(UASInterface *uas); + void batteryChanged(UASInterface* uas, double voltage, double current, double percent, int seconds); private: Ui::BatteryMonitorConfig ui; };