formatting

This commit is contained in:
JQ 2025-06-27 23:30:52 -07:00
parent e417c43c30
commit ff3e888dfd
4 changed files with 35 additions and 34 deletions

View file

@ -1,4 +1,5 @@
#include "E213Display.h" #include "E213Display.h"
#include "../../MeshCore.h" #include "../../MeshCore.h"
bool E213Display::begin() { bool E213Display::begin() {
@ -20,17 +21,17 @@ bool E213Display::begin() {
} }
void E213Display::powerOn() { void E213Display::powerOn() {
#ifdef PIN_VEXT_EN #ifdef PIN_VEXT_EN
pinMode(PIN_VEXT_EN, OUTPUT); pinMode(PIN_VEXT_EN, OUTPUT);
digitalWrite(PIN_VEXT_EN, LOW); // Active low digitalWrite(PIN_VEXT_EN, LOW); // Active low
delay(50); // Allow power to stabilize delay(50); // Allow power to stabilize
#endif #endif
} }
void E213Display::powerOff() { void E213Display::powerOff() {
#ifdef PIN_VEXT_EN #ifdef PIN_VEXT_EN
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
#endif #endif
} }
void E213Display::turnOn() { void E213Display::turnOn() {
@ -70,7 +71,7 @@ void E213Display::setCursor(int x, int y) {
display.setCursor(x, y); display.setCursor(x, y);
} }
void E213Display::print(const char* str) { void E213Display::print(const char *str) {
display.print(str); display.print(str);
} }
@ -82,7 +83,7 @@ void E213Display::drawRect(int x, int y, int w, int h) {
display.drawRect(x, y, w, h, BLACK); 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 // Width in bytes for bitmap processing
uint16_t widthInBytes = (w + 7) / 8; uint16_t widthInBytes = (w + 7) / 8;
@ -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; int16_t x1, y1;
uint16_t w, h; uint16_t w, h;
display.getTextBounds(str, 0, 0, &x1, &y1, &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() { void E213Display::endFrame() {
display.update(); display.update();
} }

View file

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

View file

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

View file

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