@@ -3,12 +3,12 @@ void readCustomCommand()
3
3
int tempID = nextion.cmdGroup ;
4
4
int tempPage = nextion.cmdLength ;
5
5
6
- if (tempID == 102 ) // 0x66 -> receive page command from readcustomcommand
6
+ if (tempID == 102 ) // 0x66 -> page command empfangen
7
7
{
8
8
DEBUG_VERBOSE (" DIS" , " page command activePage: %d currentPage: %d lastcurrent: %d cmdLength: %d cmdGroup: %d" , activePage, nextion.currentPageId , nextion.lastCurrentPageId , tempPage, tempID);
9
9
tickerDispCallback ();
10
10
}
11
- else // 0x65 -> receive component id from readcustomcommand
11
+ else // 0x65 -> component id empfangen
12
12
{
13
13
DEBUG_VERBOSE (" DIS" , " componentID: %d activePage: %d currentPage: %d lastcurrent: %d cmdLength: %d" , tempID, activePage, nextion.currentPageId , nextion.lastCurrentPageId , tempPage);
14
14
@@ -46,7 +46,7 @@ void initDisplay()
46
46
break ;
47
47
case 1 :
48
48
nextion.writeStr (" page 1" );
49
- nextion.currentPageId = 1 ; // setze currentPageId wenn Startseite nicht 0
49
+ nextion.currentPageId = 1 ; // setze currentPageId wenn Startseite nicht 0
50
50
nextion.lastCurrentPageId = 0 ;
51
51
break ;
52
52
case 2 :
@@ -61,7 +61,7 @@ void initDisplay()
61
61
nextion.lastCurrentPageId = 1 ;
62
62
break ;
63
63
}
64
-
64
+
65
65
if (nextion.getDebug ())
66
66
DEBUG_INFO (" CFG" , " activePage: %d startPage: %d currentPage: %d lastcurrent: %d" , activePage, startPage, nextion.currentPageId , nextion.lastCurrentPageId );
67
67
tickerDispCallback ();
@@ -134,31 +134,10 @@ void KettlePage() // Seite 1
134
134
135
135
void BrewPage () // Seite 2
136
136
{
137
- // DEBUG_INFO("DIS", "BrewPage");
138
137
if (strlen (structKettles[0 ].sensor ) != 0 )
139
138
{
140
139
nextion.writeStr (p1temp_text, structKettles[0 ].current_temp );
141
140
nextion.writeStr (p1target_text, structKettles[0 ].target_temp );
142
-
143
- // Serial.printf("KettlePage sensor %s current temp: %s\n", structKettles[0].sensor, structKettles[0].current_temp);
144
-
145
- // if (sensors[0].getId() != "")
146
- // {
147
- // for (uint8_t i = 0; i < maxKettles; i++)
148
- // {
149
- // if (strcmp(structKettles[i].sensor, sensors[0].getId().c_str()) == 0)
150
- // {
151
- // p1temp_text.attribute("txt", structKettles[i].current_temp);
152
- // p1target_text.attribute("txt", structKettles[i].target_temp);
153
- // break;
154
- // }
155
- // }
156
- // }
157
- // else
158
- // {
159
- // p1temp_text.attribute("txt", structKettles[0].current_temp);
160
- // p1target_text.attribute("txt", "na");
161
- // }
162
141
}
163
142
else
164
143
{
@@ -174,15 +153,11 @@ void BrewPage() // Seite 2
174
153
175
154
void InductionPage ()
176
155
{
177
- // log_e("Disp: InductionPage activeBrew: %d kettleID0: %s", activeBrew, structKettles[0].id);
178
- // p2uhrzeit_text
179
- // p2slider
180
- // p2temp_text
181
156
// 316 = 0°C - 360 = 44°C - 223 = 100°C -- 53,4 je 20°C
182
157
183
158
int32_t aktSlider = nextion.readNum (p2slider);
184
159
if (aktSlider >= 0 && aktSlider <= 100 )
185
- inductionCooker.inductionNewPower (aktSlider); // inductionCooker.handleInductionPage(aktSlider);
160
+ inductionCooker.inductionNewPower (aktSlider);
186
161
187
162
nextion.writeStr (p2temp_text, String (structKettles[0 ].current_temp ).c_str ());
188
163
if (sensors[0 ].calcOffset () < 16.0 )
@@ -387,7 +362,6 @@ void cbpi4steps_handlemqtt(unsigned char *payload)
387
362
388
363
for (uint8_t i = 0 ; i < stepsCounter; i++)
389
364
{
390
- // if (structSteps[i].id == doc["id"])
391
365
if (strcmp (structSteps[i].id , doc[" id" ]) == 0 )
392
366
{
393
367
int minutes = props[" Timer" ].as <int >() | 0 ;
@@ -422,7 +396,6 @@ void cbpi4steps_handlemqtt(unsigned char *payload)
422
396
current_step = true ;
423
397
for (uint8_t i = 0 ; i < stepsCounter; i++)
424
398
{
425
- // if (structSteps[i].name == doc["name"])
426
399
if (strcmp (structSteps[i].name , doc[" name" ]) == 0 )
427
400
{
428
401
if (stepsCounter >= i + 1 )
@@ -527,7 +500,6 @@ void cbpi4steps_handlemqtt(unsigned char *payload)
527
500
}
528
501
else
529
502
{
530
- // if (props.containsKey("Timer"))
531
503
if (props[" Timer" ].is <int >())
532
504
{
533
505
int minutes = props[" Timer" ].as <int >();
@@ -616,16 +588,8 @@ void cbpi4notification_handlemqtt(unsigned char *payload)
616
588
strlcpy (notify, doc[" message" ] | " " , maxNotifySign);
617
589
}
618
590
619
- // void cbpi4fermenter_handlemqtt(unsigned char *payload, unsigned int length)
620
591
void cbpi4fermenter_handlemqtt (unsigned char *payload)
621
592
{
622
- // Serial.printf("Display ferm len: %d\n", length);
623
- // for (unsigned int i = 0; i < length; i++)
624
- // {
625
- // Serial.print((char)payload[i]);
626
- // }
627
- // Serial.println();
628
-
629
593
JsonDocument doc;
630
594
JsonDocument filter;
631
595
filter[" id" ] = true ;
@@ -635,13 +599,12 @@ void cbpi4fermenter_handlemqtt(unsigned char *payload)
635
599
filter[" target_temp" ] = true ;
636
600
// filter["steps"]["name"] = true;
637
601
DeserializationError error = deserializeJson (doc, (const char *)payload, DeserializationOption::Filter (filter));
638
- // DeserializationError error = deserializeJson(doc, (const char *)payload);
639
602
if (error)
640
603
{
641
604
DEBUG_ERROR (" DIS" , " handlemqtt fermenter deserialize Json error %s MemoryUsage %d" , error.c_str ());
642
605
return ;
643
606
}
644
-
607
+
645
608
fermenterStatus = doc[" state" ] | false ;
646
609
647
610
for (uint8_t i = 0 ; i < maxKettles; i++)
@@ -655,9 +618,6 @@ void cbpi4fermenter_handlemqtt(unsigned char *payload)
655
618
char sensorupdate[45 ];
656
619
sprintf (sensorupdate, " %s%s" , cbpi4sensor_topic, structKettles[i].sensor );
657
620
pubsubClient.subscribe (sensorupdate);
658
-
659
- // Serial.printf("#%d new kettle name %s kettle-id: %s sensor-id: %s target: %s update: %s\n", i, structKettles[i].name, structKettles[i].id, structKettles[i].sensor, structKettles[i].target_temp, sensorupdate);
660
-
661
621
switch (i)
662
622
{
663
623
case 0 :
@@ -683,7 +643,6 @@ void cbpi4fermenter_handlemqtt(unsigned char *payload)
683
643
{
684
644
if (strcmp (structKettles[i].id , doc[" id" ]) == 0 )
685
645
{
686
- // Serial.printf("#%d old kettle name %s kettle-id: %s sensor-id: %s target: %s update: %s\n", i, structKettles[i].name, structKettles[i].id, structKettles[i].sensor, structKettles[i].target_temp, sensorupdate);
687
646
dtostrf (doc[" target_temp" ], -1 , 1 , structKettles[i].target_temp );
688
647
switch (i)
689
648
{
@@ -718,12 +677,11 @@ void cbpi4fermentersteps_handlemqtt(unsigned char *payload)
718
677
DEBUG_ERROR (" DIS" , " handlemqtt notification deserialize Json error %s MemoryUsage %d" , error.c_str ());
719
678
return ;
720
679
}
721
-
680
+
722
681
if (fermenterStatus)
723
682
{
724
683
strlcpy (currentStepName, doc[" name" ] | " " , maxStepSign);
725
684
sprintf (currentStepRemain, " %s" , " " );
726
- // sprintf(currentStepRemain, "%02d:%02d:%02d", doc["props"]["TimerD"].as<int>(), doc["props"]["TimerH"].as<int>(), doc["props"]["TimerM"].as<int>());
727
685
}
728
686
else
729
687
{
0 commit comments