Просмотр исходного кода

add display to station G2 firmwares

JQ 1 год назад
Родитель
Сommit
203a7f2bd3

+ 8 - 3
variants/station_g2/platformio.ini

@@ -9,18 +9,23 @@ build_flags =
   -D WRAPPER_CLASS=CustomSX1262Wrapper
   -D LORA_TX_POWER=7
 ;  -D P_LORA_TX_LED=35
-;  -D PIN_BOARD_SDA=5
-;  -D PIN_BOARD_SCL=6
-  -D PIN_USER_BTN=0
+  -D PIN_BOARD_SDA=5
+  -D PIN_BOARD_SCL=6
+  -D PIN_USER_BTN=38
   -D SX126X_DIO2_AS_RF_SWITCH=true
   -D SX126X_DIO3_TCXO_VOLTAGE=1.8
   -D SX126X_CURRENT_LIMIT=140
 ;  -D SX126X_RX_BOOSTED_GAIN=1 - DO NOT ENABLE THIS!
+  -I src/helpers/ui
+  -D DISPLAY_CLASS=SH1106Display
 ;  https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance
 build_src_filter = ${esp32_base.build_src_filter}
   +<../variants/station_g2>
+  +<helpers/ui/SH1106Display.cpp>
 lib_deps =
   ${esp32_base.lib_deps}
+  adafruit/Adafruit SH110X @ ~2.1.13
+  adafruit/Adafruit GFX Library @ ^1.12.1
 
 [env:Station_G2_repeater]
 extends = Station_G2

+ 4 - 0
variants/station_g2/target.cpp

@@ -16,6 +16,10 @@ ESP32RTCClock fallback_clock;
 AutoDiscoverRTCClock rtc_clock(fallback_clock);
 SensorManager sensors;
 
+#ifdef DISPLAY_CLASS
+  DISPLAY_CLASS display;
+#endif
+
 #ifndef LORA_CR
   #define LORA_CR      5
 #endif

+ 8 - 0
variants/station_g2/target.h

@@ -8,11 +8,19 @@
 #include <helpers/AutoDiscoverRTCClock.h>
 #include <helpers/SensorManager.h>
 
+#ifdef DISPLAY_CLASS
+  #include <helpers/ui/SH1106Display.h>
+#endif
+
 extern StationG2Board board;
 extern WRAPPER_CLASS radio_driver;
 extern AutoDiscoverRTCClock rtc_clock;
 extern SensorManager sensors;
 
+#ifdef DISPLAY_CLASS
+  extern DISPLAY_CLASS display;
+#endif
+
 bool radio_init();
 uint32_t radio_get_rng_seed();
 void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);