Skip to content

Commit 7cb2e08

Browse files
committed
move StationG2Board.h to variants, enable ESM, add companion wifi, cleanup
1 parent da52d08 commit 7cb2e08

File tree

4 files changed

+45
-23
lines changed

4 files changed

+45
-23
lines changed
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
#pragma once
22

33
#include <Arduino.h>
4-
5-
// LoRa radio module pins for Station G2
6-
#define P_LORA_DIO_1 48
7-
#define P_LORA_NSS 11
8-
#define P_LORA_RESET 21
9-
#define P_LORA_BUSY 47
10-
#define P_LORA_SCLK 12
11-
#define P_LORA_MISO 14
12-
#define P_LORA_MOSI 13
13-
14-
// built-ins
15-
//#define PIN_LED_BUILTIN 35
16-
//#define PIN_VEXT_EN 36
17-
18-
#include "ESP32Board.h"
19-
4+
#include <helpers/ESP32Board.h>
205
#include <driver/rtc_io.h>
216

227
class StationG2Board : public ESP32Board {

variants/station_g2/platformio.ini

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,40 @@ extends = esp32_base
33
board = station-g2
44
build_flags =
55
${esp32_base.build_flags}
6+
${sensor_base.build_flags}
67
-I variants/station_g2
8+
-I src/helpers/ui
79
-D STATION_G2
810
-D RADIO_CLASS=CustomSX1262
911
-D WRAPPER_CLASS=CustomSX1262Wrapper
12+
-D P_LORA_DIO_1=48
13+
-D P_LORA_NSS=11
14+
-D P_LORA_RESET=21
15+
-D P_LORA_BUSY=47
16+
-D P_LORA_SCLK=12
17+
-D P_LORA_MISO=14
18+
-D P_LORA_MOSI=13
1019
-D LORA_TX_POWER=19
1120
; -D P_LORA_TX_LED=35
1221
-D PIN_BOARD_SDA=5
1322
-D PIN_BOARD_SCL=6
1423
-D PIN_USER_BTN=38
24+
-D PIN_GPS_RX=7
25+
-D PIN_GPS_TX=15
1526
-D SX126X_DIO2_AS_RF_SWITCH=true
1627
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
1728
-D SX126X_CURRENT_LIMIT=140
1829
; -D SX126X_RX_BOOSTED_GAIN=1 - DO NOT ENABLE THIS!
1930
; https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance
20-
-I src/helpers/ui
2131
-D DISPLAY_CLASS=SH1106Display
2232
build_src_filter = ${esp32_base.build_src_filter}
2333
+<../variants/station_g2>
34+
+<helpers/sensors>
2435
+<helpers/ui/SH1106Display.cpp>
2536
+<helpers/ui/MomentaryButton.cpp>
2637
lib_deps =
2738
${esp32_base.lib_deps}
39+
${sensor_base.lib_deps}
2840
adafruit/Adafruit SH110X @ ~2.1.13
2941
adafruit/Adafruit GFX Library @ ^1.12.1
3042

@@ -172,7 +184,6 @@ extends = Station_G2
172184
build_flags =
173185
${Station_G2.build_flags}
174186
-I examples/companion_radio/ui-new
175-
-D DISPLAY_CLASS=SH1106Display
176187
-D MAX_CONTACTS=300
177188
-D MAX_GROUP_CHANNELS=8
178189
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
@@ -190,7 +201,6 @@ extends = Station_G2
190201
build_flags =
191202
${Station_G2.build_flags}
192203
-I examples/companion_radio/ui-new
193-
-D DISPLAY_CLASS=SH1106Display
194204
-D MAX_CONTACTS=300
195205
-D MAX_GROUP_CHANNELS=8
196206
-D BLE_PIN_CODE=123456
@@ -205,3 +215,23 @@ build_src_filter = ${Station_G2.build_src_filter}
205215
lib_deps =
206216
${Station_G2.lib_deps}
207217
densaugeo/base64 @ ~1.4.0
218+
219+
[env:Station_G2_companion_radio_wifi]
220+
extends = Station_G2
221+
build_flags =
222+
${Station_G2.build_flags}
223+
-I examples/companion_radio/ui-new
224+
-D MAX_CONTACTS=300
225+
-D MAX_GROUP_CHANNELS=8
226+
-D WIFI_DEBUG_LOGGING=1
227+
-D WIFI_SSID='"myssid"'
228+
-D WIFI_PWD='"mypwd"'
229+
; -D MESH_PACKET_LOGGING=1
230+
; -D MESH_DEBUG=1
231+
build_src_filter = ${Station_G2.build_src_filter}
232+
+<helpers/esp32/*.cpp>
233+
+<../examples/companion_radio/*.cpp>
234+
+<../examples/companion_radio/ui-new/*.cpp>
235+
lib_deps =
236+
${Station_G2.lib_deps}
237+
densaugeo/base64 @ ~1.4.0

variants/station_g2/target.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ WRAPPER_CLASS radio_driver(radio, board);
1414

1515
ESP32RTCClock fallback_clock;
1616
AutoDiscoverRTCClock rtc_clock(fallback_clock);
17-
SensorManager sensors;
17+
18+
#if ENV_INCLUDE_GPS
19+
#include <helpers/sensors/MicroNMEALocationProvider.h>
20+
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
21+
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
22+
#else
23+
EnvironmentSensorManager sensors;
24+
#endif
1825

1926
#ifdef DISPLAY_CLASS
2027
DISPLAY_CLASS display;

variants/station_g2/target.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
55
#include <helpers/radiolib/RadioLibWrappers.h>
6-
#include <helpers/StationG2Board.h>
6+
#include <StationG2Board.h>
77
#include <helpers/radiolib/CustomSX1262Wrapper.h>
88
#include <helpers/AutoDiscoverRTCClock.h>
9-
#include <helpers/SensorManager.h>
9+
#include <helpers/sensors/EnvironmentSensorManager.h>
1010

1111
#ifdef DISPLAY_CLASS
1212
#include <helpers/ui/SH1106Display.h>
@@ -16,7 +16,7 @@
1616
extern StationG2Board board;
1717
extern WRAPPER_CLASS radio_driver;
1818
extern AutoDiscoverRTCClock rtc_clock;
19-
extern SensorManager sensors;
19+
extern EnvironmentSensorManager sensors;
2020

2121
#ifdef DISPLAY_CLASS
2222
extern DISPLAY_CLASS display;

0 commit comments

Comments
 (0)