From 7b67633bc9689eafbc23b0040fc8772517e311fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Kopi=C4=87?= Date: Fri, 1 Nov 2024 21:08:03 +0100 Subject: [PATCH] Configured temperature display --- src/bitmaps.h | 23 +++++++++++++++++++++++ src/main.cpp | 1 + src/octoprint.h | 34 +++++++++++++++++++--------------- 3 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 src/bitmaps.h diff --git a/src/bitmaps.h b/src/bitmaps.h new file mode 100644 index 0000000..4e6a6f2 --- /dev/null +++ b/src/bitmaps.h @@ -0,0 +1,23 @@ +#include + +const unsigned char bitmap_nozzle[] PROGMEM = { + 0b00111100, + 0b00111100, + 0b00111100, + 0b11111111, + 0b11111111, + 0b01111110, + 0b00111100, + 0b00011000 +}; + +const unsigned char bitmap_bed[] PROGMEM = { + 0b00100010, + 0b01000100, + 0b00100010, + 0b01000100, + 0b11111111, + 0b11111111, + 0b01100110, + 0b00000000 +}; diff --git a/src/main.cpp b/src/main.cpp index a7d53c6..d48fa26 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include #include "functions.h" +#include "bitmaps.h" #include "octoprint.h" void setup() { diff --git a/src/octoprint.h b/src/octoprint.h index da1c12b..fcb9d31 100644 --- a/src/octoprint.h +++ b/src/octoprint.h @@ -56,23 +56,27 @@ bool fetchPrintingStatus(Adafruit_SSD1306& display) { display.setTextSize(1); display.setTextColor(WHITE); display.println(api.printerStats.printerState); - display.print("Nozzle: "); - display.println(api.printerStats.printerTool0TempActual); - display.print("Bed: "); - display.println(api.printerStats.printerBedTempActual); + display.drawLine(0,10,127,10,WHITE); + display.drawBitmap(10, 13, bitmap_nozzle, 8, 8, WHITE); + display.setCursor(21, 13); + display.print(api.printerStats.printerTool0TempActual); + display.drawBitmap(74, 13, bitmap_bed, 8, 8, WHITE); + display.setCursor(84, 13); + display.print(api.printerStats.printerBedTempActual); + display.setCursor(0, 15); - //Print time left (if printing) in human readable time HH:MM:SS - int runHours= api.printJob.progressPrintTimeLeft/3600; - int secsRemaining=api.printJob.progressPrintTimeLeft%3600; - int runMinutes=secsRemaining/60; - int runSeconds=secsRemaining%60; - char buf[31]; - sprintf(buf,"%02d:%02d:%02d",runHours,runMinutes,runSeconds); - display.println(buf); + // //Print time left (if printing) in human readable time HH:MM:SS + // int runHours= api.printJob.progressPrintTimeLeft/3600; + // int secsRemaining=api.printJob.progressPrintTimeLeft%3600; + // int runMinutes=secsRemaining/60; + // int runSeconds=secsRemaining%60; + // char buf[31]; + // sprintf(buf,"%02d:%02d:%02d",runHours,runMinutes,runSeconds); + // display.println(buf); - const float temp_percent = floor(api.printJob.progressCompletion*100)/100; - display.print(temp_percent); - display.println("%"); + // const float temp_percent = floor(api.printJob.progressCompletion*100)/100; + // display.print(temp_percent); + // display.println("%"); display.display(); api_lasttime = millis(); // Update the last fetch time return true;