Browse Source

Thermostat: force ON/OFF is working

master
Richard Genoud 4 years ago
parent
commit
d368a9e65d
2 changed files with 14 additions and 0 deletions
  1. +2
    -0
      soft/thermostat/inc/mainwindow.h
  2. +12
    -0
      soft/thermostat/src/mainwindow.cpp

+ 2
- 0
soft/thermostat/inc/mainwindow.h View File

@ -37,6 +37,7 @@ private:
MQTTClient *m_mqtt;
QPushButton m_state_btn;
QVector<ZoneItem *> m_zones;
QTimer *m_timer;
enum power_states m_pwr_state;
void update_state_btn(enum power_states st);
@ -45,6 +46,7 @@ private slots:
void hygro_slot(int idx, double val);
void availability_slot(int idx, bool ok);
void change_state(void);
void apply_order_to_heaters(void);
signals:
void setAllHeatersOn(bool on);


+ 12
- 0
soft/thermostat/src/mainwindow.cpp View File

@ -77,6 +77,13 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, SIGNAL(setAllHeatersOn(bool)), m_mqtt, SLOT(allHeatersOn(bool)));
connect(&m_state_btn, SIGNAL(clicked()), this, SLOT(change_state()));
/*
* Heater timer
*/
m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(apply_order_to_heaters()));
m_timer->start(600000);
}
MainWindow::~MainWindow()
@ -119,6 +126,11 @@ void MainWindow::change_state(void)
update_state_btn(m_pwr_state);
apply_order_to_heaters();
}
void MainWindow::apply_order_to_heaters(void)
{
switch (m_pwr_state) {
case ON:
emit setAllHeatersOn(true);


Loading…
Cancel
Save