src/DetailFermenter.cpp

Thu, 25 Apr 2024 13:16:48 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 25 Apr 2024 13:16:48 +0200
changeset 524
6fb367b13ffb
parent 492
c3a781b4d35b
permissions
-rw-r--r--

Version 0.4.5. Adjusted for newer generation thermferm controllers.

317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * DetailFermenter.cpp is part of bmsapp.
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "DetailFermenter.h"
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
18 #include "ChartFermenter.h"
391
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
19 #include "Webcam.h"
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "../ui/ui_DetailFermenter.h"
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
21 #include "global.h"
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 #include "MainWindow.h"
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
25 /*
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
26 * Results are available via MySQL and websockets. Because we initialize using
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
27 * MySQL we only use that for the results and up to date status.
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
28 * Commands are send via websockets only.
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
29 */
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
30
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 DetailFermenter::DetailFermenter(int id, QWidget *parent) : QDialog(parent), ui(new Ui::DetailFermenter)
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 {
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
33 QSqlQuery query;
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
34
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 ui->setupUi(this);
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 this->recno = id;
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
37 setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
38 setWindowTitle(tr("BMSapp - Details Fermenter"));
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
40 ui->airThermo->setMaximum(40.0);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
41 ui->airThermo->setNominal(15.0);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
42 ui->airThermo->setCritical(20.0);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
43 ui->airThermo->setSuffix(QString("°C"));
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
44
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
45 ui->beerThermo->setMaximum(40.0);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
46 ui->beerThermo->setNominal(15.0);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
47 ui->beerThermo->setCritical(20.0);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
48 ui->beerThermo->setSuffix(QString("°C"));
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
49
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
50 ui->chillerThermo->setMinimum(-15.0);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
51 ui->chillerThermo->setMaximum(25.0);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
52 ui->chillerThermo->setNominal(0.0);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
53 ui->chillerThermo->setCritical(15.0);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
54 ui->chillerThermo->setSuffix(QString("°C"));
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
55
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
56 ui->modeEdit->addItem("OFF");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
57 ui->modeEdit->addItem("NONE");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
58 ui->modeEdit->addItem("FRIDGE");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
59 ui->modeEdit->addItem("BEER");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
60 ui->modeEdit->addItem("PROFILE");
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
62 ui->stageEdit->addItem("PRIMARY");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
63 ui->stageEdit->addItem("SECONDARY");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
64 ui->stageEdit->addItem("TERTIARY");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
65 ui->stageEdit->addItem("CARBONATION");
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66
415
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
67 ui->codePick->addItem("Erase beer");
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
68 query.exec("SELECT code,name FROM products WHERE stage='1' OR stage='2' OR stage='3' OR stage='4' OR stage='5' OR stage='6' OR stage='7' ORDER BY code");
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
69 while (query.next()) {
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
70 ui->codePick->addItem(query.value("code").toString()+" - "+query.value("name").toString());
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
71 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
72
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
73 ui->profilePick->addItem(tr("Erase profile"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
74 query.exec("SELECT name FROM profile_fermentation ORDER BY name");
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
75 while (query.next()) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
76 ui->profilePick->addItem(query.value("name").toString());
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
77 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
78
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
79 connect(ui->loEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &DetailFermenter::lo_changed);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
80 connect(ui->hiEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &DetailFermenter::hi_changed);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
81 connect(ui->heatSwitch, SIGNAL(clicked()), this, SLOT(heat_switched()));
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
82 connect(ui->coolSwitch, SIGNAL(clicked()), this, SLOT(cool_switched()));
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
83 connect(ui->fanSwitch, SIGNAL(clicked()), this, SLOT(fan_switched()));
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
84 connect(ui->modeButton1, SIGNAL(clicked()), this, SLOT(button1_pressed()));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
85 connect(ui->modeButton2, SIGNAL(clicked()), this, SLOT(button2_pressed()));
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
86 connect(ui->modeEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::mode_changed);
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
87 connect(ui->stageEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::stage_changed);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
88 connect(ui->codePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::code_changed);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
89 connect(ui->profilePick, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DetailFermenter::profile_changed);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
90 connect(parent, SIGNAL(updateFermenter(QString)), this, SLOT(refreshFermenter(QString)));
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 emit refreshTable();
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 void DetailFermenter::refreshTable()
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 QSqlQuery query;
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
99 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
100 qDebug() << "refreshTable fermenter rec:" << this->recno;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
101 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
102
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
103 QIcon icon_done, icon_start, icon_abort, icon_pause, icon_cont;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
104 icon_done.addFile(QString::fromUtf8(":icons/silk/accept.png"), QSize(), QIcon::Normal, QIcon::Off);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
105 icon_start.addFile(QString::fromUtf8(":icons/silk/resultset_next.png"), QSize(), QIcon::Normal, QIcon::Off);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
106 icon_abort.addFile(QString::fromUtf8(":icons/silk/bomb.png"), QSize(), QIcon::Normal, QIcon::Off);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
107 icon_pause.addFile(QString::fromUtf8(":icons/silk/cup.png"), QSize(), QIcon::Normal, QIcon::Off);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
108 icon_cont.addFile(QString::fromUtf8(":icons/silk/cup_go.png"), QSize(), QIcon::Normal, QIcon::Off);
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 query.prepare("SELECT * FROM mon_fermenters WHERE record = :recno");
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 query.bindValue(":recno", this->recno);
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 query.exec();
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 if (query.next()) {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
115 const QSignalBlocker blocker1(ui->codePick);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
116 const QSignalBlocker blocker2(ui->modeEdit);
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
117 const QSignalBlocker blocker3(ui->loEdit);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
118 const QSignalBlocker blocker4(ui->hiEdit);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
119 const QSignalBlocker blocker5(ui->stageEdit);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
120
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
121 _node = query.value("node").toString();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
122 _alias = query.value("alias").toString();
328
ee2c8b29f389 Added CO2 meter monitor detail screen.
Michiel Broek <mbroek@mbse.eu>
parents: 325
diff changeset
123 _uuid = query.value("uuid").toString();
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
124 _beercode = query.value("beercode").toString();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
125 _beername = query.value("beername").toString();
391
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
126 _webcam_url = query.value("webcam_url").toString();
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
127 _webcam_light = query.value("webcam_light").toInt();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
128
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
129 QString mode = query.value("mode").toString();
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
130 QString stage = query.value("stage").toString();
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
131 bool online = (query.value("online").toInt() != 0) ? true:false;
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
132 bool alarm = (query.value("alarm").toInt() != 0) ? true:false;
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
133
328
ee2c8b29f389 Added CO2 meter monitor detail screen.
Michiel Broek <mbroek@mbse.eu>
parents: 325
diff changeset
134 ui->uuidEdit->setText(_uuid);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
135 ui->systemEdit->setText(_node+"/"+_alias);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
136 ui->codePick->setItemText(0, _alias.toUpper()+" - "+_alias);
318
ff02aca2b63c Removed LED plugin, now using the one from the AnalogWidgets.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
137
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
138 if (online) {
318
ff02aca2b63c Removed LED plugin, now using the one from the AnalogWidgets.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
139 ui->statusEdit->setText(tr("Online"));
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
140 ui->statusEdit->setStyleSheet("");
415
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
141 ui->codeEdit->show();
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
142 ui->codeEdit->setText(_beercode+" - "+_beername);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
143 ui->airThermo->setNominal(query.value("yeast_lo").toDouble());
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
144 ui->airThermo->setCritical(query.value("yeast_hi").toDouble());
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
145 ui->beerThermo->setNominal(query.value("yeast_lo").toDouble());
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
146 ui->beerThermo->setCritical(query.value("yeast_hi").toDouble());
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
147
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
148 ui->modeEdit->show();
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
149 if (mode == "OFF")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
150 ui->modeEdit->setCurrentIndex(0);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
151 else if (mode == "NONE")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
152 ui->modeEdit->setCurrentIndex(1);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
153 else if (mode == "FRIDGE")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
154 ui->modeEdit->setCurrentIndex(2);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
155 else if (mode == "BEER")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
156 ui->modeEdit->setCurrentIndex(3);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
157 else if (mode == "PROFILE")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
158 ui->modeEdit->setCurrentIndex(4);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
159
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
160 ui->stageEdit->show();
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
161 if (stage == "PRIMARY")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
162 ui->stageEdit->setCurrentIndex(0);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
163 else if (stage == "SECONDARY")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
164 ui->stageEdit->setCurrentIndex(1);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
165 else if (stage == "TERTIARY")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
166 ui->stageEdit->setCurrentIndex(2);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
167 else if (stage == "CARBONATION")
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
168 ui->stageEdit->setCurrentIndex(3);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
169
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
170 if (query.value("door_address").toString().length() == 36) {
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
171 ui->doorLED->show();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
172 ui->doorLabel->show();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
173 ui->doorLED->setChecked((query.value("door_state").toInt() != 0) ? true:false);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
174 } else {
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
175 ui->doorLED->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
176 ui->doorLabel->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
177 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
178
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
179 if (query.value("light_address").toString().length() == 36) {
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
180 ui->lightLED->show();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
181 ui->lightLabel->show();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
182 ui->lightLED->setChecked((query.value("light_state").toInt() != 0) ? true:false);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
183 } else {
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
184 ui->lightLED->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
185 ui->lightLabel->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
186 }
318
ff02aca2b63c Removed LED plugin, now using the one from the AnalogWidgets.
Michiel Broek <mbroek@mbse.eu>
parents: 317
diff changeset
187
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
188 if (mode == "OFF") {
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 ui->powerLED->setChecked(false);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
190 ui->codePick->show();
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 } else {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 ui->powerLED->setChecked(true);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
193 ui->codePick->hide();
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 }
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
195 ui->alarmLED->setChecked(alarm);
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
197 ui->tempsetBox->show();
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
198 if ((mode == "OFF") || (mode == "NONE")) {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
199 ui->loEdit->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
200 ui->loLabel->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
201 ui->hiEdit->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
202 ui->hiLabel->hide();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
203 } else {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
204 ui->loEdit->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
205 ui->loLabel->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
206 ui->hiEdit->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
207 ui->hiLabel->show();
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
208 if ((mode == "FRIDGE") || (mode == "BEER")) {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
209 ui->loEdit->setReadOnly(false);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
210 ui->loEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
211 ui->hiEdit->setReadOnly(false);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
212 ui->hiEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
213 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
214 ui->loEdit->setReadOnly(true);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
215 ui->loEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
216 ui->hiEdit->setReadOnly(true);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
217 ui->hiEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
218 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
219 lo_set = query.value("setpoint_low").toDouble();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
220 hi_set = query.value("setpoint_high").toDouble();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
221 ui->loEdit->setValue(lo_set);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
222 ui->hiEdit->setValue(hi_set);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
223 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
224
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
225 ui->switchBox->show();
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
226 if (query.value("heater_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
227 ui->heatLED->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
228 ui->heatLabel->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
229 ui->heatLED->setChecked((query.value("heater_state").toInt() != 0) ? true:false);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
230 if (mode == "NONE") {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
231 ui->heatSwitch->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
232 heat_state = (query.value("heater_state").toInt()) ? true:false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
233 ui->heatSwitch->setChecked(heat_state);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
234 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
235 ui->heatSwitch->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
236 heat_state = false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
237 }
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
238 } else {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
239 ui->heatLED->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
240 ui->heatLabel->hide();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
241 ui->heatSwitch->hide();
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
242 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
243 if (query.value("cooler_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
244 ui->coolLED->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
245 ui->coolLabel->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
246 ui->coolLED->setChecked((query.value("cooler_state").toInt() != 0) ? true:false);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
247 if (mode == "NONE") {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
248 ui->coolSwitch->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
249 cool_state = (query.value("cooler_state").toInt()) ? true:false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
250 ui->coolSwitch->setChecked(cool_state);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
251 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
252 ui->coolSwitch->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
253 cool_state = false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
254 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
255 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
256 ui->coolLED->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
257 ui->coolLabel->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
258 ui->coolSwitch->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
259 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
260 if (query.value("fan_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
261 ui->fanLED->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
262 ui->fanLabel->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
263 ui->fanLED->setChecked((query.value("fan_state").toInt() != 0) ? true:false);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
264 if (mode == "NONE") {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
265 ui->fanSwitch->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
266 fan_state = (query.value("fan_state").toInt()) ? true:false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
267 ui->fanSwitch->setChecked(fan_state);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
268 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
269 ui->fanSwitch->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
270 fan_state = false;
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
271 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
272 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
273 ui->fanLED->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
274 ui->fanLabel->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
275 ui->fanSwitch->hide();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
276 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
277
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
278 if (query.value("profile_name").toString() == "") {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
279 qobject_cast<QStandardItemModel*>(ui->modeEdit->model())->item(4)->setEnabled(false);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
280 } else {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
281 qobject_cast<QStandardItemModel*>(ui->modeEdit->model())->item(4)->setEnabled(true);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
282 }
415
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
283 ui->profileEdit->show();
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
284 ui->profileEdit->setText(query.value("profile_name").toString());
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
285
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
286 if (mode == "PROFILE") {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
287 _profile = query.value("profile_state").toString(); // So we know the profile state anywhere.
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
288 #ifdef DEBUG_MONITOR
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
289 qDebug() << "profile state" << _profile;
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
290 #endif
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
291 if (_profile == "OFF") {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
292 ui->profilePick->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
293 ui->profileShow->hide(); // Both on the same location.
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
294 ui->modeButton1->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
295 ui->modeButton1->setText(tr("Start"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
296 ui->modeButton1->setIcon(icon_start);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
297 ui->modeButton2->hide();
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
298 } else if (_profile == "RUN") {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
299 ui->profilePick->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
300 ui->profileShow->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
301 ui->profileShow->setText(QString(tr("Profile active %1% done")).arg(query.value("profile_percent").toDouble()));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
302 ui->modeButton1->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
303 ui->modeButton1->setText(tr("Abort"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
304 ui->modeButton1->setIcon(icon_abort);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
305 ui->modeButton2->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
306 ui->modeButton2->setText(tr("Pause"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
307 ui->modeButton2->setIcon(icon_pause);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
308 } else if (_profile == "PAUSE") {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
309 ui->profilePick->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
310 ui->profileShow->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
311 ui->profileShow->setText(QString(tr("Profile paused %1% done")).arg(query.value("profile_percent").toDouble()));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
312 ui->modeButton1->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
313 ui->modeButton1->setText(tr("Abort"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
314 ui->modeButton1->setIcon(icon_abort);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
315 ui->modeButton2->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
316 ui->modeButton2->setText(tr("Continue"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
317 ui->modeButton2->setIcon(icon_cont);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
318 } else if (_profile == "DONE") {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
319 ui->profilePick->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
320 ui->profileShow->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
321 ui->profileShow->setText(QString(tr("Profile ready")));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
322 ui->modeButton1->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
323 ui->modeButton1->setText(tr("Profile Ok"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
324 ui->modeButton1->setIcon(icon_done);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
325 ui->modeButton2->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
326 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
327 } else {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
328 ui->profilePick->show();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
329 ui->profileShow->hide(); // Both on the same location.
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
330 ui->modeButton1->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
331 ui->modeButton2->hide();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
332 _profile = QString("");
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
333 }
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
334
391
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
335 if (_webcam_url == "") {
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
336 ui->camButton->hide();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
337 } else {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
338 ui->camButton->show();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
339 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
340
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
341 ui->thermoBox->show();
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
342 if (query.value("air_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
343 ui->airThermo->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
344 ui->airLabel->show();
524
6fb367b13ffb Version 0.4.5. Adjusted for newer generation thermferm controllers.
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
345 if ((query.value("air_state").toString() == "OK") || (query.value("air_state").toString() == "YES")) {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
346 ui->airThermo->setValue(query.value("air_temperature").toDouble());
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
347 } else {
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
348 ui->airThermo->setValue(NAN);
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
349 }
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
350 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
351 ui->airThermo->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
352 ui->airLabel->hide();
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 }
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
354 if (query.value("beer_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
355 ui->beerThermo->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
356 ui->beerLabel->show();
524
6fb367b13ffb Version 0.4.5. Adjusted for newer generation thermferm controllers.
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
357 if ((query.value("beer_state").toString() == "OK") || (query.value("beer_state").toString() == "YES")) {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
358 ui->beerThermo->setValue(query.value("beer_temperature").toDouble());
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
359 } else {
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
360 ui->beerThermo->setValue(NAN);
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
361 }
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
362 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
363 ui->beerThermo->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
364 ui->beerLabel->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
365 }
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
366 if (query.value("chiller_address").toString().length() == 36) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
367 ui->chillerThermo->show();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
368 ui->chillerLabel->show();
524
6fb367b13ffb Version 0.4.5. Adjusted for newer generation thermferm controllers.
Michiel Broek <mbroek@mbse.eu>
parents: 492
diff changeset
369 if ((query.value("chiller_state").toString() == "OK") || (query.value("chiller_state").toString() == "YES")) {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
370 ui->chillerThermo->setValue(query.value("chiller_temperature").toDouble());
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
371 } else {
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
372 ui->chillerThermo->setValue(NAN);
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
373 }
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
374 } else {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
375 ui->chillerThermo->hide();
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
376 ui->chillerLabel->hide();
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
377 }
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 } else {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 /* Offline */
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
381 ui->statusEdit->setText(tr("Offline"));
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
382 ui->statusEdit->setStyleSheet("background-color: red");
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 ui->powerLED->setChecked(false);
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 ui->alarmLED->setChecked(true);
415
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
385 ui->codeEdit->hide();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
386 ui->codePick->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
387 ui->modeEdit->hide();
415
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
388 ui->profileEdit->hide();
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
389 ui->profileShow->hide();
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
390 ui->profilePick->hide();
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
391 ui->modeButton1->hide();
dd4ab5c2a8e5 Handle choose beer if it needs to be cleared better. Fixed unit offline view
Michiel Broek <mbroek@mbse.eu>
parents: 414
diff changeset
392 ui->modeButton2->hide();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
393 ui->stageEdit->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
394 ui->thermoBox->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
395 ui->tempsetBox->hide();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
396 ui->switchBox->hide();
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
397 ui->camButton->hide();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
398 ui->logButton->hide();
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 DetailFermenter::~DetailFermenter()
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 delete ui;
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 emit entry_changed();
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 /*
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
412 * Receive signals destined for all fermenters.
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
413 * Check if the signal is for us.
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 */
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
415 void DetailFermenter::refreshFermenter(QString data)
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 {
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
417 if (_node+"/"+_alias == data) {
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
418 emit refreshTable();
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
419 }
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 }
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
423 void DetailFermenter::on_logButton_clicked()
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
424 {
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
425 ChartFermenter dialog(_beercode, _beername, this);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
426 }
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
427
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents: 328
diff changeset
428
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
429 void DetailFermenter::on_camButton_clicked()
391
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
430 {
489
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
431 if (_webcam_light) {
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
432 QString msg = QString("{\"device\":\"fermenters\",\"node\":\""+_node+"\",\"unit\":\""+_alias+"\",\"light_state\":100}");
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
433 webSocket->sendTextMessage(msg);
4db768aea3df Fixed error messages about log and camera buttons. Only show items that are really used.
Michiel Broek <mbroek@mbse.eu>
parents: 415
diff changeset
434 }
391
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
435 Webcam dialog(_webcam_url, this);
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
436 }
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
437
42936c86cbac Initial webcam interface for fermenter view
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
438
317
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 void DetailFermenter::on_quitButton_clicked()
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 {
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 this->close();
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 this->setResult(1);
f78827503fb0 Added DetailFermenter screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 }
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
444
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
445
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
446 void DetailFermenter::lo_changed(double val)
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
447 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
448 double hi = ui->hiEdit->value();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
449
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
450 if (val >= hi)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
451 hi = val + 0.1;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
452 QString msg = QString("{\"device\":\"fermenters\",\"node\":\""+_node+"\",\"unit\":\""+_alias+"\",\"setpoint_low\":%1,\"setpoint_high\":%2}")
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
453 .arg(val, 2, 'f', 1, '0').arg(hi, 2, 'f', 1, '0');
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
454 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
455 qDebug() << "lo_changed" << val << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
456 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
457 webSocket->sendTextMessage(msg);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
458 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
459
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
460
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
461 void DetailFermenter::hi_changed(double val)
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
462 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
463 double lo = ui->loEdit->value();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
464
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
465 if (val <= lo)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
466 lo = val - 0.1;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
467 QString msg = QString("{\"device\":\"fermenters\",\"node\":\""+_node+"\",\"unit\":\""+_alias+"\",\"setpoint_low\":%1,\"setpoint_high\":%2}")
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
468 .arg(lo, 2, 'f', 1, '0').arg(val, 2, 'f', 1, '0');
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
469 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
470 qDebug() << "hi_changed" << val << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
471 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
472 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
473 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
474
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
475
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
476 void DetailFermenter::send_switches()
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
477 {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
478 QString msg=QString("{\"device\":\"fermenters\",\"node\":\""+_node+"\",\"unit\":\""+_alias+"\",\"heater_state\":%1,\"cooler_state\":%2,\"fan_state\":%3}")
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
479 .arg((heat_state)?100:0).arg((cool_state)?100:0).arg((fan_state)?100:0);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
480 webSocket->sendTextMessage(msg);
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
481 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
482
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
483
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
484 void DetailFermenter::heat_switched()
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
485 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
486 heat_state = !heat_state;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
487 cool_state = false;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
488 send_switches();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
489 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
490
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
491
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
492 void DetailFermenter::cool_switched()
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
493 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
494 cool_state = !cool_state;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
495 heat_state = false;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
496 send_switches();
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
497 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
498
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
499
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
500 void DetailFermenter::fan_switched()
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
501 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
502 fan_state = !fan_state;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
503 send_switches();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
504 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
505
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
506
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
507 void DetailFermenter::button1_pressed()
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
508 {
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
509 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
510 qDebug() << "button1" << _profile;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
511 #endif
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
512
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
513 if (_profile == "OFF") {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
514 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"profile\":{\"command\":\"start\"}}");
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
515 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
516 qDebug() << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
517 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
518 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
519 return;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
520 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
521
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
522 if ((_profile == "RUN") || (_profile == "PAUSE")) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
523 int rc = QMessageBox::warning(this, tr("Profile running"), tr("Profile is active, really abort?"),
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
524 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
525 if (rc == QMessageBox::Yes) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
526 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"profile\":{\"command\":\"abort\"}}");
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
527 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
528 qDebug() << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
529 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
530 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
531 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
532 return;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
533 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
534
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
535 if (_profile == "DONE") {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
536 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"profile\":{\"command\":\"done\"}}");
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
537 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
538 qDebug() << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
539 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
540 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
541 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
542 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
543
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
544
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
545 void DetailFermenter::button2_pressed()
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
546 {
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
547 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
548 qDebug() << "button2" << _profile;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
549 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
550
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
551 if ((_profile == "RUN") || (_profile == "PAUSE")) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
552 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"profile\":{\"command\":\"pause\"}}");
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
553 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
554 qDebug() << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
555 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
556 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
557 }
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
558 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
559
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
560
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
561 void DetailFermenter::mode_changed(int val)
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
562 {
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
563 QStringList mode ({ "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" });
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
564 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"mode\":\"" + mode[val] + "\"}");
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
565 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
566 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
567
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
568
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
569 void DetailFermenter::stage_changed(int val)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
570 {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
571 QStringList stage ({ "PRIMARY", "SECONDARY", "TERTIARY", "CARBONATION" });
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
572 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",\"stage\":\"" + stage[val] + "\"}");
323
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
573 webSocket->sendTextMessage(msg);
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
574 }
d053ffbbf3e9 Started with change and signal functions. Implemented mode change for test. The MainWindow webSocket is now global so the Detail screens can send websocket messages.
Michiel Broek <mbroek@mbse.eu>
parents: 318
diff changeset
575
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
576
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
577 void DetailFermenter::code_changed(int val)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
578 {
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
579 QJsonParseError parseError;
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
580 QSqlQuery query;
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
581
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
582 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
583 if (val == 0) {
328
ee2c8b29f389 Added CO2 meter monitor detail screen.
Michiel Broek <mbroek@mbse.eu>
parents: 325
diff changeset
584 msg.append(QString("\"beeruuid\":\"") + _uuid + "\",");
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
585 msg.append(QString("\"beercode\":\"") + _alias.toUpper() + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
586 msg.append(QString("\"beername\":\"") + _alias + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
587 msg.append(QString("\"yeast_lo\":12.0,"));
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
588 msg.append(QString("\"yeast_hi\":24.0}"));
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
589
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
590 } else {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
591 query.exec("SELECT code,name,uuid,stage,json_yeasts FROM products WHERE stage='1' OR stage='2' OR stage='3' OR stage='4' OR stage='5' OR stage='6' OR stage='7' ORDER BY code");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
592 for (int i = 0; i < val; i++) {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
593 query.next();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
594 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
595 double yl = 0;
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
596 double yh = 40;
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
597 const auto& y_json = query.value("json_yeasts").toString();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
598 if (! y_json.trimmed().isEmpty()) {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
599 const auto& formattedJson = QString("%1").arg(y_json);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
600 QJsonDocument yeasts = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
601 if (parseError.error != QJsonParseError::NoError) {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
602 qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
603 } else if (yeasts.isArray()) {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
604 for (int i = 0; i < yeasts.array().size(); i++) {
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
605 QJsonObject obj = yeasts.array().at(i).toObject();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
606 if (obj["y_use"].toInt() == 0) { // Primary yeast
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
607 if (obj["y_min_temperature"].toDouble() > yl)
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
608 yl = obj["y_min_temperature"].toDouble();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
609 if (obj["y_max_temperature"].toDouble() < yh)
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
610 yh = obj["y_max_temperature"].toDouble();
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
611 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
612 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
613 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
614 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
615 msg.append(QString("\"beeruuid\":\"") + query.value("uuid").toString() + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
616 msg.append(QString("\"beercode\":\"") + query.value("code").toString() + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
617 msg.append(QString("\"beername\":\"") + query.value("name").toString() + "\",");
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
618 msg.append(QString("\"yeast_lo\":%1,").arg(yl));
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
619 msg.append(QString("\"yeast_hi\":%1}").arg(yh));
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
620 }
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
621
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
622 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
623 qDebug() << "code_changed" << val << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
624 #endif
325
fa946d12d937 Workaround for the thermometer scale ranges. Added chiller thermometer settings. Added beer select.
Michiel Broek <mbroek@mbse.eu>
parents: 324
diff changeset
625 webSocket->sendTextMessage(msg);
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
626 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
627
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
628
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
629 void DetailFermenter::profile_changed(int val)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
630 {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
631 QString payload;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
632 QSqlQuery query;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
633 QJsonParseError parseError;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
634
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
635 if (val == 0) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
636 payload = QString("\"profile\":null");
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
637 } else {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
638 query.exec("SELECT * FROM profile_fermentation ORDER BY name");
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
639 for (int i = 0; i < val; i++) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
640 query.next();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
641 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
642 payload = QString("\"profile\":{\"uuid\":\""+query.value("uuid").toString()+"\",\"name\":\""+query.value("name").toString());
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
643 payload.append(QString("\",\"inittemp\":{\"low\":") + QString("%1").arg(query.value("inittemp_lo").toDouble(), 2, 'f', 1, '0' ));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
644 payload.append(QString(",\"high\":") + QString("%1").arg(query.value("inittemp_hi").toDouble(), 2, 'f', 1, '0' ) + QString("},"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
645 payload.append(QString("\"fridgemode\":") + QString("%1").arg(query.value("fridgemode").toInt()) );
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
646 payload.append(QString(",\"steps\":["));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
647
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
648 const auto& s_json = query.value("steps").toString();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
649 if (! s_json.trimmed().isEmpty()) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
650 const auto& formattedJson = QString("%1").arg(s_json);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
651 QJsonDocument steps = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
652 if (parseError.error != QJsonParseError::NoError) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
653 qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
654 } else if (steps.isArray()) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
655 for (int i = 0; i < steps.array().size(); i++) {
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
656 QJsonObject obj = steps.array().at(i).toObject();
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
657 if (i > 0)
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
658 payload.append(QString(","));
414
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
659 if (obj["steptime"].isString())
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
660 payload.append(QString("{\"steptime\":%1").arg(obj["steptime"].toString().toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
661 else
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
662 payload.append(QString("{\"steptime\":%1").arg(obj["steptime"].toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
663 if (obj["resttime"].isString())
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
664 payload.append(QString(",\"resttime\":%1").arg(obj["resttime"].toString().toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
665 else
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
666 payload.append(QString(",\"resttime\":%1").arg(obj["resttime"].toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
667 if (obj["target_lo"].isString())
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
668 payload.append(QString(",\"target_lo\":%1").arg(obj["target_lo"].toString().toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
669 else
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
670 payload.append(QString(",\"target_lo\":%1").arg(obj["target_lo"].toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
671 if (obj["target_hi"].isString())
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
672 payload.append(QString(",\"target_hi\":%1").arg(obj["target_hi"].toString().toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
673 else
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
674 payload.append(QString(",\"target_hi\":%1").arg(obj["target_hi"].toDouble()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
675 if (obj["fridgemode"].isString())
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
676 payload.append(QString(",\"fridgemode\":%1").arg(obj["fridgemode"].toString().toInt()));
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
677 else
6582a2a95583 With edited fermentation profile make sure the steps values are handled as string and double/integer values when loaded in a fermenter.
Michiel Broek <mbroek@mbse.eu>
parents: 391
diff changeset
678 payload.append(QString(",\"fridgemode\":%1").arg(obj["fridgemode"].toInt()));
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
679 payload.append(QString(",\"name\":\"") + obj["name"].toString() + QString("\"}"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
680 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
681 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
682 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
683
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
684 payload.append(QString("]}"));
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
685 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
686 QString msg = QString("{\"device\":\"fermenters\",\"node\":\"" + _node + "\",\"unit\":\"" + _alias + "\",%1}").arg(payload);
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
687 #ifdef DEBUG_MONITOR
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
688 qDebug() << "profile_changed" << val << msg;
492
c3a781b4d35b ChartCarbonate saves the image path in the settings file. Conditional debug messages in a lot on monitor files. In Fermenter monitor details make the status background red if offline. A lot more generic variables instead of continuous expensive calls to MySQL. If fermenter values for the thermometers are not OK, then do not show anything.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
689 #endif
324
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
690 webSocket->sendTextMessage(msg);
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
691 }
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
692
c1bb6b197763 Implemented profile control. Added stage edit. Added manual control. Added temperature setting.
Michiel Broek <mbroek@mbse.eu>
parents: 323
diff changeset
693

mercurial