Skip to content

Commit

Permalink
wat
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLortex committed Aug 27, 2014
1 parent b015698 commit 670bd04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
9 changes: 4 additions & 5 deletions InPut/cookiedecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CookieDecoder::CookieDecoder(){}


void CookieDecoder::decodeString(QByteArray(&data)) {
qDebug() << "data size: " << data.size() ;
if(data.size() < 41)
return;

Expand Down Expand Up @@ -67,8 +66,8 @@ void CookieDecoder::decodeString(QByteArray(&data)) {
if(elements.size()>1) {
emit message("Trame incomplète");
qDebug() << "Trame incomplete";
emit trame_erreur(1);
}
emit trame_erreur(1);
return;
}

Expand All @@ -80,9 +79,9 @@ void CookieDecoder::decodeString(QByteArray(&data)) {

bool checkLeSum = false;

int numCapteur = elements[1].toInt();
double valeur = elements[3].toDouble();
int numValeur = elements[2].toInt();
int numCapteur = elements[1].trimmed().toInt();
double valeur = elements[3].trimmed().toDouble();
int numValeur = elements[2].trimmed().toInt();

emit message("Checksum comparison: "+QString::number((int)checkSum)+" | "+QString::number(QString(elements[4]).toInt(0,16)));
if((((int)checkSum == QString(elements[4]).toInt(0,16))||(!checkLeSum))){
Expand Down
10 changes: 6 additions & 4 deletions InPut/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,25 @@ void Serial::balayageFrequenciel() { // 05#42#43#12#19#15#23#53#35#17
doingBalayage = true;


time.start();
data.clear();
balayage_buffer.clear();

QString str = "$S";
str = str+ QChar(0x0D) + QChar(0x0A);
serial_port->write(str.toStdString().c_str());
serial_port->waitForBytesWritten(2000);
data.clear();
balayage_buffer.clear();

time.start();
}

void Serial::readDataBalayage() {
int nvalues = 9;
int nvalues = 30;


data_read = serial_port->readAll();
qDebug() << "read:";
qDebug() << data_read;
qDebug() << "time elapsed: " << time.elapsed();

balayage_buffer.append(data_read);
content = balayage_buffer.split('#');
Expand Down
4 changes: 2 additions & 2 deletions conf/cplist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<value name="Valeur" unit="" id="0" />
</sensor>
<sensor name="Chamallow" id="2">
<value name="Pression" unit="mm" id="0" coef="((x>178)*(0.000001157*x*x - 0.0025x + 1.361) + ((179>x)*(26.7264754293*x^(-0.6344255783))))*10" />
<value name="Distance" unit="mm" id="0" coef="((x>178)*(0.000001157*x*x - 0.0025x + 1.361) + ((179>x)*(26.7264754293*x^(-0.6344255783))))*10" />
</sensor>
<sensor name="Pression Coca" id="3">
<value name="Valeur" unit="hPa" id="0" coef="((x*107.4396437)+11336.0291415)/100" />
Expand All @@ -30,6 +30,6 @@
<value name="Concentation" unit="" id="0" />
</sensor>
<sensor name="Température extérieure" id="9">
<value name="Concentation" unit="°C" id="0" coef="1 / (0.001129148 + (0.000234125 + (0.0000000876741 * log((10240000/x) - 10000) * log((10240000/x) - 10000) ))* log((10240000/x) - 10000) ) - 273.15"/>
<value name="Valeur" unit="°C" id="0" coef="1 / (0.001129148 + (0.000234125 + (0.0000000876741 * log((10240000/x) - 10000) * log((10240000/x) - 10000) ))* log((10240000/x) - 10000) ) - 273.15"/>
</sensor>
</sensorlist>

0 comments on commit 670bd04

Please sign in to comment.