diff --git a/README.md b/README.md index 7194b25..27f4d38 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,8 @@ The commands are interpreted independent of the service id. * on/off/trigger * on/off +* VOLTAGE1 +* VOLTAGE2 ## Installation @@ -138,6 +140,10 @@ Github Sponsors: ## Changes +v0.0.8: + +* added DLT injection for setting voltage + v0.0.7: * support new Relais Board Wemos D1 + 4 Relais shield diff --git a/dialog.cpp b/dialog.cpp index d0b2d75..297a873 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -837,7 +837,17 @@ void Dialog::injection(QString text) qDebug() << "Injection received: " << text; - if(dltRelais1.getRelaisName(1) == list[0]) + if(list[0]=="VOLTAGE1") + { + float value = list[1].toFloat(); + dltMultimeter1.setVoltage(value); + } + else if(list[0]=="VOLTAGE2") + { + float value = list[1].toFloat(); + dltMultimeter2.setVoltage(value); + } + else if(dltRelais1.getRelaisName(1) == list[0]) { if(list[1]=="on") { diff --git a/dialog.ui b/dialog.ui index 094371b..9c5f477 100644 --- a/dialog.ui +++ b/dialog.ui @@ -6,8 +6,8 @@ 0 0 - 906 - 788 + 922 + 723 @@ -84,21 +84,18 @@ Value - - + + Arial 16 - - true - - - + + Arial @@ -110,14 +107,17 @@ - - + + Arial 16 + + true + diff --git a/dltmultimeter.cpp b/dltmultimeter.cpp index 12504c2..d252558 100644 --- a/dltmultimeter.cpp +++ b/dltmultimeter.cpp @@ -430,6 +430,8 @@ void DLTMultimeter::on() if(type==1) // Mason HCS-3302 USB { serialPort.write("SOUT0\r"); + + qDebug() << "DLTMultimeter: power on"; } } @@ -438,5 +440,19 @@ void DLTMultimeter::off() if(type==1) // Mason HCS-3302 USB { serialPort.write("SOUT1\r"); + + qDebug() << "DLTMultimeter: power off"; + } +} + +void DLTMultimeter::setVoltage(float value) +{ + if(type==1) // Mason HCS-3302 USB + { + QString text; + text = QString("VOLT%1\r").arg((int)(value*10)); + serialPort.write(text.toLatin1()); + + qDebug() << "DLTMultimeter: setVoltage" << text; } } diff --git a/dltmultimeter.h b/dltmultimeter.h index 9a57dda..7c08acf 100644 --- a/dltmultimeter.h +++ b/dltmultimeter.h @@ -48,6 +48,7 @@ class DLTMultimeter : public QObject void on(); void off(); + void setVoltage(float value); QString getPowerName() { return powerName; } void setPowerName(const QString &powerName) { this->powerName = powerName; } diff --git a/version.h b/version.h index b0b8658..bd9d3c4 100644 --- a/version.h +++ b/version.h @@ -15,6 +15,6 @@ #ifndef VERSION_H #define VERSION_H -#define DLT_POWER_VERSION "v0.0.7" +#define DLT_POWER_VERSION "v0.0.8" #endif // VERSION_H