Skip to content

Commit 174bcdf

Browse files
authored
Merge pull request #2942 from liamcottle/board/thinknode-m9
Add support for Elecrow ThinkNode M9
2 parents 4f12dc0 + 87bf371 commit 174bcdf

12 files changed

Lines changed: 563 additions & 1 deletion

File tree

boards/thinknode_m9.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "esp32s3_out.ld",
5+
"memory_type": "qio_opi",
6+
"partitions": "default_16MB.csv"
7+
},
8+
"core": "esp32",
9+
"extra_flags": [
10+
"-DBOARD_HAS_PSRAM",
11+
"-DARDUINO_USB_CDC_ON_BOOT=0",
12+
"-DARDUINO_USB_MODE=0",
13+
"-DARDUINO_RUNNING_CORE=1",
14+
"-DARDUINO_EVENT_RUNNING_CORE=0"
15+
],
16+
"f_cpu": "240000000L",
17+
"f_flash": "80000000L",
18+
"flash_mode": "qio",
19+
"psram_type": "qio_opi",
20+
"hwids": [
21+
[
22+
"0x303A",
23+
"0x1001"
24+
]
25+
],
26+
"mcu": "esp32s3",
27+
"variant": "ELECROW-ThinkNode-M9"
28+
},
29+
"connectivity": [
30+
"wifi",
31+
"bluetooth",
32+
"lora"
33+
],
34+
"debug": {
35+
"default_tool": "esp-builtin",
36+
"onboard_tools": [
37+
"esp-builtin"
38+
],
39+
"openocd_target": "esp32s3.cfg"
40+
},
41+
"frameworks": [
42+
"arduino",
43+
"espidf"
44+
],
45+
"name": "elecrow-thinknode-m9",
46+
"upload": {
47+
"flash_size": "16MB",
48+
"maximum_ram_size": 524288,
49+
"maximum_size": 16777216,
50+
"use_1200bps_touch": true,
51+
"wait_for_upload_port": true,
52+
"require_upload_port": true,
53+
"speed": 921600
54+
},
55+
"url": "https://www.elecrow.com/thinknode-m1-meshtastic-lora-signal-transceiver-powered-by-nrf52840-with-154-screen-support-gps.html",
56+
"vendor": "ELECROW"
57+
}

src/helpers/AutoDiscoverRTCClock.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void AutoDiscoverRTCClock::begin(TwoWire& wire) {
4242
}
4343

4444
if (i2c_probe(wire, PCF8563_ADDRESS)) {
45+
MESH_DEBUG_PRINTLN("PCF8563: Found");
4546
rtc_8563_success = rtc_8563.begin(&wire);
4647
}
4748

src/helpers/ui/ST7789Display.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
#define SCALE_Y 2.109375f // 135 / 64
1919
#endif
2020

