This commit is contained in:
2025-04-13 22:55:55 +02:00
commit 9abfb936a3
16 changed files with 527 additions and 0 deletions

37
esp32_readout/display.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include "display.h"
#include <Adafruit_SharpMem.h>
Display::Display() {
this->_display = new Adafruit_SharpMem(SHARP_SCK, SHARP_MOSI, SHARP_SS, DISPLAY_HEIGHT, DISPLAY_WIDTH);
this->mid_x = DISPLAY_WIDTH / 2;
this->mid_y = DISPLAY_HEIGHT / 2;
}
void Display::setup() {
// start & clear the display
this->_display->begin();
this->_display->clearDisplay();
this->_display->setRotation(2);
this->_display->setTextColor(BLACK, WHITE);
this->_display->setTextSize(FONT_SIZE);
this->_display->setFont(FONT);
this->print("Smaage");
}
void Display::print(const char* text) {
this->_display->clearDisplay();
this->_display->setCursor(12, this->mid_x);
this->_display->println(text);
this->_display->refresh();
}
void Display::print_weight(double val) {
this->_display->clearDisplay();
this->_display->setCursor(12, this->mid_x);
this->_display->printf("%.2f g", val);
this->_display->refresh();
}