-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from rancilio-pid/displaytemplate
V2.4.0
- Loading branch information
Showing
7 changed files
with
402 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/******************************************************** | ||
send data to display | ||
******************************************************/ | ||
void printScreen() | ||
{ | ||
unsigned long currentMillisDisplay = millis(); | ||
if (currentMillisDisplay - previousMillisDisplay >= intervalDisplay) { | ||
previousMillisDisplay = currentMillisDisplay; | ||
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 (blinking) temp | ||
if (fabs(Input - setPoint) < 0.3) { | ||
if (isrCounter < 500) { | ||
u8g2.setCursor(2, 2); | ||
u8g2.setFont(u8g2_font_profont22_tf); | ||
u8g2.print(Input, 1); | ||
u8g2.setFont(u8g2_font_open_iconic_arrow_2x_t); | ||
u8g2.print(char(78)); | ||
u8g2.setCursor(78, 2); | ||
u8g2.setFont(u8g2_font_profont22_tf); | ||
u8g2.print(setPoint, 1); | ||
} | ||
} else { | ||
u8g2.setCursor(2, 2); | ||
u8g2.setFont(u8g2_font_profont22_tf); | ||
u8g2.print(Input, 1); | ||
u8g2.setFont(u8g2_font_open_iconic_arrow_2x_t); | ||
u8g2.setCursor(56, 6); | ||
if (pidMode == 1) { | ||
u8g2.print(char(74)); | ||
} else { | ||
u8g2.print(char(70)); | ||
} | ||
u8g2.setCursor(79, 2); | ||
u8g2.setFont(u8g2_font_profont22_tf); | ||
u8g2.print(setPoint, 1); | ||
} | ||
|
||
|
||
if (brewcounter > 10) { | ||
u8g2.setFont(u8g2_font_profont17_tf); | ||
// Brew | ||
u8g2.setCursor(2, 30); | ||
} else { | ||
u8g2.setFont(u8g2_font_profont10_tf); | ||
// Brew | ||
u8g2.setCursor(36, 30); | ||
} | ||
|
||
u8g2.print("Brew: "); | ||
u8g2.print(bezugsZeit / 1000, 1); | ||
u8g2.print("/"); | ||
if (ONLYPID == 1) { | ||
u8g2.print(brewtimersoftware, 0); // deaktivieren wenn Preinfusion ( // voransetzen ) | ||
} | ||
else | ||
{ | ||
u8g2.print(totalbrewtime / 1000, 0); // aktivieren wenn Preinfusion | ||
} | ||
|
||
if (timerBrewdetection == 1 && brewcounter == 10) { | ||
u8g2.setFont(u8g2_font_profont11_tf); | ||
// Brew | ||
u8g2.setCursor(30, 40); | ||
u8g2.print("BD: "); | ||
u8g2.print((millis() - timeBrewdetection) / 1000, 1); | ||
u8g2.print("/"); | ||
u8g2.print(brewtimersoftware, 0); | ||
} | ||
|
||
// Für Statusinfos | ||
if (Offlinemodus == 0) { | ||
getSignalStrength(); | ||
if (WiFi.status() != WL_CONNECTED) { | ||
u8g2.drawFrame(116, 28, 12, 12); | ||
u8g2.drawXBMP(118, 30, 8, 8, antenna_NOK_u8g2); | ||
} else { | ||
if (!Blynk.connected()) { | ||
u8g2.drawFrame(116, 28, 12, 12); | ||
u8g2.drawXBMP(118, 30, 8, 8, blynk_NOK_u8g2); | ||
} | ||
} | ||
} else { | ||
u8g2.drawFrame(116, 28, 12, 12); | ||
u8g2.setCursor(120, 30); | ||
u8g2.print("O"); | ||
} | ||
u8g2.sendBuffer(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
|
||
/******************************************************** | ||
send data to display - Standardtemplate | ||
******************************************************/ | ||
|
||
|
||
void printScreen() | ||
{ | ||
unsigned long currentMillisDisplay = millis(); | ||
if (currentMillisDisplay - previousMillisDisplay >= intervalDisplay) { | ||
previousMillisDisplay = currentMillisDisplay; | ||
if (!sensorError) { | ||
u8g2.clearBuffer(); | ||
u8g2.drawXBMP(0, 0, logo_width, logo_height, logo_bits_u8g2); //draw temp icon | ||
u8g2.setCursor(32, 14); | ||
u8g2.print("Ist : "); | ||
u8g2.print(Input, 1); | ||
u8g2.print(" "); | ||
u8g2.print((char)176); | ||
u8g2.print("C"); | ||
u8g2.setCursor(32, 24); | ||
u8g2.print("Soll: "); | ||
u8g2.print(setPoint, 1); | ||
u8g2.print(" "); | ||
u8g2.print((char)176); | ||
u8g2.print("C"); | ||
|
||
// Draw heat bar | ||
u8g2.drawLine(15, 58, 117, 58); | ||
u8g2.drawLine(15, 58, 15, 61); | ||
u8g2.drawLine(117, 58, 117, 61); | ||
|
||
u8g2.drawLine(16, 59, (Output / 10) + 16, 59); | ||
u8g2.drawLine(16, 60, (Output / 10) + 16, 60); | ||
u8g2.drawLine(15, 61, 117, 61); | ||
|
||
//draw current temp in icon | ||
if (fabs(Input - setPoint) < 0.3) { | ||
if (isrCounter < 500) { | ||
u8g2.drawLine(9, 48, 9, 58 - (Input / 2)); | ||
u8g2.drawLine(10, 48, 10, 58 - (Input / 2)); | ||
u8g2.drawLine(11, 48, 11, 58 - (Input / 2)); | ||
u8g2.drawLine(12, 48, 12, 58 - (Input / 2)); | ||
u8g2.drawLine(13, 48, 13, 58 - (Input / 2)); | ||
} | ||
} else if (Input > 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 { | ||
u8g2.drawLine(9, 48, 9, 58 - (Input / 2)); | ||
u8g2.drawLine(10, 48, 10, 58 - (Input / 2)); | ||
u8g2.drawLine(11, 48, 11, 58 - (Input / 2)); | ||
u8g2.drawLine(12, 48, 12, 58 - (Input / 2)); | ||
u8g2.drawLine(13, 48, 13, 58 - (Input / 2)); | ||
} | ||
|
||
//draw setPoint line | ||
u8g2.drawLine(18, 58 - (setPoint / 2), 23, 58 - (setPoint / 2)); | ||
|
||
// PID Werte ueber heatbar | ||
u8g2.setCursor(40, 48); | ||
|
||
u8g2.print(bPID.GetKp(), 0); // P | ||
u8g2.print("|"); | ||
if (bPID.GetKi() != 0) { | ||
u8g2.print(bPID.GetKp() / bPID.GetKi(), 0);; | ||
} // I | ||
else | ||
{ | ||
u8g2.print("0"); | ||
} | ||
u8g2.print("|"); | ||
u8g2.print(bPID.GetKd() / bPID.GetKp(), 0); // D | ||
u8g2.setCursor(98, 48); | ||
if (Output < 99) { | ||
u8g2.print(Output / 10, 1); | ||
} else { | ||
u8g2.print(Output / 10, 0); | ||
} | ||
u8g2.print("%"); | ||
|
||
// Brew | ||
u8g2.setCursor(32, 34); | ||
u8g2.print("Brew: "); | ||
u8g2.print(bezugsZeit / 1000, 1); | ||
u8g2.print("/"); | ||
if (ONLYPID == 1) { | ||
u8g2.print(brewtimersoftware, 0); // deaktivieren wenn Preinfusion ( // voransetzen ) | ||
} | ||
else | ||
{ | ||
u8g2.print(totalbrewtime / 1000); // aktivieren wenn Preinfusion | ||
} | ||
//draw box | ||
u8g2.drawFrame(0, 0, 128, 64); | ||
|
||
// Für Statusinfos | ||
u8g2.drawFrame(32, 0, 84, 12); | ||
if (Offlinemodus == 0) { | ||
getSignalStrength(); | ||
if (WiFi.status() == WL_CONNECTED) { | ||
u8g2.drawXBMP(40, 2, 8, 8, antenna_OK_u8g2); | ||
for (int b = 0; b <= bars; b++) { | ||
u8g2.drawVLine(45 + (b * 2), 10 - (b * 2), b * 2); | ||
} | ||
} else { | ||
u8g2.drawXBMP(40, 2, 8, 8, antenna_NOK_u8g2); | ||
u8g2.setCursor(88, 2); | ||
u8g2.print("RC: "); | ||
u8g2.print(wifiReconnects); | ||
} | ||
if (Blynk.connected()) { | ||
u8g2.drawXBMP(60, 2, 11, 8, blynk_OK_u8g2); | ||
} else { | ||
u8g2.drawXBMP(60, 2, 8, 8, blynk_NOK_u8g2); | ||
} | ||
if (MQTT == 1) { | ||
if (mqtt.connect(hostname, mqtt_username, mqtt_password)) { | ||
u8g2.setCursor(77, 2); | ||
u8g2.print("MQTT"); | ||
} else { | ||
u8g2.setCursor(77, 2); | ||
u8g2.print(""); | ||
} | ||
} | ||
} else { | ||
u8g2.setCursor(40, 2); | ||
u8g2.print("Offlinemodus"); | ||
} | ||
u8g2.sendBuffer(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
|
||
#if (DISPLAY == 1 || DISPLAY == 2) | ||
|
||
/******************************************************** | ||
initialize u8g2 display | ||
*****************************************************/ | ||
void u8g2_prepare(void) | ||
{ | ||
//u8g2.setFont(u8g2_font_6x12_tf); | ||
u8g2.setFont(u8g2_font_profont11_tf); | ||
//u8g2.setFont(u8g2_font_IPAandRUSLCD_tf); | ||
u8g2.setFontRefHeightExtendedText(); | ||
u8g2.setDrawColor(1); | ||
u8g2.setFontPosTop(); | ||
u8g2.setFontDirection(0); | ||
u8g2.setDisplayRotation(DISPALYROTATE); | ||
} | ||
|
||
/******************************************************** | ||
DISPLAY - print message | ||
*****************************************************/ | ||
void displayMessage(String text1, String text2, String text3, String text4, String text5, String text6) | ||
{ | ||
u8g2.clearBuffer(); | ||
u8g2.setCursor(0, 0); | ||
u8g2.print(text1); | ||
u8g2.setCursor(0, 10); | ||
u8g2.print(text2); | ||
u8g2.setCursor(0, 20); | ||
u8g2.print(text3); | ||
u8g2.setCursor(0, 30); | ||
u8g2.print(text4); | ||
u8g2.setCursor(0, 40); | ||
u8g2.print(text5); | ||
u8g2.setCursor(0, 50); | ||
u8g2.print(text6); | ||
u8g2.sendBuffer(); | ||
} | ||
|
||
/******************************************************** | ||
DISPLAY - print logo and message at boot | ||
*****************************************************/ | ||
void displayLogo(String displaymessagetext, String displaymessagetext2) | ||
{ | ||
u8g2.clearBuffer(); | ||
u8g2.drawStr(0, 47, displaymessagetext.c_str()); | ||
u8g2.drawStr(0, 55, displaymessagetext2.c_str()); | ||
//Rancilio startup logo | ||
if (machineLogo == 1) { | ||
u8g2.drawXBMP(41, 2, startLogoRancilio_width, startLogoRancilio_height, startLogoRancilio_bits); | ||
} else if (machineLogo == 2) { | ||
u8g2.drawXBMP(0, 2, startLogoGaggia_width, startLogoGaggia_height, startLogoGaggia_bits); | ||
} | ||
u8g2.sendBuffer(); | ||
} | ||
|
||
/******************************************************** | ||
DISPLAY - EmergencyStop | ||
*****************************************************/ | ||
void displayEmergencyStop(void) | ||
{ | ||
u8g2.clearBuffer(); | ||
u8g2.drawXBMP(0, 0, logo_width, logo_height, logo_bits_u8g2); //draw temp icon | ||
u8g2.setCursor(32, 24); | ||
u8g2.print("Ist : "); | ||
u8g2.print(Input, 1); | ||
u8g2.print(" "); | ||
u8g2.print((char)176); | ||
u8g2.print("C"); | ||
u8g2.setCursor(32, 34); | ||
u8g2.print("Soll: "); | ||
u8g2.print(setPoint, 1); | ||
u8g2.print(" "); | ||
u8g2.print((char)176); | ||
u8g2.print("C"); | ||
|
||
//draw current temp in icon | ||
if (isrCounter < 500) | ||
{ | ||
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); | ||
u8g2.setCursor(32, 4); | ||
u8g2.print("HEATING STOPPED"); | ||
} | ||
u8g2.sendBuffer(); | ||
} | ||
|
||
#endif |
Oops, something went wrong.