diff --git a/data/tracker_config.json b/data/tracker_config.json index 6e39d84..c8f7d46 100644 --- a/data/tracker_config.json +++ b/data/tracker_config.json @@ -1,7 +1,7 @@ { "beacons": [ { - "callsign": "NOCALL-7", + "callsign": "CA2RXU-8", "symbol": "[", "overlay": "/", "comment": "", @@ -18,7 +18,7 @@ } }, { - "callsign": "NOCALL-7", + "callsign": "CA2RXU-8", "symbol": ">", "overlay": "/", "comment": "", @@ -35,7 +35,7 @@ } }, { - "callsign": "NOCALL-7", + "callsign": "CA2RXU-8", "symbol": "j", "overlay": "/", "comment": "", @@ -72,7 +72,7 @@ "standingUpdateTime": 15, "sendAltitude": true, "sendBatteryInfo": false, - "bluetoothType": 1, + "bluetoothType": 0, "bluetoothActive": true, "disableGPS": false }, diff --git a/platformio.ini b/platformio.ini index dd6923c..e9e1659 100644 --- a/platformio.ini +++ b/platformio.ini @@ -59,4 +59,8 @@ build_flags = -Werror -Wall -DTTGO_T_Beam_V1_2 [env:ttgo-t-lora-v2_1] board = ttgo-lora32-v21 -build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1 \ No newline at end of file +build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1 + +[env:ESP32_DIY_LoRa_GPS] +board = esp32dev +build_flags = -Werror -Wall -DESP32_DIY_LoRa_GPS \ No newline at end of file diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index fa8b7d1..6378783 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -30,9 +30,11 @@ PowerManagement powerManagement; HardwareSerial neo6m_gps(1); TinyGPSPlus gps; BluetoothSerial SerialBT; +#if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) OneButton userButton = OneButton(BUTTON_PIN, true, true); +#endif -String versionDate = "2023.12.03"; +String versionDate = "2023.12.04"; int myBeaconsIndex = 0; int myBeaconsSize = Config.beacons.size(); @@ -134,16 +136,19 @@ void setup() { } if (!Config.simplifiedTrackerMode) { + #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) userButton.attachClick(BUTTON_Utils::singlePress); userButton.attachLongPressStart(BUTTON_Utils::longPress); userButton.attachDoubleClick(BUTTON_Utils::doublePress); + #endif KEYBOARD_Utils::setup(); } powerManagement.lowerCpuFrequency(); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", utils::getSmartBeaconState()); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Setup Done!"); - menuDisplay = BUTTON_PIN == -1 ? 20 : 0; + //menuDisplay = BUTTON_PIN == -1 ? 20 : 0; + menuDisplay = 0; } void loop() { @@ -154,7 +159,9 @@ void loop() { powerManagement.batteryManager(); if (!Config.simplifiedTrackerMode) { + #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0_SX1268) userButton.tick(); + #endif } utils::checkDisplayEcoMode(); diff --git a/src/ble_utils.cpp b/src/ble_utils.cpp index e9dc624..3911809 100644 --- a/src/ble_utils.cpp +++ b/src/ble_utils.cpp @@ -48,7 +48,7 @@ class MyCallbacks : public NimBLECharacteristicCallbacks { namespace BLE_Utils { void setup() { - BLEDevice::init("LoRa Tracker/TNC"); + BLEDevice::init("LoRa Tracker/TNC 2"); pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallbacks()); diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index 952bd84..a50f35c 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -51,7 +51,7 @@ namespace LoRa_Utils { while (true); } #endif - #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set SPI pins!"); SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Set LoRa pins!"); @@ -111,7 +111,7 @@ namespace LoRa_Utils { Serial.println(state); } #endif - #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) LoRa.beginPacket(); LoRa.write('<'); LoRa.write(0xFF); @@ -130,7 +130,7 @@ namespace LoRa_Utils { String receivePacket() { String loraPacket = ""; - #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) + #if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_2) || defined(ESP32_DIY_LoRa_GPS) int packetSize = LoRa.parsePacket(); if (packetSize) { while (LoRa.available()) { diff --git a/src/pins_config.h b/src/pins_config.h index 3de6eca..4bd47ba 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -38,4 +38,17 @@ #define BUTTON_PIN -1 #endif +#ifdef ESP32_DIY_LoRa_GPS +#define GPS_RX 12 // se cambiaran +#define GPS_TX 34 +#define BUTTON_PIN -1 +#define LORA_SCK 5 // GPIO5 - SX1276 SCK +#define LORA_MISO 19 // GPIO19 - SX1276 MISO +#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI +#define LORA_CS 18 // GPIO18 - SX1276 CS ---> NSS +#define LORA_RST 23 // GPIO14 - SX1276 RST +#define LORA_IRQ 26 // GPIO26 - SX1276 IRQ ---->DIO0 +//#define greenLed 25 // Green Led +#endif + #endif \ No newline at end of file diff --git a/src/power_utils.cpp b/src/power_utils.cpp index bada4b2..df326fc 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -10,7 +10,7 @@ extern logging::Logger logger; // cppcheck-suppress unusedFunction bool PowerManagement::begin(TwoWire &port) { - #ifdef TTGO_T_Beam_V0_7 + #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) // Currently there is no init for V0.7 boards(they only measure battery voltage). return true; #endif @@ -134,7 +134,7 @@ void PowerManagement::deactivateMeasurement() { // cppcheck-suppress unusedFunction double PowerManagement::getBatteryVoltage() { - #ifdef TTGO_T_Beam_V0_7 + #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) // the battery voltage is divided by 2 with two 100kOhm resistors and connected to ADC1 Channel 7 -> pin 35 // the measured voltage is inaccurate du to known nonlinearity and ~100mV offset of the ESP32 A/D converter int adc_value; @@ -156,7 +156,7 @@ double PowerManagement::getBatteryVoltage() { // cppcheck-suppress unusedFunction double PowerManagement::getBatteryChargeDischargeCurrent() { - #ifdef TTGO_T_Beam_V0_7 + #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) return 0; #endif #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_0_SX1268) @@ -171,7 +171,7 @@ double PowerManagement::getBatteryChargeDischargeCurrent() { } bool PowerManagement::isBatteryConnected() { - #ifdef TTGO_T_Beam_V0_7 + #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) if(getBatteryVoltage() > 1.0) { return true; } else { @@ -187,7 +187,7 @@ bool PowerManagement::isBatteryConnected() { } bool PowerManagement::isChargeing() { - #ifdef TTGO_T_Beam_V0_7 + #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) return 0; #endif #if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA_V2_1) || defined(TTGO_T_Beam_V1_0_SX1268) diff --git a/src/power_utils.h b/src/power_utils.h index 1ea74e4..c5f75b2 100644 --- a/src/power_utils.h +++ b/src/power_utils.h @@ -2,7 +2,7 @@ #define POWER_UTILS_H_ #include -#ifdef TTGO_T_Beam_V0_7 +#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) // The V0.7 boards have no power managment components connected to TwoWire. // Battery charging is controlled by a TP5400 IC indepemdetly from the ESP32. // Wire.h must be included to maitain software compatibility with V1.0 and 1.2 boards.