Skip to content

Commit

Permalink
sx1276 && 915 added
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Apr 24, 2024
1 parent e2c3edd commit 9742e25
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 39 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ____________________________________________________
____________________________________________________
## Timeline (Versions):

- 2024.04.23 T-LoRa32 v1.6/v2.1 with 915MHz support added.
- 2024.04.23 ESP32 + 4G/LTE MODEM A7670SA + LoRa (SX1278) support added.
- 2024.04.22 Wemos Lolin32 OLED DIY LoRa support added .
- 2024.04.21 WEB INSTALLER (thanks Damian SQ2CPA).
Expand Down
12 changes: 11 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,14 @@ build_flags =
lib_deps =
${common.lib_deps}
vshymanskyy/TinyGSM@^0.11.7
vshymanskyy/StreamDebugger@^1.0.1
vshymanskyy/StreamDebugger@^1.0.1

[env:ttgo-lora32-v21-915]
board = ttgo-lora32-v21
build_flags =
-Werror -Wall
-DTTGO_T_LORA32_V2_1_915
-DHAS_SX1276
-DELEGANTOTA_USE_ASYNC_WEBSERVER=1
lib_deps =
${common.lib_deps}
4 changes: 2 additions & 2 deletions src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ void setup() {
#ifdef BATTERY_PIN
pinMode(BATTERY_PIN, INPUT);
#endif
#ifdef HAS_INTERNAL_LED
pinMode(internalLedPin, OUTPUT);
#ifdef INTERNAL_LED_PIN
pinMode(INTERNAL_LED_PIN, OUTPUT);
#endif
if (Config.externalVoltageMeasurement) {
pinMode(Config.externalVoltagePin, INPUT);
Expand Down
2 changes: 1 addition & 1 deletion src/battery_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace BATTERY_Utils {
int sample;
int sampleSum = 0;
for (int i = 0; i < 100; i++) {
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670)
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915)
sample = analogRead(BATTERY_PIN);
#endif
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
Expand Down
16 changes: 10 additions & 6 deletions src/lora_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ SX1268 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUS
SX1278 radio = new Module(RADIO_CS_PIN, RADIO_BUSY_PIN, RADIO_RST_PIN);
#endif

#ifdef HAS_SX1276
SX1276 radio = new Module(RADIO_CS_PIN, RADIO_BUSY_PIN, RADIO_RST_PIN);
#endif

int rssi, freqError;
float snr;

Expand All @@ -48,7 +52,7 @@ namespace LoRa_Utils {
Utils::println("Starting LoRa failed!");
while (true);
}
#ifdef HAS_SX1278
#if defined(HAS_SX1278) || defined(HAS_SX1276)
radio.setDio0Action(setFlag, RISING);
#endif
#if defined(HAS_SX1262) || defined(HAS_SX1268)
Expand All @@ -68,7 +72,7 @@ namespace LoRa_Utils {
radio.setRfSwitchPins(RADIO_RXEN, RADIO_TXEN);
#endif

#if defined(HAS_SX1278) || ESP32_DIY_1W_LoRa
#if defined(HAS_SX1278) || defined(HAS_SX1276) || ESP32_DIY_1W_LoRa
state = radio.setOutputPower(Config.loramodule.power); // max value 20dB for 400M30S as it has Low Noise Amp
#endif
#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262)
Expand Down Expand Up @@ -101,8 +105,8 @@ namespace LoRa_Utils {
changeFreqTx();
}

#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin, HIGH);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN, HIGH);
#endif
int state = radio.transmit("\x3c\xff\x01" + newPacket);
transmissionFlag = true;
Expand All @@ -120,8 +124,8 @@ namespace LoRa_Utils {
Utils::print(F("failed, code "));
Utils::println(String(state));
}
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin, LOW);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN, LOW);
#endif
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
changeFreqRx();
Expand Down
33 changes: 15 additions & 18 deletions src/pins_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


// LORA MODULES
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0)
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA32_V2_1_915)
#define RADIO_SCLK_PIN 5 // GPIO5 - SX1278 SCK
#define RADIO_MISO_PIN 19 // GPIO19 - SX1278 MISO
#define RADIO_MOSI_PIN 27 // GPIO27 - SX1278 MOSI
Expand Down Expand Up @@ -97,7 +97,7 @@


