Browse Source

Add support ESP32-dev and add RXPIN and TXPIN for 1W modules

pull/1/head
US1GHQ 11 months ago
parent
commit
18acfd88f9
  1. 4
      platformio.ini
  2. 35
      src/TTGO_T-Beam_LoRa_APRS.ino

4
platformio.ini

@ -44,8 +44,8 @@ build_flags =
-D 'SHOW_RX_PACKET'
-D 'SHOW_RX_TIME=10000'
-D 'TXFREQ=433.775'
-D 'SPEED_1200' ; comment out to set 300baud
-D 'TXdbmW=23'
; -D 'SPEED_1200' ; comment out to set 300baud
-D 'TXdbmW=17'
-D 'ENABLE_OLED'
-D 'ENABLE_LED_SIGNALING'
-D 'NETWORK_TNC_PORT=8001'

35
src/TTGO_T-Beam_LoRa_APRS.ino

@ -36,10 +36,10 @@
#define SSD1306_ADDRESS 0x3C
// SPI config
#define SPI_sck 5
#define SPI_sck 18
#define SPI_miso 19
#define SPI_mosi 27
#define SPI_ss 18
#define SPI_ss 5
// IO config
#ifdef T_BEAM_V1_0
@ -83,13 +83,14 @@
#define I2C_SCL 15
#define BUTTON 2 //pin number for BUTTO
#define BUZZER 13 // enter your buzzer pin gpio
const byte TXLED = 4; //pin number for LED on TX Tracker
const byte TXLED = 2; //pin number for LED on TX Tracker
#elif ESP32_DEV_V1
#define I2C_SDA 4
#define I2C_SCL 15
#define BUTTON 2 //pin number for BUTTO
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON 0 //pin number for BUTTO
#define BUZZER 13 // enter your buzzer pin gpio
const byte TXLED = 4; //pin number for LED on TX Tracker
const byte TXLED = 17; //pin number for LED on TX Tracker
const byte RXLED = 16; //pin number for LED on TX Tracker
#endif
// Variables for APRS packaging
@ -197,10 +198,10 @@ static const adc_unit_t unit = ADC_UNIT_1;
uint8_t loraReceivedLength = sizeof(lora_RXBUFF);
// Singleton instance of the radio driver
BG_RF95 rf95(18, 26); // TTGO T-Beam has NSS @ Pin 18 and Interrupt IO @ Pin26
BG_RF95 rf95(5, 26); // TTGO T-Beam has NSS @ Pin 18 and Interrupt IO @ Pin26
// initialize OLED display
#define OLED_RESET 16 // not used
#define OLED_RESET 15 // not used
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);
// + FUNCTIONS-----------------------------------------------------------+//
@ -326,7 +327,8 @@ void sendpacket(){
*/
void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, LOW);
digitalWrite(TXLED, HIGH);
digitalWrite(RXLED, LOW);
#endif
lastTX = millis();
@ -342,7 +344,8 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
rf95.sendAPRS(lora_TXBUFF, messageSize);
rf95.waitPacketSent();
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, HIGH);
digitalWrite(TXLED, LOW);
digitalWrite(RXLED, HIGH);
#endif
}
@ -640,6 +643,7 @@ void setup(){
}
pinMode(TXLED, OUTPUT);
pinMode(RXLED, OUTPUT);
#ifdef T_BEAM_V1_0
pinMode(BUTTON, INPUT);
#elif T_BEAM_V0_7
@ -647,7 +651,8 @@ void setup(){
#else
pinMode(BUTTON, INPUT_PULLUP);
#endif
digitalWrite(TXLED, LOW); // turn blue LED off
digitalWrite(TXLED, LOW); // turn blue LED off
digitalWrite(RXLED, HIGH); // turn blue LED off
Serial.begin(115200);
Wire.begin(I2C_SDA, I2C_SCL);
@ -706,7 +711,8 @@ void setup(){
#endif
if (!rf95.init()) {
writedisplaytext("LoRa-APRS","","Init:","RF95 FAILED!",":-(","");
//writedisplaytext("LoRa-APRS","","Init:","RF95 FAILED!",":-(","");
Serial.println("init failed");
for(;;); // Don't proceed, loop forever
}
@ -757,7 +763,8 @@ void setup(){
writedisplaytext("","","","","","");
time_to_refresh = millis() + showRXTime;
displayInvalidGPS();
digitalWrite(TXLED, HIGH);
digitalWrite(TXLED, LOW);
digitalWrite(RXLED, HIGH);
}
// +---------------------------------------------------------------------+//

Loading…
Cancel
Save