Browse Source

unset values when sensors are lost

master
rico rico 5 years ago
parent
commit
b9fd753070
2 changed files with 10 additions and 0 deletions
  1. +1
    -0
      soft/thermostat/inc/mainwindow.h
  2. +9
    -0
      soft/thermostat/src/mainwindow.cpp

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

@ -36,6 +36,7 @@ private:
private slots:
void temperature_slot(unsigned idx, double val);
void hygro_slot(unsigned idx, double val);
void availability_slot(unsigned idx, bool ok);
};
#endif // MAINWINDOW_H


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

@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(mqttclient, SIGNAL(new_hygro(unsigned, double)),
this, SLOT(hygro_slot(unsigned, double)));
connect(mqttclient, SIGNAL(new_availability(unsigned, bool)),
this, SLOT(availability_slot(unsigned, bool)));
/*
* Sensors-related layout
*/
@ -77,5 +79,12 @@ void MainWindow::hygro_slot(unsigned idx, double val)
m_zones[idx]->set_hygro_value(val);
}
}
void MainWindow::availability_slot(unsigned idx, bool ok)
{
if ((idx < NB_ZONES) && !ok) {
m_zones[idx]->set_hygro_value(0);
m_zones[idx]->set_temperature_value(0);
}
}
/* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */

Loading…
Cancel
Save