update battery info

This commit is contained in:
richonguzman 2023-07-12 01:34:02 -04:00
parent ed1b44b6e9
commit ffd6bb0794
4 changed files with 7 additions and 79 deletions

View File

@ -1,7 +1,7 @@
{
"beacons": [
{
"callsign": "CD2RXU-7",
"callsign": "NOCALL-7",
"symbol": "[",
"comment": "",
"smart_beacon": {
@ -17,7 +17,7 @@
}
},
{
"callsign": "CD2RXU-7",
"callsign": "NOCALL-7",
"symbol": ">",
"comment": "",
"smart_beacon": {
@ -33,7 +33,7 @@
}
},
{
"callsign": "CD2RXU-7",
"callsign": "NOCALL-7",
"symbol": "j",
"comment": "",
"smart_beacon": {

View File

@ -1,6 +1,6 @@
//#ifdef ESP32
//#include <esp_bt.h>
//#endif
#ifdef ESP32
#include <esp_bt.h>
#endif
#include <Arduino.h>
#include <NimBLEDevice.h>
#include <OneButton.h>
@ -18,12 +18,11 @@
#include "lora_utils.h"
#include "msg_utils.h"
#include "gps_utils.h"
#include "ble_utils.h"
#include "display.h"
#include "SPIFFS.h"
#include "utils.h"
#define VERSION "2023.07.01"
#define VERSION "2023.07.12"
Configuration Config;
PowerManagement powerManagement;
@ -87,7 +86,6 @@ void setup() {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "WiFi and BT controller stopped");
esp_bt_controller_disable();
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "BT controller disabled");
//BLE_Utils::setup();
userButton.attachClick(BUTTON_Utils::singlePress);
userButton.attachLongPressStart(BUTTON_Utils::longPress);

View File

@ -1,58 +0,0 @@
#include "ble_utils.h"
#include <NimBLEDevice.h>
#include "lora_utils.h"
#define SERVICE_UUID "0000180A-0000-1000-8000-00805F9B34FB"
#define CHARACTERISTIC_UUID "00002A29-0000-1000-8000-00805F9B34FB"
extern NimBLECharacteristic* pCharacteristic;
class MyCallbacks : public NimBLECharacteristicCallbacks {
void onWrite(NimBLECharacteristic* pChar) {
std::string receivedData = pChar->getValue(); // Read the data from the characteristic
//Serial.print("Received message: "); Serial.println(receivedData.c_str());
String receivedString = "";
for (int i=0; i<receivedData.length()-2;i++) {
receivedString += receivedData[i];
}
if (receivedString == "hola") {
Serial.println("hola tambien");
pCharacteristic->setValue("hola tambien");
pCharacteristic->notify();
} else if (receivedString=="/send message") {
Serial.println("Send Message To...");
pCharacteristic->setValue("Send Message To...");
pCharacteristic->notify();
} else if (receivedString=="CD2RXU-7") {
Serial.println("Sending message to CD2RXU-7...");
pCharacteristic->setValue("Sending message to CD2RXU-7...");
pCharacteristic->notify();
} else if (receivedString=="test") {
Serial.println("Sending Test message to CD2RXU-15...");
LoRa_Utils::sendNewPacket("CD2RXU-7>APLRT1,WIDE1-1::CD2RXU-15:wrl");
pCharacteristic->setValue("Sending Test message to CD2RXU-15...");
pCharacteristic->notify();
}
}
};
namespace BLE_Utils {
void setup() {
NimBLEDevice::init("Tracker BLE Test");
NimBLEServer* pServer = NimBLEDevice::createServer();
NimBLEService* pService = pServer->createService(SERVICE_UUID);
pCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID, NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE | NIMBLE_PROPERTY::NOTIFY);
pCharacteristic->setCallbacks(new MyCallbacks());
pService->start();
NimBLEAdvertising* pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->start();
Serial.println("Waiting for BLE central to connect...");
}
}

View File

@ -1,12 +0,0 @@
#ifndef BLE_UTILS_H_
#define BLE_UTILS_H_
#include <Arduino.h>
namespace BLE_Utils {
void setup();
}
#endif