21+
#ifdef DISPLAY_SCALE_X
22+
#define SCALE_X DISPLAY_SCALE_X
23+
#endif
24+
25+
#ifdef DISPLAY_SCALE_Y
26+
#define SCALE_Y DISPLAY_SCALE_Y
27+
#endif
28+
2129
bool ST7789Display::begin() {
2230
if(!_isOn) {
2331
pinMode(PIN_TFT_VDD_CTL, OUTPUT);
@@ -32,6 +40,9 @@ bool ST7789Display::begin() {
3240

3341
display.init();
3442
display.landscapeScreen();
43+
#ifdef DISPLAY_FLIP_VERTICALLY
44+
display.flipScreenVertically();
45+
#endif
3546
display.displayOn();
3647
setCursor(0,0);
3748

@@ -49,6 +60,9 @@ void ST7789Display::turnOn() {
4960
// Re-initialize the display
5061
display.init();
5162
display.displayOn();
63+
#ifdef DISPLAY_FLIP_VERTICALLY
64+
display.flipScreenVertically();
65+
#endif
5266
delay(20);
5367

5468
// Now turn on the backlight

src/helpers/ui/ST7789Display.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ class ST7789Display : public DisplayDriver {
1414

1515
bool i2c_probe(TwoWire& wire, uint8_t addr);
1616
public:
17-
#ifdef HELTEC_VISION_MASTER_T190
17+
#if defined(HELTEC_VISION_MASTER_T190)
1818
ST7789Display() : DisplayDriver(128, 64), display(&SPI, PIN_TFT_RST, PIN_TFT_DC, PIN_TFT_CS, GEOMETRY_RAWMODE, 320, 170,PIN_TFT_SDA,-1,PIN_TFT_SCL) {_isOn = false;}
19+
#elif defined(THINKNODE_M9)
20+
ST7789Display() : DisplayDriver(128, 64), display(&SPI, ST7789_RESET, ST7789_RS, ST7789_CS, GEOMETRY_RAWMODE, 320, 240, ST7789_SDA, ST7789_MISO, ST7789_SCK) {_isOn = false;}
1921
#else
2022
ST7789Display() : DisplayDriver(128, 64), display(&SPI1, PIN_TFT_RST, PIN_TFT_DC, PIN_TFT_CS, GEOMETRY_RAWMODE, 240, 135) {_isOn = false;}
2123
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include "ThinkNodeM9Board.h"
2+
3+
void ThinkNodeM9Board::begin() {
4+
5+
// power on screen
6+
pinMode(VEXT_ENABLE, OUTPUT);
7+
digitalWrite(VEXT_ENABLE, VEXT_ON_VALUE);
8+
9+
ESP32Board::begin();
10+
11+
}
12+
13+
void ThinkNodeM9Board::powerOff() {
14+
enterDeepSleep(0);
15+
}
16+
17+
uint32_t ThinkNodeM9Board::getIRQGpio() {
18+
return LORA_DIO0;
19+
}
20+
21+
const char* ThinkNodeM9Board::getManufacturerName() const {
22+
return "Elecrow ThinkNode M9";
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <Arduino.h>
4+
#include <helpers/ESP32Board.h>
5+
6+
class ThinkNodeM9Board : public ESP32Board {
7+
8+
public:
9+
void begin();
10+
void powerOff() override;
11+
const char* getManufacturerName() const override;
12+
uint32_t getIRQGpio() override;
13+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Need this file for ESP32-S3
2+
// No need to modify this file, changes to pins imported from variant.h
3+
// Most is similar to https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h
4+
5+
#ifndef Pins_Arduino_h
6+
#define Pins_Arduino_h
7+
8+
#include <stdint.h>
9+
#include <variant.h>
10+
11+
#define USB_VID 0x303a
12+
#define USB_PID 0x1001
13+
14+
// Serial
15+
static const uint8_t TX = 43;
16+
static const uint8_t RX = 44;
17+
18+
// Default SPI will be mapped to Radio
19+
static const uint8_t SS = LORA_CS;
20+
static const uint8_t SCK = SPI_SCK;
21+
static const uint8_t MOSI = SPI_MOSI;
22+
static const uint8_t MISO = SPI_MISO;
23+
24+
// The default Wire will be mapped to PMU and RTC
25+
static const uint8_t SCL = I2C_SCL;
26+
static const uint8_t SDA = I2C_SDA;
27+
28+
static const uint8_t A0 = 1;
29+
static const uint8_t A1 = 2;
30+
static const uint8_t A2 = 3;
31+
static const uint8_t A3 = 4;
32+
static const uint8_t A4 = 5;
33+
static const uint8_t A5 = 6;
34+
static const uint8_t A6 = 7;
35+
static const uint8_t A7 = 8;
36+
static const uint8_t A8 = 9;
37+
static const uint8_t A9 = 10;
38+
static const uint8_t A10 = 11;
39+
static const uint8_t A11 = 12;
40+
static const uint8_t A12 = 13;
41+
static const uint8_t A13 = 14;
42+
static const uint8_t A14 = 15;
43+
static const uint8_t A15 = 16;
44+
static const uint8_t A16 = 17;
45+
static const uint8_t A17 = 18;
46+
static const uint8_t A18 = 19;
47+
static const uint8_t A19 = 20;
48+
49+
static const uint8_t T1 = 1;
50+
static const uint8_t T2 = 2;
51+
static const uint8_t T3 = 3;
52+
static const uint8_t T4 = 4;
53+
static const uint8_t T5 = 5;
54+
static const uint8_t T6 = 6;
55+
static const uint8_t T7 = 7;
56+
static const uint8_t T8 = 8;
57+
static const uint8_t T9 = 9;
58+
static const uint8_t T10 = 10;
59+
static const uint8_t T11 = 11;
60+
static const uint8_t T12 = 12;
61+
static const uint8_t T13 = 13;
62+
static const uint8_t T14 = 14;
63+
64+
#endif /* Pins_Arduino_h */
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
[ThinkNode_M9]
2+
extends = esp32_base
3+
board = thinknode_m9
4+
board_check = true
5+
board_build.partitions = default_16MB.csv
6+
upload_protocol = esptool
7+
build_flags =
8+
${esp32_base.build_flags}
9+
${sensor_base.build_flags}
10+
-I variants/thinknode_m9
11+
-I src/helpers/esp32
12+
-I src/helpers/sensors
13+
-D THINKNODE_M9
14+
-D PIN_BUZZER=9
15+
-D PIN_BOARD_SCL=6
16+
-D PIN_BOARD_SDA=7
17+
-D P_LORA_NSS=39
18+
-D P_LORA_RESET=45
19+
-D P_LORA_BUSY=41
20+
-D P_LORA_SCLK=40
21+
-D P_LORA_MISO=38
22+
-D P_LORA_MOSI=47
23+
-D P_LORA_DIO_1=42
24+
-D USE_LR1110
25+
-D RF_SWITCH_TABLE
26+
-D RADIO_CLASS=CustomLR1110
27+
-D WRAPPER_CLASS=CustomLR1110Wrapper
28+
-D LR11X0_DIO_AS_RF_SWITCH=true
29+
-D LR11X0_DIO3_TCXO_VOLTAGE=3.3
30+
-D LORA_TX_POWER=22
31+
-D DISPLAY_CLASS=ST7789Display
32+
-D DISPLAY_FLIP_VERTICALLY=1
33+
-D DISPLAY_SCALE_X=2.5f ; 320 / 128
34+
-D DISPLAY_SCALE_Y=3.75f ; 240 / 64
35+
-D ST7789
36+
-D PIN_TFT_VDD_CTL=-1
37+
-D PIN_TFT_LEDA_CTL=17
38+
-D PIN_TFT_RST=14
39+
-D PIN_GPS_RX=3
40+
-D PIN_GPS_TX=2
41+
-D PIN_GPS_EN=11
42+
-D PIN_GPS_EN_ACTIVE=LOW
43+
-D PIN_GPS_RESET=5
44+
-D PIN_GPS_RESET_ACTIVE=HIGH
45+
-D GPS_BAUD_RATE=115200
46+
-D ENV_INCLUDE_GPS=1
47+
-D PIN_VBAT_READ=13
48+
build_src_filter = ${esp32_base.build_src_filter}
49+
+<helpers/sensors/EnvironmentSensorManager.cpp>
50+
+<helpers/ui/ST7789Display.cpp>
51+
+<helpers/ui/OLEDDisplay.cpp>
52+
+<helpers/ui/OLEDDisplayFonts.cpp>
53+
+<helpers/*.cpp>
54+
+<../variants/thinknode_m9>
55+
lib_deps = ${esp32_base.lib_deps}
56+
${sensor_base.lib_deps}
57+
adafruit/Adafruit GFX Library @ ^1.12.1
58+
59+
[env:ThinkNode_M9_repeater_]
60+
extends = ThinkNode_M9
61+
build_flags =
62+
${ThinkNode_M9.build_flags}
63+
-D ADVERT_NAME='"ThinkNode M9 Repeater"'
64+
-D ADVERT_LAT=0.0
65+
-D ADVERT_LON=0.0
66+
-D ADMIN_PASSWORD='"password"'
67+
-D MAX_NEIGHBOURS=50
68+
;-D MESH_PACKET_LOGGING=1
69+
;-D MESH_DEBUG=1
70+
build_src_filter = ${ThinkNode_M9.build_src_filter}
71+
+<../examples/simple_repeater/*.cpp>
72+
lib_deps =
73+
${ThinkNode_M9.lib_deps}
74+
${esp32_ota.lib_deps}
75+
76+
[env:ThinkNode_M9_room_server_]
77+
extends = ThinkNode_M9
78+
build_src_filter = ${ThinkNode_M9.build_src_filter}
79+
+<../examples/simple_room_server>
80+
build_flags =
81+
${ThinkNode_M9.build_flags}
82+
-D ADVERT_NAME='"ThinkNode M9 Room Server"'
83+
-D ADVERT_LAT=0.0
84+
-D ADVERT_LON=0.0
85+
-D ADMIN_PASSWORD='"password"'
86+
-D ROOM_PASSWORD='"hello"'
87+
; -D MESH_PACKET_LOGGING=1
88+
; -D MESH_DEBUG=1
89+
lib_deps =
90+
${ThinkNode_M9.lib_deps}
91+
${esp32_ota.lib_deps}
92+
93+
[env:ThinkNode_M9_companion_radio_ble_]
94+
extends = ThinkNode_M9
95+
build_flags =
96+
${ThinkNode_M9.build_flags}
97+
-I examples/companion_radio/ui-new
98+
-D MAX_CONTACTS=350
99+
-D MAX_GROUP_CHANNELS=40
100+
-D BLE_PIN_CODE=123456
101+
-D OFFLINE_QUEUE_SIZE=256
102+
; -D BLE_DEBUG_LOGGING=1
103+
; -D MESH_PACKET_LOGGING=1
104+
build_src_filter = ${ThinkNode_M9.build_src_filter}
105+
+<helpers/esp32/*.cpp>
106+
+<helpers/ui/buzzer.cpp>
107+
+<helpers/ui/MomentaryButton.cpp>
108+
+<../examples/companion_radio/*.cpp>
109+
+<../examples/companion_radio/ui-new/*.cpp>
110+
lib_deps =
111+
${ThinkNode_M9.lib_deps}
112+
densaugeo/base64 @ ~1.4.0
113+
end2endzone/NonBlockingRTTTL@^1.3.0
114+
115+
[env:ThinkNode_M9_companion_radio_usb_]
116+
extends = ThinkNode_M9
117+
build_flags =
118+
${ThinkNode_M9.build_flags}
119+
-I examples/companion_radio/ui-new
120+
-D MAX_CONTACTS=350
121+
-D MAX_GROUP_CHANNELS=40
122+
-D OFFLINE_QUEUE_SIZE=256
123+
build_src_filter = ${ThinkNode_M9.build_src_filter}
124+
+<helpers/esp32/*.cpp>
125+
+<helpers/ui/buzzer.cpp>
126+
+<helpers/ui/MomentaryButton.cpp>
127+
+<../examples/companion_radio/*.cpp>
128+
+<../examples/companion_radio/ui-new/*.cpp>
129+
lib_deps =
130+
${ThinkNode_M9.lib_deps}
131+
densaugeo/base64 @ ~1.4.0
132+
end2endzone/NonBlockingRTTTL@^1.3.0
133+
134+
[env:ThinkNode_M9_companion_radio_wifi_]
135+
extends = ThinkNode_M9
136+
build_flags =
137+
${ThinkNode_M9.build_flags}
138+
-I examples/companion_radio/ui-new
139+
-D MAX_CONTACTS=350
140+
-D MAX_GROUP_CHANNELS=40
141+
-D WIFI_DEBUG_LOGGING=1
142+
-D WIFI_SSID='"myssid"'
143+
-D WIFI_PWD='"mypwd"'
144+
-D OFFLINE_QUEUE_SIZE=256
145+
; -D MESH_PACKET_LOGGING=1
146+
build_src_filter = ${ThinkNode_M9.build_src_filter}
147+
+<helpers/esp32/*.cpp>
148+
+<helpers/ui/buzzer.cpp>
149+
+<helpers/ui/MomentaryButton.cpp>
150+
+<../examples/companion_radio/*.cpp>
151+
+<../examples/companion_radio/ui-new/*.cpp>
152+
lib_deps =
153+
${ThinkNode_M9.lib_deps}
154+
densaugeo/base64 @ ~1.4.0
155+
end2endzone/NonBlockingRTTTL@^1.3.0
156+
157+
[env:ThinkNode_M9_kiss_modem]
158+
extends = ThinkNode_M9
159+
build_src_filter = ${ThinkNode_M9.build_src_filter}
160+
+<../examples/kiss_modem/>

0 commit comments

Comments
 (0)