From 5261d110358d3bb895ee9da28ce2e7d4ebb0bee7 Mon Sep 17 00:00:00 2001 From: Peter Altenbernd <peter.altenbernd@h-da.de> Date: Mon, 26 May 2025 11:04:30 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCr=20Info-Anzeige=20m=5Fgranted,=20sleep?= =?UTF-8?q?=20wieder=20raus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- heatControl.cpp | 11 +++++++++++ heatControl.h | 6 ++++-- solarControl.cpp | 34 ++++++++++++++++------------------ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/heatControl.cpp b/heatControl.cpp index c543468..2a0a5c0 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 8a4ea76..2aa5565 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 47f6ee6..6d63f7e 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 << " <==="; } -- GitLab