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