Skip to content

Commit 70a9990

Browse files
author
Normunds Gavars
committed
Merge branch 'dev' into minewsemi-me25ls01
2 parents 6440bca + 483b316 commit 70a9990

File tree

15 files changed

+328
-50
lines changed

15 files changed

+328
-50
lines changed

examples/companion_radio/MyMesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,10 @@ void MyMesh::begin(bool has_display) {
613613
_prefs.cr = constrain(_prefs.cr, 5, 8);
614614
_prefs.tx_power_dbm = constrain(_prefs.tx_power_dbm, 1, MAX_LORA_TX_POWER);
615615

616-
#ifdef BLE_PIN_CODE
616+
#ifdef BLE_PIN_CODE // 123456 by default
617617
if (_prefs.ble_pin == 0) {
618618
#ifdef DISPLAY_CLASS
619-
if (has_display) {
619+
if (has_display && BLE_PIN_CODE == 123456) {
620620
StdRNG rng;
621621
_active_ble_pin = rng.nextInt(100000, 999999); // random pin each session
622622
} else {

examples/companion_radio/MyMesh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#define FIRMWARE_VER_CODE 6
1111

1212
#ifndef FIRMWARE_BUILD_DATE
13-
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
13+
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
1414
#endif
1515

1616
#ifndef FIRMWARE_VERSION
17-
#define FIRMWARE_VERSION "v1.7.1"
17+
#define FIRMWARE_VERSION "v1.7.2"
1818
#endif
1919

2020
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)

examples/simple_repeater/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
/* ------------------------------ Config -------------------------------- */
2323

2424
#ifndef FIRMWARE_BUILD_DATE
25-
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
25+
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
2626
#endif
2727

2828
#ifndef FIRMWARE_VERSION
29-
#define FIRMWARE_VERSION "v1.7.1"
29+
#define FIRMWARE_VERSION "v1.7.2"
3030
#endif
3131

3232
#ifndef LORA_FREQ

examples/simple_room_server/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
/* ------------------------------ Config -------------------------------- */
2323

2424
#ifndef FIRMWARE_BUILD_DATE
25-
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
25+
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
2626
#endif
2727

2828
#ifndef FIRMWARE_VERSION
29-
#define FIRMWARE_VERSION "v1.7.1"
29+
#define FIRMWARE_VERSION "v1.7.2"
3030
#endif
3131

3232
#ifndef LORA_FREQ

src/helpers/HeltecV3Board.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <helpers/RefCountedDigitalPin.h>
55

66
// LoRa radio module pins for Heltec V3
7-
// Also for Heltec Wireless Tracker
7+
// Also for Heltec Wireless Tracker/Paper
88
#define P_LORA_DIO_1 14
99
#define P_LORA_NSS 8
1010
#define P_LORA_RESET RADIOLIB_NC
@@ -14,7 +14,9 @@
1414
#define P_LORA_MOSI 10
1515

1616
// built-ins
17-
#define PIN_VBAT_READ 1
17+
#ifndef PIN_VBAT_READ // set in platformio.ini for boards like Heltec Wireless Paper (20)
18+
#define PIN_VBAT_READ 1
19+
#endif
1820
#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2)
1921
#define PIN_ADC_CTRL 37
2022
#endif

src/helpers/ui/E213Display.cpp

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#include "E213Display.h"
2+
3+
#include "../../MeshCore.h"
4+
5+
bool E213Display::begin() {
6+
if (_init) return true;
7+
8+
powerOn();
9+
display.begin();
10+
11+
// Set to landscape mode rotated 180 degrees
12+
display.setRotation(3);
13+
14+
_init = true;
15+
_isOn = true;
16+
17+
clear();
18+
display.fastmodeOn(); // Enable fast mode for quicker (partial) updates
19+
20+
return true;
21+
}
22+
23+
void E213Display::powerOn() {
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
29+
}
30+
31+
void E213Display::powerOff() {
32+
#ifdef PIN_VEXT_EN
33+
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
34+
#endif
35+
}
36+
37+
void E213Display::turnOn() {
38+
if (!_init) begin();
39+
powerOn();
40+
_isOn = true;
41+
}
42+
43+
void E213Display::turnOff() {
44+
powerOff();
45+
_isOn = false;
46+
}
47+
48+
void E213Display::clear() {
49+
display.clear();
50+
}
51+
52+
void E213Display::startFrame(Color bkg) {
53+
// Fill screen with white first to ensure clean background
54+
display.fillRect(0, 0, width(), height(), WHITE);
55+
if (bkg == LIGHT) {
56+
// Fill with black if light background requested (inverted for e-ink)
57+
display.fillRect(0, 0, width(), height(), BLACK);
58+
}
59+
}
60+
61+
void E213Display::setTextSize(int sz) {
62+
// The library handles text size internally
63+
display.setTextSize(sz);
64+
}
65+
66+
void E213Display::setColor(Color c) {
67+
// implemented in individual display methods
68+
}
69+
70+
void E213Display::setCursor(int x, int y) {
71+
display.setCursor(x, y);
72+
}
73+
74+
void E213Display::print(const char *str) {
75+
display.print(str);
76+
}
77+
78+
void E213Display::fillRect(int x, int y, int w, int h) {
79+
display.fillRect(x, y, w, h, BLACK);
80+
}
81+
82+
void E213Display::drawRect(int x, int y, int w, int h) {
83+
display.drawRect(x, y, w, h, BLACK);
84+
}
85+
86+
void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
87+
// Width in bytes for bitmap processing
88+
uint16_t widthInBytes = (w + 7) / 8;
89+
90+
// Process the bitmap row by row
91+
for (int by = 0; by < h; by++) {
92+
// Scan across the row bit by bit
93+
for (int bx = 0; bx < w; bx++) {
94+
// Get the current bit using MSB ordering (like GxEPDDisplay)
95+
uint16_t byteOffset = (by * widthInBytes) + (bx / 8);
96+
uint8_t bitMask = 0x80 >> (bx & 7);
97+
bool bitSet = bits[byteOffset] & bitMask;
98+
99+
// If the bit is set, draw the pixel
100+
if (bitSet) {
101+
display.drawPixel(x + bx, y + by, BLACK);
102+
}
103+
}
104+
}
105+
}
106+
107+
uint16_t E213Display::getTextWidth(const char *str) {
108+
int16_t x1, y1;
109+
uint16_t w, h;
110+
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
111+
return w;
112+
}
113+
114+
void E213Display::endFrame() {
115+
display.update();
116+
}

src/helpers/ui/E213Display.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragma once
2+
3+
#include "DisplayDriver.h"
4+
5+
#include <SPI.h>
6+
#include <Wire.h>
7+
#include <heltec-eink-modules.h>
8+
9+
// Display driver for E213 e-ink display
10+
class E213Display : public DisplayDriver {
11+
EInkDisplay_VisionMasterE213 display;
12+
bool _init = false;
13+
bool _isOn = false;
14+
15+
public:
16+
E213Display() : DisplayDriver(250, 122) {}
17+
18+
bool begin();
19+
bool isOn() override { return _isOn; }
20+
void turnOn() override;
21+
void turnOff() override;
22+
void clear() override;
23+
void startFrame(Color bkg = DARK) override;
24+
void setTextSize(int sz) override;
25+
void setColor(Color c) override;
26+
void setCursor(int x, int y) override;
27+
void print(const char *str) override;
28+
void fillRect(int x, int y, int w, int h) override;
29+
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;
32+
void endFrame() override;
33+
34+
private:
35+
void powerOn();
36+
void powerOff();
37+
};

variants/heltec_v2/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ build_flags =
9696
-D DISPLAY_CLASS=SSD1306Display
9797
-D MAX_CONTACTS=100
9898
-D MAX_GROUP_CHANNELS=8
99-
-D BLE_PIN_CODE=0
99+
-D BLE_PIN_CODE=123456
100100
-D BLE_DEBUG_LOGGING=1
101101
-D OFFLINE_QUEUE_SIZE=256
102102
; -D MESH_PACKET_LOGGING=1

variants/heltec_v3/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ build_flags =
114114
-D MAX_CONTACTS=100
115115
-D MAX_GROUP_CHANNELS=8
116116
-D DISPLAY_CLASS=SSD1306Display
117-
-D BLE_PIN_CODE=0 ; dynamic, random PIN
117+
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
118118
-D BLE_DEBUG_LOGGING=1
119119
-D OFFLINE_QUEUE_SIZE=256
120120
; -D MESH_PACKET_LOGGING=1
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[Heltec_Wireless_Paper_base]
2+
extends = esp32_base
3+
board = esp32-s3-devkitc-1
4+
build_flags =
5+
${esp32_base.build_flags}
6+
-I variants/heltec_wireless_paper
7+
-D HELTEC_WIRELESS_PAPER
8+
-D RADIO_CLASS=CustomSX1262
9+
-D WRAPPER_CLASS=CustomSX1262Wrapper
10+
-D LORA_TX_POWER=22
11+
-D P_LORA_TX_LED=18
12+
; -D PIN_BOARD_SDA=17
13+
; -D PIN_BOARD_SCL=18
14+
-D PIN_USER_BTN=0
15+
-D PIN_VEXT_EN=45
16+
-D PIN_VBAT_READ=20
17+
-D PIN_ADC_CTRL=19
18+
-D SX126X_DIO2_AS_RF_SWITCH=true
19+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
20+
-D SX126X_CURRENT_LIMIT=140
21+
-D SX126X_RX_BOOSTED_GAIN=1
22+
-D DISP_CS=4
23+
-D DISP_BUSY=7
24+
-D DISP_DC=5
25+
-D DISP_RST=6
26+
-D DISP_SCLK=3
27+
-D DISP_MOSI=2
28+
-D ARDUINO_heltec_wifi_lora_32_V3
29+
-D WIRELESS_PAPER
30+
build_src_filter = ${esp32_base.build_src_filter}
31+
+<../variants/heltec_wireless_paper>
32+
lib_deps =
33+
${esp32_base.lib_deps}
34+
todd-herbert/heltec-eink-modules @ 4.5.0
35+
36+
[env:Heltec_Wireless_Paper_companion_radio_ble]
37+
extends = Heltec_Wireless_Paper_base
38+
build_flags =
39+
${Heltec_Wireless_Paper_base.build_flags}
40+
-D MAX_CONTACTS=100
41+
-D MAX_GROUP_CHANNELS=8
42+
-D DISPLAY_CLASS=E213Display
43+
-D BLE_PIN_CODE=0 ; dynamic, random PIN
44+
-D BLE_DEBUG_LOGGING=1
45+
-D OFFLINE_QUEUE_SIZE=256
46+
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
47+
+<helpers/ui/E213Display.cpp>
48+
+<helpers/esp32/*.cpp>
49+
+<../examples/companion_radio>
50+
lib_deps =
51+
${Heltec_Wireless_Paper_base.lib_deps}
52+
densaugeo/base64 @ ~1.4.0
53+
54+
[env:Heltec_Wireless_Paper_repeater]
55+
extends = Heltec_Wireless_Paper_base
56+
build_flags =
57+
${Heltec_Wireless_Paper_base.build_flags}
58+
-D DISPLAY_CLASS=E213Display
59+
-D ADVERT_NAME='"Heltec WP Repeater"'
60+
-D ADVERT_LAT=0.0
61+
-D ADVERT_LON=0.0
62+
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
63+
+<helpers/ui/E213Display.cpp>
64+
+<../examples/simple_repeater>
65+
lib_deps =
66+
${Heltec_Wireless_Paper_base.lib_deps}
67+
${esp32_ota.lib_deps}
68+
69+
[env:Heltec_Wireless_Paper_room_server]
70+
extends = Heltec_Wireless_Paper_base
71+
build_flags =
72+
${Heltec_Wireless_Paper_base.build_flags}
73+
-D DISPLAY_CLASS=E213Display
74+
-D ADVERT_NAME='"Heltec WP Room"'
75+
-D ADVERT_LAT=0.0
76+
-D ADVERT_LON=0.0
77+
-D ADMIN_PASSWORD='"password"'
78+
-D ROOM_PASSWORD='"hello"'
79+
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
80+
+<helpers/ui/E213Display.cpp>
81+
+<../examples/simple_room_server>
82+
lib_deps =
83+
${Heltec_Wireless_Paper_base.lib_deps}
84+
${esp32_ota.lib_deps}

0 commit comments

Comments
 (0)