Skip to content
Snippets Groups Projects
Commit 5261d110 authored by Peter Altenbernd's avatar Peter Altenbernd
Browse files

Für Info-Anzeige m_granted, sleep wieder raus

parent ee775bd4
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,8 @@ QString HeatControl::name() const
*/
void HeatControl::grant(bool ON)
{
m_granted = ON;
if (ON)
m_switch->ON();
else
......@@ -306,6 +308,15 @@ QString HeatControl::output() const
}
/*
*
*/
bool HeatControl::granted() const
{
return m_granted;
}
/*
*
......
......@@ -48,8 +48,6 @@ public:
virtual QString output() const;
signals:
protected:
friend class TestSHserver;
SHsensor * m_temp;
......@@ -67,6 +65,8 @@ protected:
int m_pos; // Hash-Adresse, zugleich ID
bool m_granted; // für aktuelle Anzeige in solarControl
enum class Suspension {NONE, MinTemp, MaxTemp};
Suspension m_suspended; // eine zeitlang true, wenn Temperatur erreicht ist
QDateTime m_expireTime;
......@@ -110,6 +110,8 @@ public:
QDateTime expireTime() const;
bool granted() const;
private:
static HeatControl * C[SHNodeIdSize * SHSensorIdSize];
static QFile m_file;
......
#include <QTimer>
#include "solarControl.h"
#include "webSocketMsg.h"
#include <unistd.h>
......@@ -120,34 +119,33 @@ void SolarControl::process() {
}
// qDebug() << "=> used=" << used;
// if ((supply > 0 and netto < 0) or (supply <= 0 and netto != supply))
// qDebug() << "brutto / netto FEHLER" << supply << netto;
s_output += " -> " + QString::number(used) + "/" + QString::number(supply);
qDebug() << "===> SolarControl::process" << s_output << " <===";
// if ((supply > 0 and netto < 0) or (supply <= 0 and netto != supply))
// qDebug() << "brutto / netto FEHLER" << supply << netto;
// einen Moment auf die Aktuatoren warten:
if (not SHsensor::isTesting())
sleep(1.5*SHsensor::POLLING_INTERVALL);
// Info-Anzeige:
// aktuelle Verbraucher
QStringList infoList;
QStringList infoList; // aktuelle Verbraucher
for (auto swtch : m_S)
if (swtch->state() == SHactuator::State::ON and swtch->demand() > 0) {
infoList << swtch->name() << QString::number(swtch->demand());
for (auto swtch : m_S) {
bool dynamic = (swtch->mode() == HeatControl::Mode::Auto or swtch->mode() == HeatControl::Mode::Smart);
bool dynamic = (swtch->mode() == HeatControl::Mode::Auto or swtch->mode() == HeatControl::Mode::Smart);
if (dynamic) {
if (swtch->granted())
infoList << swtch->name() << QString::number(swtch->demand());
} else {
if (swtch->state() == SHactuator::State::ON and swtch->demand() > 0) {
infoList << swtch->name() << QString::number(swtch->demand());
if (not dynamic) // für Anzeige nicht dynamische Verbraucher dazu rechnen
// für Anzeige nicht dynamische Verbraucher dazu rechnen
supply += swtch->demand();
}
}
}
// Anzeige setzen:
SHsensor::setSolarInfo(supply /* brutto */ , netto, infoList);
qDebug() << "===> SolarControl::process" << s_output << " <===";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment