This commit is contained in:
richonguzman 2023-12-05 01:00:35 -03:00
parent 908c1a1166
commit ac317187f3
8 changed files with 41 additions and 17 deletions

View File

@ -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
},

View File

@ -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
build_flags = -Werror -Wall -DTTGO_T_LORA_V2_1
[env:ESP32_DIY_LoRa_GPS]
board = esp32dev
build_flags = -Werror -Wall -DESP32_DIY_LoRa_GPS

View File

@ -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();

View File

@ -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());

View File

@ -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()) {

View File

@ -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

View File

@ -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)

View File

@ -2,7 +2,7 @@
#define POWER_UTILS_H_
#include <Arduino.h>
#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.