Skip to content

Commit ff3e888

Browse files
committed
formatting
1 parent e417c43 commit ff3e888

File tree

4 files changed

+35
-34
lines changed

4 files changed

+35
-34
lines changed

src/helpers/ui/E213Display.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
#include "E213Display.h"
2+
23
#include "../../MeshCore.h"
34

45
bool E213Display::begin() {
56
if (_init) return true;
6-
7+
78
powerOn();
89
display.begin();
9-
10+
1011
// Set to landscape mode rotated 180 degrees
1112
display.setRotation(3);
12-
13+
1314
_init = true;
1415
_isOn = true;
15-
16+
1617
clear();
1718
display.fastmodeOn(); // Enable fast mode for quicker (partial) updates
18-
19+
1920
return true;
2021
}
2122

2223
void E213Display::powerOn() {
23-
#ifdef PIN_VEXT_EN
24-
pinMode(PIN_VEXT_EN, OUTPUT);
25-
digitalWrite(PIN_VEXT_EN, LOW); // Active low
26-
delay(50); // Allow power to stabilize
27-
#endif
24+
#ifdef PIN_VEXT_EN
25+
pinMode(PIN_VEXT_EN, OUTPUT);
26+
digitalWrite(PIN_VEXT_EN, LOW); // Active low
27+
delay(50); // Allow power to stabilize
28+
#endif
2829
}
2930

3031
void E213Display::powerOff() {
31-
#ifdef PIN_VEXT_EN
32-
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
33-
#endif
32+
#ifdef PIN_VEXT_EN
33+
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
34+
#endif
3435
}
3536

3637
void E213Display::turnOn() {
@@ -70,7 +71,7 @@ void E213Display::setCursor(int x, int y) {
7071
display.setCursor(x, y);
7172
}
7273

73-
void E213Display::print(const char* str) {
74+
void E213Display::print(const char *str) {
7475
display.print(str);
7576
}
7677

@@ -82,10 +83,10 @@ void E213Display::drawRect(int x, int y, int w, int h) {
8283
display.drawRect(x, y, w, h, BLACK);
8384
}
8485

85-
void E213Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
86+
void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
8687
// Width in bytes for bitmap processing
8788
uint16_t widthInBytes = (w + 7) / 8;
88-
89+
8990
// Process the bitmap row by row
9091
for (int by = 0; by < h; by++) {
9192
// 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) {
9495
uint16_t byteOffset = (by * widthInBytes) + (bx / 8);
9596
uint8_t bitMask = 0x80 >> (bx & 7);
9697
bool bitSet = bits[byteOffset] & bitMask;
97-
98+
9899
// If the bit is set, draw the pixel
99100
if (bitSet) {
100101
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) {
103104
}
104105
}
105106

106-
uint16_t E213Display::getTextWidth(const char* str) {
107+
uint16_t E213Display::getTextWidth(const char *str) {
107108
int16_t x1, y1;
108109
uint16_t w, h;
109110
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
@@ -113,4 +114,3 @@ uint16_t E213Display::getTextWidth(const char* str) {
113114
void E213Display::endFrame() {
114115
display.update();
115116
}
116-

src/helpers/ui/E213Display.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#pragma once
22

3+
#include "DisplayDriver.h"
4+
35
#include <SPI.h>
46
#include <Wire.h>
57
#include <heltec-eink-modules.h>
6-
#include "DisplayDriver.h"
78

89
// Display driver for E213 e-ink display
910
class E213Display : public DisplayDriver {
@@ -12,8 +13,7 @@ class E213Display : public DisplayDriver {
1213
bool _isOn = false;
1314

1415
public:
15-
E213Display() : DisplayDriver(250, 122) {
16-
}
16+
E213Display() : DisplayDriver(250, 122) {}
1717

1818
bool begin();
1919
bool isOn() override { return _isOn; }
@@ -24,13 +24,13 @@ class E213Display : public DisplayDriver {
2424
void setTextSize(int sz) override;
2525
void setColor(Color c) override;
2626
void setCursor(int x, int y) override;
27-
void print(const char* str) override;
27+
void print(const char *str) override;
2828
void fillRect(int x, int y, int w, int h) override;
2929
void drawRect(int x, int y, int w, int h) override;
30-
void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override;
31-
uint16_t getTextWidth(const char* str) override;
30+
void drawXbm(int x, int y, const uint8_t *bits, int w, int h) override;
31+
uint16_t getTextWidth(const char *str) override;
3232
void endFrame() override;
33-
33+
3434
private:
3535
void powerOn();
3636
void powerOff();

variants/heltec_wireless_paper/target.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#include <Arduino.h>
21
#include "target.h"
32

3+
#include <Arduino.h>
4+
45
HeltecV3Board board;
56

67
static SPIClass spi;
@@ -14,7 +15,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
1415
SensorManager sensors;
1516

1617
#ifdef DISPLAY_CLASS
17-
DISPLAY_CLASS display;
18+
DISPLAY_CLASS display;
1819
#endif
1920

2021
bool radio_init() {
@@ -40,5 +41,5 @@ void radio_set_tx_power(uint8_t dbm) {
4041

4142
mesh::LocalIdentity radio_new_identity() {
4243
RadioNoiseListener rng(radio);
43-
return mesh::LocalIdentity(&rng); // create new random identity
44+
return mesh::LocalIdentity(&rng); // create new random identity
4445
}

variants/heltec_wireless_paper/target.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
5-
#include <helpers/RadioLibWrappers.h>
6-
#include <helpers/HeltecV3Board.h>
7-
#include <helpers/CustomSX1262Wrapper.h>
85
#include <helpers/AutoDiscoverRTCClock.h>
6+
#include <helpers/CustomSX1262Wrapper.h>
7+
#include <helpers/HeltecV3Board.h>
8+
#include <helpers/RadioLibWrappers.h>
99
#include <helpers/SensorManager.h>
1010
#ifdef DISPLAY_CLASS
11-
#include <helpers/ui/E213Display.h>
11+
#include <helpers/ui/E213Display.h>
1212
#endif
1313

1414
extern HeltecV3Board board;
@@ -17,7 +17,7 @@ extern AutoDiscoverRTCClock rtc_clock;
1717
extern SensorManager sensors;
1818

1919
#ifdef DISPLAY_CLASS
20-
extern DISPLAY_CLASS display;
20+
extern DISPLAY_CLASS display;
2121
#endif
2222

2323
bool radio_init();

0 commit comments

Comments
 (0)