diff --git a/heatControl.cpp b/heatControl.cpp index c543468a4a2bbbc224674e662dbfff302efdb430..2a0a5c051922f7277bcaf683962ab7735b77d036 100644 --- a/heatControl.cpp +++ b/heatControl.cpp @@ -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; +} + + /* * diff --git a/heatControl.h b/heatControl.h index 8a4ea765b5a35395602fc3d348e5fe8c1eb988e8..2aa55659bef5a08df860fa6dc8c892c86d106dab 100644 --- a/heatControl.h +++ b/heatControl.h @@ -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; diff --git a/solarControl.cpp b/solarControl.cpp index 47f6ee65ece3cfe14c92c8af2ff24046b74c2e73..6d63f7ec4bcf52857e609513bcaafea9bd6e6757 100644 --- a/solarControl.cpp +++ b/solarControl.cpp @@ -1,7 +1,6 @@ #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 << " <==="; }