From e1459edd73d1dcdd6a18a74566ac23cfe45015f3 Mon Sep 17 00:00:00 2001 From: Alexander Wenzel Date: Sun, 15 May 2022 14:26:45 +0200 Subject: [PATCH] Cleanup current output --- README.md | 1 + dltmultimeter.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 55cc2ac..2c47de5 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ Github Sponsors: v0.1.4: +* Cleanup current output * Support OWON XDM1041 Multimeter v0.1.3: diff --git a/dltmultimeter.cpp b/dltmultimeter.cpp index 3fa7c29..e4802ff 100644 --- a/dltmultimeter.cpp +++ b/dltmultimeter.cpp @@ -218,8 +218,9 @@ void DLTMultimeter::readyRead() } else if(line.length()==9) { - float current = (QString("%1%2.%3%4").arg(line[4]).arg(line[5]).arg(line[6]).arg(line[7])).toFloat() - substractCurrent; - valueMultimeter(QString("%1").arg(current),"A"); + double current = (QString("%1%2.%3%4%5").arg(line[4]).arg(line[5]).arg(line[6]).arg(line[7]).arg(line[8])).toDouble() - substractCurrent; +// valueMultimeter(QString("%1").arg(current),"A"); + valueMultimeter(QString::number(current, 'f', 3),"A"); valueMultimeter(QString("%1%2.%3%4").arg(line[0]).arg(line[1]).arg(line[2]).arg(line[3]),"V"); readVoltageOngoing = false; if(!voltageCmd.isEmpty()) @@ -295,7 +296,8 @@ void DLTMultimeter::readyRead() { watchDogCounter++; double current = line.toFloat(); - valueMultimeter(QString("%1").arg(current,0,'g',3),"A"); +// valueMultimeter(QString("%1").arg(current,0,'g',3),"A"); + valueMultimeter(QString::number(current, 'f', 3),"A"); } serialData.remove(0,pos+1);