Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Water Sensor shown on display with icons #403

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/Displaytemplateminimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void printScreen() {
u8g2.setFont(u8g2_font_profont22_tf);
u8g2.print(setpoint, numDecimalsSetpoint);
}
} else {
}
else {
u8g2.setCursor(2, 2);
u8g2.setFont(u8g2_font_profont22_tf);
u8g2.print(temperature, numDecimalsInput);
Expand All @@ -62,7 +63,8 @@ void printScreen() {

if (pidMode == 1) {
u8g2.print(char(74));
} else {
}
else {
u8g2.print(char(70));
}

Expand All @@ -73,13 +75,10 @@ void printScreen() {

if (brewcounter > kBrewIdle) {
u8g2.setFont(u8g2_font_profont17_tf);

// Brew
u8g2.setCursor(2, 30);
} else {
}
else {
u8g2.setFont(u8g2_font_profont10_tf);

// Brew
u8g2.setCursor(36, 30);
}

Expand All @@ -89,7 +88,8 @@ void printScreen() {

if (ONLYPID == 1) {
u8g2.print(brewtimesoftware, 0);
} else {
}
else {
u8g2.print(totalBrewTime / 1000, 0);
}

Expand All @@ -112,7 +112,8 @@ void printScreen() {
u8g2.drawFrame(116, 28, 12, 12);
u8g2.drawXBMP(118, 30, 8, 8, antenna_NOK_u8g2);
}
} else {
}
else {
u8g2.drawFrame(116, 28, 12, 12);
u8g2.setCursor(120, 30);
u8g2.print("O");
Expand Down
24 changes: 16 additions & 8 deletions src/Displaytemplatescale.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ void printScreen() {
u8g2.drawLine(12, 48, 12, 58 - (temperature / 2));
u8g2.drawLine(13, 48, 13, 58 - (temperature / 2));
}
} else if (temperature > 106) {
}
else if (temperature > 106) {
u8g2.drawLine(9, 48, 9, 5);
u8g2.drawLine(10, 48, 10, 4);
u8g2.drawLine(11, 48, 11, 3);
u8g2.drawLine(12, 48, 12, 4);
u8g2.drawLine(13, 48, 13, 5);
} else {
}
else {
u8g2.drawLine(9, 48, 9, 58 - (temperature / 2));
u8g2.drawLine(10, 48, 10, 58 - (temperature / 2));
u8g2.drawLine(11, 48, 11, 58 - (temperature / 2));
Expand All @@ -69,7 +71,8 @@ void printScreen() {

if (ONLYPID == 1) {
u8g2.print(brewtimesoftware, 0); // deaktivieren wenn Preinfusion ( // voransetzen )
} else {
}
else {
u8g2.print(totalBrewTime / 1000, 1); // aktivieren wenn Preinfusion und eine Nachkommastelle
// oder alternativ keine
}
Expand All @@ -79,10 +82,12 @@ void printScreen() {

if (scaleFailure) {
u8g2.print("fault");
} else {
}
else {
if (brewswitch == LOW) {
u8g2.print(weight, 0);
} else {
}
else {
u8g2.print(weightBrew, 0);
}

Expand Down Expand Up @@ -114,7 +119,8 @@ void printScreen() {
for (int b = 0; b <= signalBars; b++) {
u8g2.drawVLine(45 + (b * 2), 10 - (b * 2), b * 2);
}
} else {
}
else {
u8g2.drawXBMP(40, 2, 8, 8, antenna_NOK_u8g2);
u8g2.setCursor(88, 2);
u8g2.print("RC: ");
Expand All @@ -126,12 +132,14 @@ void printScreen() {
u8g2.setCursor(60, 1);
u8g2.setFont(u8g2_font_profont11_tf);
u8g2.print("MQTT");
} else {
}
else {
u8g2.setCursor(60, 2);
u8g2.print("");
}
}
} else {
}
else {
u8g2.setCursor(40, 2);
u8g2.print("Offline Mode");
}
Expand Down
18 changes: 12 additions & 6 deletions src/Displaytemplatestandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ void printScreen()
u8g2.drawLine(12, 48, 12, 58 - (temperature / 2));
u8g2.drawLine(13, 48, 13, 58 - (temperature / 2));
}
} else if (temperature > 106) {
}
else if (temperature > 106) {
u8g2.drawLine(9, 48, 9, 5);
u8g2.drawLine(10, 48, 10, 4);
u8g2.drawLine(11, 48, 11, 3);
u8g2.drawLine(12, 48, 12, 4);
u8g2.drawLine(13, 48, 13, 5);
} else {
}
else {
u8g2.drawLine(9, 48, 9, 58 - (temperature / 2));
u8g2.drawLine(10, 48, 10, 58 - (temperature / 2));
u8g2.drawLine(11, 48, 11, 58 - (temperature / 2));
Expand Down Expand Up @@ -88,7 +90,8 @@ void printScreen()

if (pidOutput < 99) {
u8g2.print(pidOutput / 10, 1);
} else {
}
else {
u8g2.print(pidOutput / 10, 0);
}

Expand All @@ -110,7 +113,8 @@ void printScreen()
else {
u8g2.print(totalBrewTime / 1000, 1); // Activate if pre-infusion and one decimal place or alternatively none
}
} else {
}
else {
// Show uptime of machine
u8g2.print(langstring_uptime);
float seconds = millis() / 1000;
Expand Down Expand Up @@ -138,7 +142,8 @@ void printScreen()
for (int b = 0; b <= signalBars; b++) {
u8g2.drawVLine(45 + (b * 2), 10 - (b * 2), b * 2);
}
} else {
}
else {
u8g2.drawXBMP(40, 2, 8, 8, antenna_NOK_u8g2);
u8g2.setCursor(88, 1);
u8g2.print("RC: ");
Expand All @@ -155,7 +160,8 @@ void printScreen()
u8g2.print("");
}
}
} else {
}
else {
u8g2.setCursor(40, 1);
u8g2.print(langstring_offlinemode);
}
Expand Down
16 changes: 10 additions & 6 deletions src/Displaytemplatetemponly.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void printScreen() {
if ((machineState == kAtSetpoint || 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)) {

((machineState == kPidOffline) && OFFLINEGLOGO == 0))
{
if (!sensorError) {
u8g2.clearBuffer();

Expand All @@ -31,18 +31,21 @@ void printScreen() {
u8g2.setCursor(13, 12);
u8g2.setFont(u8g2_font_fub35_tf);
u8g2.print(temperature, 1);
} else {
}
else {
u8g2.setCursor(-1, 12);
u8g2.setFont(u8g2_font_fub35_tf);
u8g2.print(temperature, 1);
}
}
} else {
}
else {
if (temperature < 99.999) {
u8g2.setCursor(13, 12);
u8g2.setFont(u8g2_font_fub35_tf);
u8g2.print(temperature, 1);
} else {
}
else {
u8g2.setCursor(-1, 12);
u8g2.setFont(u8g2_font_fub35_tf);
u8g2.print(temperature, 1);
Expand All @@ -58,7 +61,8 @@ void printScreen() {
u8g2.drawFrame(116, 28, 12, 12);
u8g2.drawXBMP(118, 30, 8, 8, antenna_NOK_u8g2);
}
} else {
}
else {
u8g2.drawFrame(116, 28, 12, 12);
u8g2.setCursor(120, 30);
u8g2.print("O");
Expand Down
60 changes: 34 additions & 26 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#if (OLED_DISPLAY != 0)


/**
* @brief initialize display
*/
Expand All @@ -21,6 +20,14 @@ void u8g2_prepare(void) {
u8g2.setDisplayRotation(DISPLAYROTATE);
}

/**
* @brief Show water empty icon in upper right corner if water supply is low
*/
void displayWaterIcon(int x, int y) {
if (!waterFull) {
u8g2.drawXBMP(x, y, 8, 8, water_EMPTY_u8g2);
}
}

/**
* @brief print message
Expand Down Expand Up @@ -54,39 +61,22 @@ void displayLogo(String displaymessagetext, String displaymessagetext2) {
// Rancilio startup logo
switch (machine) {
case RancilioSilvia: // Rancilio
u8g2.drawXBMP(41, 2, startLogoRancilio_width, startLogoRancilio_height,
startLogoRancilio_bits);
u8g2.drawXBMP(41, 2, startLogoRancilio_width, startLogoRancilio_height, startLogoRancilio_bits);
break;

case RancilioSilviaE: // Rancilio
u8g2.drawXBMP(41, 2, startLogoRancilio_width, startLogoRancilio_height,
startLogoRancilio_bits);
u8g2.drawXBMP(41, 2, startLogoRancilio_width, startLogoRancilio_height, startLogoRancilio_bits);
break;

case Gaggia: // Gaggia
u8g2.drawXBMP(0, 2, startLogoGaggia_width, startLogoGaggia_height,
startLogoGaggia_bits);
u8g2.drawXBMP(0, 2, startLogoGaggia_width, startLogoGaggia_height, startLogoGaggia_bits);
break;

case QuickMill: // Quickmill
u8g2.drawXBMP(22, 0, startLogoQuickMill_width, startLogoQuickMill_height,
startLogoQuickMill_bits);
u8g2.drawXBMP(22, 0, startLogoQuickMill_width, startLogoQuickMill_height, startLogoQuickMill_bits);
break;
}
u8g2.sendBuffer();
}

/**
* @brief calibration mode
*
* @param display_distance
*/
void displayDistance(int display_distance) {
u8g2.clearBuffer();
u8g2.setCursor(13, 12);
u8g2.setFont(u8g2_font_fub20_tf);
u8g2.printf("%d", display_distance);
u8g2.print("mm");
u8g2.sendBuffer();
}

Expand All @@ -103,6 +93,7 @@ void displayShottimer(void) {
u8g2.setCursor(64, 25);
u8g2.print(timeBrewed / 1000, 1);
u8g2.setFont(u8g2_font_profont11_tf);
displayWaterIcon(119, 1);
u8g2.sendBuffer();
}

Expand All @@ -117,6 +108,7 @@ void displayShottimer(void) {
u8g2.setCursor(64, 25);
u8g2.print(lastbrewTime / 1000, 1);
u8g2.setFont(u8g2_font_profont11_tf);
displayWaterIcon(119, 1);
u8g2.sendBuffer();
}

Expand All @@ -134,6 +126,7 @@ void displayShottimer(void) {
u8g2.print(weightBrew, 0);
u8g2.print("g");
u8g2.setFont(u8g2_font_profont11_tf);
displayWaterIcon(119, 1);
u8g2.sendBuffer();
}

Expand All @@ -148,6 +141,7 @@ void displayShottimer(void) {
u8g2.print(weightBrew, 0);
u8g2.print(" g");
u8g2.setFont(u8g2_font_profont11_tf);
displayWaterIcon(119, 1);
u8g2.sendBuffer();
}
#endif
Expand All @@ -172,7 +166,8 @@ void Displaymachinestate() {
for (int b = 0; b <= signalBars; b++) {
u8g2.drawVLine(45 + (b * 2), 10 - (b * 2), b * 2);
}
} else {
}
else {
u8g2.drawXBMP(40, 2, 8, 8, antenna_NOK_u8g2);
u8g2.setCursor(88, 1);
u8g2.print("RC: ");
Expand All @@ -184,7 +179,8 @@ void Displaymachinestate() {
u8g2.setCursor(60, 1);
u8g2.setFont(u8g2_font_profont11_tf);
u8g2.print("MQTT");
} else {
}
else {
u8g2.setCursor(60, 2);
u8g2.print("");
}
Expand Down Expand Up @@ -242,6 +238,15 @@ void Displaymachinestate() {
u8g2.setFont(u8g2_font_profont22_tf);
u8g2.print(temperature, 0);
u8g2.setCursor(64, 25);
displayWaterIcon(119, 1);
u8g2.sendBuffer();
}

// Water empty
if (machineState == kWaterEmpty) {
u8g2.clearBuffer();
u8g2.drawXBMP( 45, 0, water_empty_big_width, water_empty_big_height, water_EMPTY_big_u8g2);
u8g2.setFont(u8g2_font_profont11_tf);
u8g2.sendBuffer();
}

Expand All @@ -252,11 +257,13 @@ void Displaymachinestate() {
#if OLED_DISPLAY != 0
displayMessage(langstring_bckffinished[0], langstring_bckffinished[1], "", "", "", "");
#endif
} else if (backflushState == 10) {
}
else if (backflushState == 10) {
#if OLED_DISPLAY != 0
displayMessage(langstring_bckfactivated[0], langstring_bckfactivated[1], "", "", "", "");
#endif
} else if (backflushState > 10) {
}
else if (backflushState > 10) {
#if OLED_DISPLAY != 0
displayMessage(langstring_bckfrunning[0], String(flushCycles), langstring_bckfrunning[1], String(maxflushCycles), "", "");
#endif
Expand Down Expand Up @@ -307,4 +314,5 @@ void Displaymachinestate() {
displayMessage("EEPROM Error, please set Values", "", "", "", "", "");
}
}

#endif
Loading