richonguzman / LoRa_APRS_Tracker

LoRa APRS Tracker with Tx and Rx capabilities, Messages, Wx, Winlink and more...
MIT License
168 stars 45 forks source link

Support for TTGO T-Beam v1.2 with SX1276 (915 MHz) #132

Open wb2osz opened 2 days ago

wb2osz commented 2 days ago

Kindly consider adding support for TTGO T-Beam v1.2 with SX1276 for 915 MHz. I was able to get it working with the following diffs. platformio.ini had sections for TTGO_T_Beam_V1_2 and TTGO_T_Beam_V1_2_SX1262. I added a similar section for TTGO_T_Beam_V1_2_SX1276. Your instructions did not mention changing the "[platformio] default_envs" line but I figured that one out.

diff --git a/platformio.ini b/platformio.ini
index fcc9032..e7cf5b6 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -9,7 +9,7 @@
 ; https://docs.platformio.org/page/projectconf.html

 [platformio]
-default_envs = ttgo-t-beam-v1_2
+default_envs = ttgo-t-beam-v1_2_SX1276

 [env]
 framework = arduino
@@ -60,6 +60,23 @@ lib_deps =
    adafruit/Adafruit SH110X @ 2.1.10

+[env:ttgo-t-beam-v1_2_SX1276]
+extends = env:esp32
+board = ttgo-t-beam
+build_flags =
+   -Werror -Wall
+   -DTTGO_T_Beam_V1_2_SX1276
+   -DHAS_SX1276
+   -DHAS_AXP2101
+   -DHAS_BT_CLASSIC
+lib_deps =
+   ${common.lib_deps}
+   lewisxhe/XPowersLib @ 0.2.4
+   adafruit/Adafruit GFX Library @ 1.11.9
+   adafruit/Adafruit SSD1306 @ 2.5.10
+   adafruit/Adafruit SH110X @ 2.1.10
+
+
 [env:ttgo-t-beam-v1_2_SX1262]
 extends = env:esp32
 board = ttgo-t-beam
diff --git a/src/boards_pinout.h b/src/boards_pinout.h
index 6dfd393..67e010f 100644
--- a/src/boards_pinout.h
+++ b/src/boards_pinout.h
@@ -6,7 +6,7 @@
 #undef OLED_RST

-#if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0)
+#if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2_SX1276)
     #define OLED_SDA            21
     #define OLED_SCL            22
     #define OLED_RST            16
diff --git a/src/menu_utils.cpp b/src/menu_utils.cpp
index c7b3de1..bbe2153 100644
--- a/src/menu_utils.cpp
+++ b/src/menu_utils.cpp
@@ -620,7 +620,7 @@ namespace MENU_Utils {
                             sixthRowMainMenu += "mA";
                         }
                     #endif
-                    #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_S3_SUPREME_V3)
+                    #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276) || defined(TTGO_T_Beam_S3_SUPREME_V3)
                         if (Config.notification.lowBatteryBeep && !POWER_Utils::isCharging() && batteryCharge.toInt() < lowBatteryPercent) {
                             lowBatteryPercent = batteryCharge.toInt();
                             NOTIFICATION_Utils::lowBatteryBeep();
diff --git a/src/power_utils.cpp b/src/power_utils.cpp
index 700522c..e8c9f10 100644
--- a/src/power_utils.cpp
+++ b/src/power_utils.cpp
@@ -196,7 +196,7 @@ namespace POWER_Utils {
             PMU.setLDO3Voltage(3300);
             PMU.enableLDO3();
         #endif
-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276)
             PMU.setALDO3Voltage(3300);
             PMU.enableALDO3(); 
         #endif
@@ -210,7 +210,7 @@ namespace POWER_Utils {
         #ifdef HAS_AXP192
             PMU.disableLDO3();
         #endif
-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276)
             PMU.disableALDO3();
         #endif
         #if defined(TTGO_T_Beam_S3_SUPREME_V3)
@@ -223,7 +223,7 @@ namespace POWER_Utils {
             PMU.setLDO2Voltage(3300);
             PMU.enableLDO2();
         #endif
-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276)
             PMU.setALDO2Voltage(3300);
             PMU.enableALDO2();
         #endif
@@ -237,7 +237,7 @@ namespace POWER_Utils {
         #ifdef HAS_AXP192
             PMU.disableLDO2();
         #endif
-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276)
             PMU.disableALDO2();
         #endif
         #if defined(TTGO_T_Beam_S3_SUPREME_V3)
@@ -303,7 +303,7 @@ namespace POWER_Utils {
             return result;
         #endif

-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276)
             bool result = PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL);
             if (result) {
                 PMU.disableDC2();
@@ -368,7 +368,7 @@ namespace POWER_Utils {
             PMU.setSysPowerDownVoltage(2600);
         #endif

-        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)
+        #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262)  || defined(TTGO_T_Beam_V1_2_SX1276)
             Wire.begin(SDA, SCL);
             if (begin(Wire)) {
                 logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "AXP2101", "init done!");
diff --git a/src/station_utils.cpp b/src/station_utils.cpp
index 47273a9..2f23e5d 100644
--- a/src/station_utils.cpp
+++ b/src/station_utils.cpp
@@ -438,7 +438,7 @@ namespace STATION_Utils {
                 comment += batteryChargeCurrent;
                 comment += "mA)";
             #endif
-            #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_S3_SUPREME_V3)
+            #if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_V1_2_SX1276) || defined(TTGO_T_Beam_S3_SUPREME_V3)
                 comment += " Bat=";
                 comment += String(batteryVoltage.toFloat()/1000,2);
                 comment += "V (";

Thank you for all the work you put into this. 73, John WB2OSZ

richonguzman commented 2 days ago

Sure John, I will have this ready this week as I was finishing some stuff over igate firmware before

richonguzman commented 1 day ago

please test now as versions for 915 has been added for all boards

wb2osz commented 1 day ago

Muchas gracias!

richonguzman commented 23 hours ago

Muchas gracias!

please test and then write to know it worked for you ;)