From 181788ee4686a8eb3e46cb5997f558cbebb7901b Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Tue, 9 Jul 2024 20:06:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=84=20Formats=20display=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esp32/lib/ESP32-sveltekit/DisplayService.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/esp32/lib/ESP32-sveltekit/DisplayService.h b/esp32/lib/ESP32-sveltekit/DisplayService.h index 3549cfb..b61ed95 100644 --- a/esp32/lib/ESP32-sveltekit/DisplayService.h +++ b/esp32/lib/ESP32-sveltekit/DisplayService.h @@ -8,15 +8,13 @@ #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 -class DisplayService -{ -public: +class DisplayService { + public: DisplayService() : display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1) {}; - bool begin() - { + bool begin() { std::lock_guard guard(displayMutex); - if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { return false; } display.clearDisplay(); @@ -41,7 +39,7 @@ public: display.display(); } -private: + private: Adafruit_SSD1306 display; std::mutex displayMutex; };