diff --git a/lib/GfxRenderer/GfxRenderer.cpp b/lib/GfxRenderer/GfxRenderer.cpp index 7dd96dd7..5cb957a3 100644 --- a/lib/GfxRenderer/GfxRenderer.cpp +++ b/lib/GfxRenderer/GfxRenderer.cpp @@ -49,8 +49,7 @@ void GfxRenderer::drawPixel(const int x, const int y, const bool state) const { rotateCoordinates(x, y, &rotatedX, &rotatedY); // Bounds checking against physical panel dimensions - if (rotatedX < 0 || rotatedX >= HalDisplay::DISPLAY_WIDTH || rotatedY < 0 || - rotatedY >= HalDisplay::DISPLAY_HEIGHT) { + if (rotatedX < 0 || rotatedX >= HalDisplay::DISPLAY_WIDTH || rotatedY < 0 || rotatedY >= HalDisplay::DISPLAY_HEIGHT) { Serial.printf("[%lu] [GFX] !! Outside range (%d, %d) -> (%d, %d)\n", millis(), x, y, rotatedX, rotatedY); return; } @@ -397,9 +396,7 @@ void GfxRenderer::invertScreen() const { } } -void GfxRenderer::displayBuffer(const HalDisplay::RefreshMode refreshMode) const { - display.displayBuffer(refreshMode); -} +void GfxRenderer::displayBuffer(const HalDisplay::RefreshMode refreshMode) const { display.displayBuffer(refreshMode); } std::string GfxRenderer::truncatedText(const int fontId, const char* text, const int maxWidth, const EpdFontFamily::Style style) const { diff --git a/lib/GfxRenderer/GfxRenderer.h b/lib/GfxRenderer/GfxRenderer.h index ebf194e5..733975f4 100644 --- a/lib/GfxRenderer/GfxRenderer.h +++ b/lib/GfxRenderer/GfxRenderer.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include diff --git a/lib/hal/HalDisplay.cpp b/lib/hal/HalDisplay.cpp index 180b85be..6f69d7fc 100644 --- a/lib/hal/HalDisplay.cpp +++ b/lib/hal/HalDisplay.cpp @@ -7,15 +7,12 @@ HalDisplay::HalDisplay() : einkDisplay(EPD_SCLK, EPD_MOSI, EPD_CS, EPD_DC, EPD_R HalDisplay::~HalDisplay() {} -void HalDisplay::begin() { - einkDisplay.begin(); -} +void HalDisplay::begin() { einkDisplay.begin(); } -void HalDisplay::clearScreen(uint8_t color) const { - einkDisplay.clearScreen(color); -} +void HalDisplay::clearScreen(uint8_t color) const { einkDisplay.clearScreen(color); } -void HalDisplay::drawImage(const uint8_t* imageData, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool fromProgmem) const { +void HalDisplay::drawImage(const uint8_t* imageData, uint16_t x, uint16_t y, uint16_t w, uint16_t h, + bool fromProgmem) const { einkDisplay.drawImage(imageData, x, y, w, h, fromProgmem); } @@ -31,38 +28,24 @@ EInkDisplay::RefreshMode convertRefreshMode(HalDisplay::RefreshMode mode) { } } -void HalDisplay::displayBuffer(HalDisplay::RefreshMode mode) { - einkDisplay.displayBuffer(convertRefreshMode(mode)); -} +void HalDisplay::displayBuffer(HalDisplay::RefreshMode mode) { einkDisplay.displayBuffer(convertRefreshMode(mode)); } void HalDisplay::refreshDisplay(HalDisplay::RefreshMode mode, bool turnOffScreen) { einkDisplay.refreshDisplay(convertRefreshMode(mode), turnOffScreen); } -void HalDisplay::deepSleep() { - einkDisplay.deepSleep(); -} +void HalDisplay::deepSleep() { einkDisplay.deepSleep(); } -uint8_t* HalDisplay::getFrameBuffer() const { - return einkDisplay.getFrameBuffer(); -} +uint8_t* HalDisplay::getFrameBuffer() const { return einkDisplay.getFrameBuffer(); } void HalDisplay::copyGrayscaleBuffers(const uint8_t* lsbBuffer, const uint8_t* msbBuffer) { einkDisplay.copyGrayscaleBuffers(lsbBuffer, msbBuffer); } -void HalDisplay::copyGrayscaleLsbBuffers(const uint8_t* lsbBuffer) { - einkDisplay.copyGrayscaleLsbBuffers(lsbBuffer); -} +void HalDisplay::copyGrayscaleLsbBuffers(const uint8_t* lsbBuffer) { einkDisplay.copyGrayscaleLsbBuffers(lsbBuffer); } -void HalDisplay::copyGrayscaleMsbBuffers(const uint8_t* msbBuffer) { - einkDisplay.copyGrayscaleMsbBuffers(msbBuffer); -} +void HalDisplay::copyGrayscaleMsbBuffers(const uint8_t* msbBuffer) { einkDisplay.copyGrayscaleMsbBuffers(msbBuffer); } -void HalDisplay::cleanupGrayscaleBuffers(const uint8_t* bwBuffer) { - einkDisplay.cleanupGrayscaleBuffers(bwBuffer); -} +void HalDisplay::cleanupGrayscaleBuffers(const uint8_t* bwBuffer) { einkDisplay.cleanupGrayscaleBuffers(bwBuffer); } -void HalDisplay::displayGrayBuffer() { - einkDisplay.displayGrayBuffer(); -} +void HalDisplay::displayGrayBuffer() { einkDisplay.displayGrayBuffer(); } diff --git a/lib/hal/HalDisplay.h b/lib/hal/HalDisplay.h index 72b9155e..6eb7156b 100644 --- a/lib/hal/HalDisplay.h +++ b/lib/hal/HalDisplay.h @@ -1,6 +1,6 @@ #pragma once -#include #include +#include class HalDisplay { public: @@ -28,7 +28,8 @@ class HalDisplay { // Frame buffer operations void clearScreen(uint8_t color = 0xFF) const; - void drawImage(const uint8_t* imageData, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool fromProgmem = false) const; + void drawImage(const uint8_t* imageData, uint16_t x, uint16_t y, uint16_t w, uint16_t h, + bool fromProgmem = false) const; void displayBuffer(RefreshMode mode = RefreshMode::FAST_REFRESH); void refreshDisplay(RefreshMode mode = RefreshMode::FAST_REFRESH, bool turnOffScreen = false); diff --git a/lib/hal/HalGPIO.cpp b/lib/hal/HalGPIO.cpp index 20bd5577..6d2510a5 100644 --- a/lib/hal/HalGPIO.cpp +++ b/lib/hal/HalGPIO.cpp @@ -9,33 +9,19 @@ void HalGPIO::begin() { pinMode(UART0_RXD, INPUT); } -void HalGPIO::update() { - inputMgr.update(); -} +void HalGPIO::update() { inputMgr.update(); } -bool HalGPIO::isPressed(uint8_t buttonIndex) const { - return inputMgr.isPressed(buttonIndex); -} +bool HalGPIO::isPressed(uint8_t buttonIndex) const { return inputMgr.isPressed(buttonIndex); } -bool HalGPIO::wasPressed(uint8_t buttonIndex) const { - return inputMgr.wasPressed(buttonIndex); -} +bool HalGPIO::wasPressed(uint8_t buttonIndex) const { return inputMgr.wasPressed(buttonIndex); } -bool HalGPIO::wasAnyPressed() const { - return inputMgr.wasAnyPressed(); -} +bool HalGPIO::wasAnyPressed() const { return inputMgr.wasAnyPressed(); } -bool HalGPIO::wasReleased(uint8_t buttonIndex) const { - return inputMgr.wasReleased(buttonIndex); -} +bool HalGPIO::wasReleased(uint8_t buttonIndex) const { return inputMgr.wasReleased(buttonIndex); } -bool HalGPIO::wasAnyReleased() const { - return inputMgr.wasAnyReleased(); -} +bool HalGPIO::wasAnyReleased() const { return inputMgr.wasAnyReleased(); } -unsigned long HalGPIO::getHeldTime() const { - return inputMgr.getHeldTime(); -} +unsigned long HalGPIO::getHeldTime() const { return inputMgr.getHeldTime(); } void HalGPIO::startDeepSleep() { esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW); diff --git a/lib/hal/HalGPIO.h b/lib/hal/HalGPIO.h index fc8b2cb6..83244f5b 100644 --- a/lib/hal/HalGPIO.h +++ b/lib/hal/HalGPIO.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include // Display SPI pins (custom pins for XteinkX4, not hardware SPI defaults) #define EPD_SCLK 8 // SPI Clock @@ -12,11 +12,11 @@ #define EPD_RST 5 // Reset #define EPD_BUSY 6 // Busy -#define SPI_MISO 7 // SPI MISO, shared between SD card and display (Master In Slave Out) +#define SPI_MISO 7 // SPI MISO, shared between SD card and display (Master In Slave Out) #define BAT_GPIO0 0 // Battery voltage -#define UART0_RXD 20 // Used for USB connection detection +#define UART0_RXD 20 // Used for USB connection detection class HalGPIO { #if CROSSPOINT_EMULATED == 0 diff --git a/src/activities/util/FullScreenMessageActivity.h b/src/activities/util/FullScreenMessageActivity.h index b6cf8bed..93909503 100644 --- a/src/activities/util/FullScreenMessageActivity.h +++ b/src/activities/util/FullScreenMessageActivity.h @@ -1,6 +1,6 @@ #pragma once -#include #include +#include #include #include diff --git a/src/main.cpp b/src/main.cpp index 7880a2c5..2de730e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,9 +1,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include @@ -341,8 +341,7 @@ void loop() { // Check for any user activity (button press or release) or active background work static unsigned long lastActivityTime = millis(); - if (gpio.wasAnyPressed() || gpio.wasAnyReleased() || - (currentActivity && currentActivity->preventAutoSleep())) { + if (gpio.wasAnyPressed() || gpio.wasAnyReleased() || (currentActivity && currentActivity->preventAutoSleep())) { lastActivityTime = millis(); // Reset inactivity timer } @@ -354,8 +353,7 @@ void loop() { return; } - if (gpio.isPressed(HalGPIO::BTN_POWER) && - gpio.getHeldTime() > SETTINGS.getPowerButtonDuration()) { + if (gpio.isPressed(HalGPIO::BTN_POWER) && gpio.getHeldTime() > SETTINGS.getPowerButtonDuration()) { enterDeepSleep(); // This should never be hit as `enterDeepSleep` calls esp_deep_sleep_start return;