// OLED
#if defined(TTGO_T_LORA32_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom) || defined(ESP32_DIY_LoRa_A7670)
#if defined(TTGO_T_LORA32_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(OE5HWN_MeshCom) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915)
#define OLED_SDA 21
#define OLED_SCL 22
#define OLED_RST -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Expand Down Expand Up @@ -127,35 +127,32 @@


// Leds and other stuff
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(HELTEC_WS) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
#define HAS_INTERNAL_LED
#endif

#ifdef HELTEC_HTCT62
#define BATTERY_PIN 1
#define BATTERY_PIN 1
#endif
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2)
#define internalLedPin 25 // Green Led
#define BATTERY_PIN 35
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(TTGO_T_LORA32_V2_1_915)
#define INTERNAL_LED_PIN 25 // Green Led
#define BATTERY_PIN 35
#endif
#if defined(HELTEC_WS)
#define internalLedPin 35
#define INTERNAL_LED_PIN 35
#endif
#if defined(HELTEC_V3)
#define internalLedPin 35
#define BATTERY_PIN 1
#define VExt_CTRL 36
#define ADC_CTRL 37
#define INTERNAL_LED_PIN 35
#define BATTERY_PIN 1
#define VExt_CTRL 36
#define ADC_CTRL 37
#endif
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
#define internalLedPin 2
#define INTERNAL_LED_PIN 2
#endif
#if defined(ESP32_DIY_LoRa_A7670)
#define BATTERY_PIN 35
#define internalLedPin 13 // 13 for V1.1 and 12 for V1.0
#define INTERNAL_LED_PIN 13 // 13 for V1.1 and 12 for V1.0
#define BATTERY_PIN 35
#endif



#ifdef ESP32_C3_DIY_LoRa
#define OLED_SDA 8
#define OLED_SCL 9
Expand Down
10 changes: 5 additions & 5 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ namespace Utils {

void setupDisplay() {
setup_display();
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin,HIGH);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN,HIGH);
#endif
Serial.println("\nStarting Station: " + Config.callsign + " Version: " + versionDate);
show_display(" LoRa APRS", "", " ( iGATE & DIGI )", "", "", "Richonguzman / CA2RXU", " " + versionDate, 4000);
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin,LOW);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN,LOW);
#endif
firstLine = Config.callsign;
seventhLine = " listening...";
Expand Down Expand Up @@ -114,7 +114,7 @@ namespace Utils {
beaconPacket += Config.beacon.comment;
secondaryBeaconPacket += Config.beacon.comment;

#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670)
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915)
if (Config.sendBatteryVoltage) {
beaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
secondaryBeaconPacket += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
Expand Down
12 changes: 6 additions & 6 deletions src/wifi_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ namespace WIFI_Utils {
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
while (WiFi.status() != WL_CONNECTED && wifiCounter<myWiFiAPSize) {
delay(500);
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin,HIGH);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN,HIGH);
#endif
Serial.print('.');
delay(500);
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin,LOW);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN,LOW);
#endif
if ((millis() - start) > 10000){
delay(1000);
Expand All @@ -78,8 +78,8 @@ namespace WIFI_Utils {
}
}
}
#ifdef HAS_INTERNAL_LED
digitalWrite(internalLedPin,LOW);
#ifdef INTERNAL_LED_PIN
digitalWrite(INTERNAL_LED_PIN,LOW);
#endif
if (WiFi.status() == WL_CONNECTED) {
Serial.print("Connected as ");
Expand Down

0 comments on commit 9742e25

Please sign in to comment.