Skip to content

Commit

Permalink
Merge pull request #135 from danieltwagner/machinestate
Browse files Browse the repository at this point in the history
Use enum for machinestate
  • Loading branch information
murmeltier08 authored Oct 9, 2021
2 parents 0a05cf8 + 1a1be4e commit 20663cd
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 152 deletions.
16 changes: 11 additions & 5 deletions rancilio-pid/rancilio-pid/Displaytemplateminimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ void printScreen()
{
unsigned long currentMillisDisplay = millis();
if (
(machinestate == 19 || machinestate == 20 || machinestate == 35) ||
((machinestate == 30 || machinestate == 31) && SHOTTIMER == 0) || // shottimer == 0, auch Bezug anzeigen
machinestate == 45 ||
((machinestate == 10) && HEATINGLOGO == 0) ||
((machinestate == 90) && OFFLINEGLOGO == 0))
(machinestate == kSetPointNegative || machinestate == kPidNormal || machinestate == kBrewDetectionTrailing) ||
((machinestate == kBrew || machinestate == kShotTimerAfterBrew) && SHOTTIMER == 0) || // shottimer == 0, auch Bezug anzeigen
machinestate == kCoolDown ||
((machinestate == kColdStart) && HEATINGLOGO == 0) ||
((machinestate == kPidOffline) && OFFLINEGLOGO == 0))
{
if (!sensorError)
{
u8g2.clearBuffer();
//draw outline frame
//u8g2.drawFrame(0, 0, 128, 64);
// Draw heat bar outline
u8g2.drawFrame(15, 58, 102, 4);
u8g2.drawLine(16, 59, (Output / 10) + 16, 59);
u8g2.drawLine(16, 60, (Output / 10) + 16, 60);

// Draw heat bar outline
u8g2.drawFrame(15, 58, 102, 4);
Expand Down
10 changes: 5 additions & 5 deletions rancilio-pid/rancilio-pid/Displaytemplatescale.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ void printScreen()
unsigned long currentMillisDisplay = millis();
if
(
(machinestate == 19 || machinestate == 20 || machinestate == 35) ||
((machinestate == 30 || machinestate == 31) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == 45 ||
((machinestate == 0 || machinestate == 10 ) && HEATINGLOGO == 0) ||
((machinestate == 90) && OFFLINEGLOGO == 0)
(machinestate == kSetPointNegative || machinestate == kPidNormal || machinestate == kBrewDetectionTrailing) ||
((machinestate == kBrew || machinestate == kShotTimerAfterBrew) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == kCoolDown ||
((machinestate == kInit || machinestate == kColdStart ) && HEATINGLOGO == 0) ||
((machinestate == kPidOffline) && OFFLINEGLOGO == 0)
)
{
u8g2.clearBuffer();
Expand Down
10 changes: 5 additions & 5 deletions rancilio-pid/rancilio-pid/Displaytemplatestandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ void printScreen()
unsigned long currentMillisDisplay = millis();
if
(
(machinestate == 19 || machinestate == 20 || machinestate == 35) ||
((machinestate == 30 || machinestate == 31) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == 45 ||
((machinestate == 0 || machinestate == 10 ) && HEATINGLOGO == 0) ||
((machinestate == 90) && OFFLINEGLOGO == 0)
(machinestate == kSetPointNegative || machinestate == kPidNormal || machinestate == kBrewDetectionTrailing) ||
((machinestate == kBrew || machinestate == kShotTimerAfterBrew) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == kCoolDown ||
((machinestate == kInit || machinestate == kColdStart ) && HEATINGLOGO == 0) ||
((machinestate == kPidOffline) && OFFLINEGLOGO == 0)
)
{
//DEBUG_println(weight);
Expand Down
10 changes: 5 additions & 5 deletions rancilio-pid/rancilio-pid/Displaytemplatetemponly.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ void printScreen()
unsigned long currentMillisDisplay = millis();
if
(
(machinestate == 19 || machinestate == 20 || machinestate == 35) ||
((machinestate == 30 || machinestate == 31) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == 45 ||
((machinestate == 0 || machinestate == 10 ) && HEATINGLOGO == 0) ||
((machinestate == 90) && OFFLINEGLOGO == 0)
(machinestate == kSetPointNegative || machinestate == kPidNormal || machinestate == kBrewDetectionTrailing) ||
((machinestate == kBrew || machinestate == kShotTimerAfterBrew) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == kCoolDown ||
((machinestate == kInit || machinestate == kColdStart ) && HEATINGLOGO == 0) ||
((machinestate == kPidOffline) && OFFLINEGLOGO == 0)
)
{
if (!sensorError)
Expand Down
10 changes: 5 additions & 5 deletions rancilio-pid/rancilio-pid/Displaytemplateupright.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ void printScreen()
unsigned long currentMillisDisplay = millis();
if
(
(machinestate == 19 || machinestate == 20 || machinestate == 35) ||
((machinestate == 30 || machinestate == 31) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == 45 ||
((machinestate == 0 || machinestate == 10 ) && HEATINGLOGO == 0) ||
((machinestate == 90) && OFFLINEGLOGO == 0)
(machinestate == kSetPointNegative || machinestate == kPidNormal || machinestate == kBrewDetectionTrailing) ||
((machinestate == kBrew || machinestate == kShotTimerAfterBrew) && SHOTTIMER == 0) ||// shottimer == 0, auch Bezug anzeigen
machinestate == kCoolDown ||
((machinestate == kInit || machinestate == kColdStart ) && HEATINGLOGO == 0) ||
((machinestate == kPidOffline) && OFFLINEGLOGO == 0)
)
{

Expand Down
20 changes: 10 additions & 10 deletions rancilio-pid/rancilio-pid/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
void displayShottimer(void)
{

if ((machinestate == 30 ) && SHOTTIMER == 1) // Shotimer muss 1 = True sein und Bezug vorliegen
if ((machinestate == kBrew ) && SHOTTIMER == 1) // Shotimer muss 1 = True sein und Bezug vorliegen
{
// Dann Zeit anzeigen
u8g2.clearBuffer();
Expand All @@ -105,7 +105,7 @@

if
(
((machinestate == 31) && SHOTTIMER == 1)
((machinestate == kShotTimerAfterBrew) && SHOTTIMER == 1)
) // wenn die totalbrewtime automatisch erreicht wird,
//soll nichts gemacht werden, da sonst falsche Zeit angezeigt wird, da Schalter später betätigt wird als totalbrewtime
{
Expand All @@ -119,7 +119,7 @@
}
#if (ONLYPIDSCALE == 1 || BREWMODE == 2)

if ((machinestate == 30 ) && SHOTTIMER == 2) // Shotimer muss 2 sein und Bezug vorliegen
if ((machinestate == kBrew ) && SHOTTIMER == 2) // Shotimer muss 2 sein und Bezug vorliegen
{
// Dann Zeit anzeigen
u8g2.clearBuffer();
Expand All @@ -139,7 +139,7 @@
}
if
(
((machinestate == 31) && SHOTTIMER == 2)
((machinestate == kShotTimerAfterBrew) && SHOTTIMER == 2)
) // wenn die totalbrewtime automatisch erreicht wird, soll nichts gemacht werden,
// da sonst falsche Zeit angezeigt wird, da Schalter später betätigt wird als totalbrewtime
{
Expand All @@ -164,7 +164,7 @@
*****************************************************/
void Displaymachinestate()
{
if (HEATINGLOGO > 0 && (machinestate == 0 || machinestate == 10 ))
if (HEATINGLOGO > 0 && (machinestate == kInit || machinestate == kColdStart ))
{
// Für Statusinfos
u8g2.clearBuffer();
Expand Down Expand Up @@ -241,7 +241,7 @@
/********************************************************
DISPLAY - PID Off Logo
*****************************************************/
if (OFFLINEGLOGO == 1 && machinestate == 90)
if (OFFLINEGLOGO == 1 && machinestate == kPidOffline)
{
u8g2.clearBuffer();
u8g2.drawXBMP(38,0, OFFLogo_width, OFFLogo_height, OFFLogo);
Expand All @@ -254,7 +254,7 @@
DISPLAY - Steam
*****************************************************/

if (machinestate == 40)
if (machinestate == kSteam)
{
u8g2.clearBuffer();
u8g2.drawXBMP(0,0, steamlogo_width, steamlogo_height, steamlogo);
Expand All @@ -269,7 +269,7 @@
DISPLAY - Backflush
*****************************************************/

if ( machinestate == 50 )
if ( machinestate == kBackflush )
{
u8g2.setFont(u8g2_font_profont11_tf); // set font
if (backflushState == 43)
Expand All @@ -294,7 +294,7 @@
/********************************************************
DISPLAY - PID Off Logo
*****************************************************/
if (machinestate == 80)
if (machinestate == kEmergencyStop)
{
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_profont11_tf); // set font
Expand Down Expand Up @@ -328,7 +328,7 @@
/********************************************************
Sensor error
*****************************************************/
if (machinestate == 100)
if (machinestate == kSensorError)
{
displayMessage(langstring_error_tsensor[0], String(Input), langstring_error_tsensor[1], "", "", ""); //DISPLAY AUSGABE
}
Expand Down
Loading

0 comments on commit 20663cd

Please sign in to comment.