JQ hace 1 año
padre
commit
ff3e888dfd

+ 19 - 19
src/helpers/ui/E213Display.cpp

@@ -1,36 +1,37 @@
 #include "E213Display.h"
+
 #include "../../MeshCore.h"
 
 bool E213Display::begin() {
   if (_init) return true;
-  
+
   powerOn();
   display.begin();
-  
+
   // Set to landscape mode rotated 180 degrees
   display.setRotation(3);
-  
+
   _init = true;
   _isOn = true;
-  
+
   clear();
   display.fastmodeOn(); // Enable fast mode for quicker (partial) updates
-  
+
   return true;
 }
 
 void E213Display::powerOn() {
-  #ifdef PIN_VEXT_EN
-    pinMode(PIN_VEXT_EN, OUTPUT);
-    digitalWrite(PIN_VEXT_EN, LOW); // Active low
-    delay(50); // Allow power to stabilize
-  #endif
+#ifdef PIN_VEXT_EN
+  pinMode(PIN_VEXT_EN, OUTPUT);
+  digitalWrite(PIN_VEXT_EN, LOW); // Active low
+  delay(50);                      // Allow power to stabilize
+#endif
 }
 
 void E213Display::powerOff() {
-  #ifdef PIN_VEXT_EN
-    digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
-  #endif
+#ifdef PIN_VEXT_EN
+  digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
+#endif
 }
 
 void E213Display::turnOn() {
@@ -70,7 +71,7 @@ void E213Display::setCursor(int x, int y) {
   display.setCursor(x, y);
 }
 
-void E213Display::print(const char* str) {
+void E213Display::print(const char *str) {
   display.print(str);
 }
 
@@ -82,10 +83,10 @@ void E213Display::drawRect(int x, int y, int w, int h) {
   display.drawRect(x, y, w, h, BLACK);
 }
 
-void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
+void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
   // Width in bytes for bitmap processing
   uint16_t widthInBytes = (w + 7) / 8;
-  
+
   // Process the bitmap row by row
   for (int by = 0; by < h; by++) {
     // Scan across the row bit by bit
@@ -94,7 +95,7 @@ void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
       uint16_t byteOffset = (by * widthInBytes) + (bx / 8);
       uint8_t bitMask = 0x80 >> (bx & 7);
       bool bitSet = bits[byteOffset] & bitMask;
-      
+
       // If the bit is set, draw the pixel
       if (bitSet) {
         display.drawPixel(x + bx, y + by, BLACK);
@@ -103,7 +104,7 @@ void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
   }
 }
 
-uint16_t E213Display::getTextWidth(const char* str) {
+uint16_t E213Display::getTextWidth(const char *str) {
   int16_t x1, y1;
   uint16_t w, h;
   display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
@@ -113,4 +114,3 @@ uint16_t E213Display::getTextWidth(const char* str) {
 void E213Display::endFrame() {
   display.update();
 }
-

+ 7 - 7
src/helpers/ui/E213Display.h

@@ -1,9 +1,10 @@
 #pragma once
 
+#include "DisplayDriver.h"
+
 #include <SPI.h>
 #include <Wire.h>
 #include <heltec-eink-modules.h>
-#include "DisplayDriver.h"
 
 // Display driver for E213 e-ink display
 class E213Display : public DisplayDriver {
@@ -12,8 +13,7 @@ class E213Display : public DisplayDriver {
   bool _isOn = false;
 
 public:
-  E213Display() : DisplayDriver(250, 122) {
-  }
+  E213Display() : DisplayDriver(250, 122) {}
 
   bool begin();
   bool isOn() override { return _isOn; }
@@ -24,13 +24,13 @@ public:
   void setTextSize(int sz) override;
   void setColor(Color c) override;
   void setCursor(int x, int y) override;
-  void print(const char* str) override;
+  void print(const char *str) override;
   void fillRect(int x, int y, int w, int h) override;
   void drawRect(int x, int y, int w, int h) override;
-  void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override;
-  uint16_t getTextWidth(const char* str) override;
+  void drawXbm(int x, int y, const uint8_t *bits, int w, int h) override;
+  uint16_t getTextWidth(const char *str) override;
   void endFrame() override;
-  
+
 private:
   void powerOn();
   void powerOff();

+ 4 - 3
variants/heltec_wireless_paper/target.cpp

@@ -1,6 +1,7 @@
-#include <Arduino.h>
 #include "target.h"
 
+#include <Arduino.h>
+
 HeltecV3Board board;
 
 static SPIClass spi;
@@ -14,7 +15,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
 SensorManager sensors;
 
 #ifdef DISPLAY_CLASS
-  DISPLAY_CLASS display;
+DISPLAY_CLASS display;
 #endif
 
 bool radio_init() {
@@ -40,5 +41,5 @@ void radio_set_tx_power(uint8_t dbm) {
 
 mesh::LocalIdentity radio_new_identity() {
   RadioNoiseListener rng(radio);
-  return mesh::LocalIdentity(&rng);  // create new random identity
+  return mesh::LocalIdentity(&rng); // create new random identity
 }

+ 5 - 5
variants/heltec_wireless_paper/target.h

@@ -2,13 +2,13 @@
 
 #define RADIOLIB_STATIC_ONLY 1
 #include <RadioLib.h>
-#include <helpers/RadioLibWrappers.h>
-#include <helpers/HeltecV3Board.h>
-#include <helpers/CustomSX1262Wrapper.h>
 #include <helpers/AutoDiscoverRTCClock.h>
+#include <helpers/CustomSX1262Wrapper.h>
+#include <helpers/HeltecV3Board.h>
+#include <helpers/RadioLibWrappers.h>
 #include <helpers/SensorManager.h>
 #ifdef DISPLAY_CLASS
-  #include <helpers/ui/E213Display.h>
+#include <helpers/ui/E213Display.h>
 #endif
 
 extern HeltecV3Board board;
@@ -17,7 +17,7 @@ extern AutoDiscoverRTCClock rtc_clock;
 extern SensorManager sensors;
 
 #ifdef DISPLAY_CLASS
-  extern DISPLAY_CLASS display;
+extern DISPLAY_CLASS display;
 #endif
 
 bool radio_init();