From 8382a271f7de6ffed18ebaa18962231edb926520 Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Sat, 13 Feb 2021 11:15:25 +0100 Subject: [PATCH] v.0.7 & v.0.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kompiluje siÄ™ ale nie testowane --- .vscode/c_cpp_properties.json | 4 +-- src/TTGO_T-Beam_LoRa_APRS.ino | 51 ++++++++++++++++++++++-------- src/TTGO_T-Beam_LoRa_APRS_config.h | 3 +- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 0afb4d3..2b48b4c 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -12,6 +12,7 @@ "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/lib/KISS_TO_TNC2", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/lib/BG_RF95", + "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/OneWire", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/AXP202X_Library/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/Adafruit Unified Sensor", @@ -87,7 +88,6 @@ "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/AzureIoT/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src", - "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/EEPROM/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/ESP32/src", @@ -117,6 +117,7 @@ "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/lib/KISS_TO_TNC2", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/lib/BG_RF95", + "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/OneWire", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/AXP202X_Library/src", "e:/Dokumenty/GitHub/TTGO-T-Beam-LoRa-APRS/.pio/libdeps/ttgo-t-beam/Adafruit Unified Sensor", @@ -192,7 +193,6 @@ "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/AzureIoT/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src", - "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/EEPROM/src", "C:/Users/rysiek/.platformio/packages/framework-arduinoespressif32/libraries/ESP32/src", diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 4554445..455528f 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -44,14 +44,28 @@ int button=0; int button_ctr=0; // Pins for GPS -static const int RXPin = 12, TXPin = 34; // changed BG A3 A2 +#ifdef T_BEAM_V1_0 + static const int RXPin = 12, TXPin = 34; // changed BG A3 A2 +#else + static const int RXPin = 15, TXPin = 12; // changed BG A3 A2 +#endif + static const uint32_t GPSBaud = 9600; //GPS // LED for signalling -const byte TXLED = 33; //pin number for LED on TX Tracker +#ifdef T_BEAM_V1_0 + const byte TXLED = 4; //pin number for LED on TX Tracker +#else + const byte TXLED = 14; //pin number for LED on TX Tracker + #endif // Button of TTGO T-Beam -#define BUTTON 38 //pin number for Button on TTGO T-Beam +#ifdef T_BEAM_V1_0 +// const byte BUTTON = 38; //pin number for Button on TTGO T-Beam + #define BUTTON 38 //pin number for Button on TTGO T-Beam +#else + #define BUTTON 39 //pin number for Button on TTGO T-Beam +#endif // Pins for LoRa module const byte lora_PReset = 23; //pin where LoRa device reset line is connected @@ -117,7 +131,9 @@ void handleKISSData(char character); // SoftwareSerial ss(RXPin, TXPin); // The serial connection to the GPS device HardwareSerial gpsSerial(1); // TTGO has HW serial TinyGPSPlus gps; // The TinyGPS++ object -AXP20X_Class axp; +#ifdef T_BEAM_V1_0 + AXP20X_Class axp; +#endif // checkRX uint8_t loraReceivedLength = sizeof(lora_RXBUFF); @@ -325,15 +341,17 @@ void setup(){ Serial.begin(115200); Wire.begin(I2C_SDA, I2C_SCL); - if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) { - } + #ifdef T_BEAM_V1_0 + if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) { + } - axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora power - axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // provides power to GPS - axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON); - axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON); - axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // enables power to OLED LCD - axp.setDCDC1Voltage(3300); + axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora power + axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // provides power to GPS + axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON); + axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON); + axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // enables power to OLED LCD + axp.setDCDC1Voltage(3300); + #endif if(!display.begin(SSD1306_SWITCHCAPVCC, SSD1306_ADDRESS)) { for(;;); // Don't proceed, loop forever @@ -361,7 +379,14 @@ void setup(){ while (true) {} } writedisplaytext(" "+Tcall,"","Init:","Data from GPS OK!","","",250); - writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(axp.getBattVoltage()/1000,1),"",250); + #ifdef T_BEAM_V1_0 + writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(axp.getBattVoltage()/1000,1),"",250); + #else + adc1_config_width(ADC_WIDTH_BIT_12); + adc1_config_channel_atten(ADC1_CHANNEL_7,ADC_ATTEN_DB_6); + writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(analogRead(35)*7.221/4096,1),"",250); + #endif + rf95.setFrequency(433.775); rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096); // hard coded because of double definition rf95.setTxPower(20); // was 5 diff --git a/src/TTGO_T-Beam_LoRa_APRS_config.h b/src/TTGO_T-Beam_LoRa_APRS_config.h index 34206a4..7786fa9 100644 --- a/src/TTGO_T-Beam_LoRa_APRS_config.h +++ b/src/TTGO_T-Beam_LoRa_APRS_config.h @@ -16,10 +16,11 @@ #define SHOW_RX_PACKET // uncomment to show received LoRa APS packets for the time given below #define SHOW_RX_TIME 10000 // show RX packet for milliseconds (5000 = 5secs) #define TXFREQ 433.775 // Transmit frequency in MHz -#define TXdbmW 20 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW +#define TXdbmW 17 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW //#define SHOW_GPS_DATA // uncomment to show on serial port, received data from GPS and debug information #define ENABLE_BLUETOOTH //#define BLUETOOTH_PIN "0000" #define KISS_DEBUG +#define T_BEAM_V1_0 // if enabled t-beam v1.0 disabled t-beam V.0.7 unsigned long max_time_to_nextTX = 180000L; // TRANSMIT INTERVAL set here MAXIMUM time in ms(!) for smart beaconing - minimum time is always 1 min = 60 secs = 60000L !!! \ No newline at end of file