Skip to content

Commit

Permalink
added DLT injection for setting voltage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmucde committed Jul 9, 2021
1 parent d3f6211 commit 89847f4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 13 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ The commands are interpreted independent of the service id.

* <Relais name> on/off/trigger
* <Power name> on/off
* VOLTAGE1 <value>
* VOLTAGE2 <value>

## Installation

Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down
22 changes: 11 additions & 11 deletions dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>906</width>
<height>788</height>
<width>922</width>
<height>723</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -84,21 +84,18 @@
<string>Value</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLineEdit" name="lineEditValueV1">
<item row="1" column="0">
<widget class="QLineEdit" name="lineEditValueA1">
<property name="font">
<font>
<family>Arial</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditUnitV1">
<item row="0" column="0">
<widget class="QLineEdit" name="lineEditValueV1">
<property name="font">
<font>
<family>Arial</family>
Expand All @@ -110,14 +107,17 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="lineEditValueA1">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditUnitV1">
<property name="font">
<font>
<family>Arial</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
Expand Down
16 changes: 16 additions & 0 deletions dltmultimeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ void DLTMultimeter::on()
if(type==1) // Mason HCS-3302 USB
{
serialPort.write("SOUT0\r");

qDebug() << "DLTMultimeter: power on";
}
}

Expand All @@ -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;
}
}
1 change: 1 addition & 0 deletions dltmultimeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 89847f4

Please sign in to comment.