mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-23 01:00:15 +01:00
justo antes de fallar
This commit is contained in:
parent
345a6c2c21
commit
fc8d3fd9fb
|
|
@ -45,10 +45,15 @@
|
|||
"timeout": 4,
|
||||
"turn180": false
|
||||
},
|
||||
"battery": {
|
||||
"sendBatteryVoltage": false,
|
||||
"externalVoltageMeasurement": false,
|
||||
"externalVoltagePin": 34
|
||||
},
|
||||
"bme": {
|
||||
"active": false,
|
||||
"heightCorrection": 0,
|
||||
"temperatureCorrection": 0.0
|
||||
"active": false,
|
||||
"heightCorrection": 0,
|
||||
"temperatureCorrection": 0.0
|
||||
},
|
||||
"syslog": {
|
||||
"active": false,
|
||||
|
|
@ -66,9 +71,6 @@
|
|||
},
|
||||
"other": {
|
||||
"rememberStationTime": 30,
|
||||
"sendBatteryVoltage": false,
|
||||
"externalVoltageMeasurement": false,
|
||||
"externalVoltagePin": 34,
|
||||
"lowPowerMode": false,
|
||||
"lowVoltageCutOff": 0,
|
||||
"backupDigiMode": false,
|
||||
|
|
|
|||
|
|
@ -529,12 +529,12 @@
|
|||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="other.sendBatteryVoltage"
|
||||
id="other.sendBatteryVoltage"
|
||||
name="battery.sendBatteryVoltage"
|
||||
id="battery.sendBatteryVoltage"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="other.sendBatteryVoltage"
|
||||
for="battery.sendBatteryVoltage"
|
||||
class="form-label"
|
||||
>Send Battery Telemetry</label
|
||||
>
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ function loadSettings(settings) {
|
|||
// Beacon
|
||||
document.getElementById("beacon.interval").value = settings.beacon.interval;
|
||||
document.getElementById("other.rememberStationTime").value = settings.other.rememberStationTime;
|
||||
document.getElementById("other.sendBatteryVoltage").checked = settings.other.sendBatteryVoltage;
|
||||
document.getElementById("battery.sendBatteryVoltage").checked = settings.battery.sendBatteryVoltage;
|
||||
document.getElementById("other.externalVoltageMeasurement").checked = settings.other.externalVoltageMeasurement;
|
||||
document.getElementById("other.externalVoltagePin").value = settings.other.externalVoltagePin;
|
||||
// document.getElementById("beacon.igateSendsLoRaBeacon").value = settings.beacon.igateSendsLoRaBeacon;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ ________________________________________________________________________________
|
|||
#include "A7670_utils.h"
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.05.22";
|
||||
String versionDate = "2024.05.23";
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
|
|
@ -94,8 +94,8 @@ void setup() {
|
|||
if (lastBeacon == 0 || time - lastBeacon >= Config.beacon.interval * 60) {
|
||||
Serial.println("Sending beacon");
|
||||
String comment = Config.beacon.comment;
|
||||
if (Config.sendBatteryVoltage) comment += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||
if (Config.externalVoltageMeasurement) comment += " Ext=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V";
|
||||
if (Config.battery.sendBatteryVoltage) comment += " Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||
if (Config.battery.externalVoltageMeasurement) comment += " Ext=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V";
|
||||
STATION_Utils::addToOutputPacketBuffer(GPS_Utils::getiGateLoRaBeaconPacket() + comment);
|
||||
lastBeacon = time;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace BATTERY_Utils {
|
|||
int sample;
|
||||
int sampleSum = 0;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
sample = analogRead(Config.externalVoltagePin);
|
||||
sample = analogRead(Config.battery.externalVoltagePin);
|
||||
sampleSum += sample;
|
||||
delayMicroseconds(50);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void Configuration::check() {
|
|||
void Configuration::writeFile() {
|
||||
Serial.println("Saving config..");
|
||||
|
||||
StaticJsonDocument<2048> data;
|
||||
StaticJsonDocument<2560> data;
|
||||
File configFile = SPIFFS.open("/igate_conf.json", "w");
|
||||
|
||||
if (wifiAPs[0].ssid != "") { // We don't want to save Auto AP empty SSID
|
||||
|
|
@ -40,9 +40,9 @@ void Configuration::writeFile() {
|
|||
// data["other"]["igateSendsLoRaBeacons"] = igateSendsLoRaBeacons;
|
||||
// data["other"]["igateRepeatsLoRaPackets"] = igateRepeatsLoRaPackets;
|
||||
data["other"]["rememberStationTime"] = rememberStationTime;
|
||||
data["other"]["sendBatteryVoltage"] = sendBatteryVoltage;
|
||||
data["other"]["externalVoltageMeasurement"] = externalVoltageMeasurement;
|
||||
data["other"]["externalVoltagePin"] = externalVoltagePin;
|
||||
data["battery"]["sendBatteryVoltage"] = battery.sendBatteryVoltage;
|
||||
data["battery"]["externalVoltageMeasurement"] = battery.externalVoltageMeasurement;
|
||||
data["battery"]["externalVoltagePin"] = battery.externalVoltagePin;
|
||||
|
||||
data["digi"]["mode"] = digi.mode;
|
||||
// data["digi"]["comment"] = digi.comment;
|
||||
|
|
@ -123,7 +123,7 @@ bool Configuration::readFile() {
|
|||
File configFile = SPIFFS.open("/igate_conf.json", "r");
|
||||
|
||||
if (configFile) {
|
||||
StaticJsonDocument<2048> data;
|
||||
StaticJsonDocument<2560> data;
|
||||
|
||||
DeserializationError error = deserializeJson(data, configFile);
|
||||
if (error) {
|
||||
|
|
@ -144,9 +144,14 @@ bool Configuration::readFile() {
|
|||
|
||||
callsign = data["callsign"].as<String>();
|
||||
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
|
||||
sendBatteryVoltage = data["other"]["sendBatteryVoltage"].as<bool>();
|
||||
|
||||
/*sendBatteryVoltage = data["other"]["sendBatteryVoltage"].as<bool>();
|
||||
externalVoltageMeasurement = data["other"]["externalVoltageMeasurement"].as<bool>();
|
||||
externalVoltagePin = data["other"]["externalVoltagePin"].as<int>();
|
||||
externalVoltagePin = data["other"]["externalVoltagePin"].as<int>();*/
|
||||
|
||||
battery.sendBatteryVoltage = data["battery"]["sendBatteryVoltage"].as<bool>();
|
||||
battery.externalVoltageMeasurement = data["battery"]["externalVoltageMeasurement"].as<bool>();
|
||||
battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as<int>();
|
||||
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<String>();
|
||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
|
|
@ -357,9 +362,13 @@ void Configuration::init() {
|
|||
// igateSendsLoRaBeacons = false; // deprecated
|
||||
// igateRepeatsLoRaPackets = false; // deprecated
|
||||
rememberStationTime = 30;
|
||||
sendBatteryVoltage = false;
|
||||
/*sendBatteryVoltage = false;
|
||||
externalVoltageMeasurement = false;
|
||||
externalVoltagePin = 34;
|
||||
externalVoltagePin = 34;*/
|
||||
|
||||
battery.sendBatteryVoltage = false;
|
||||
battery.externalVoltageMeasurement = false;
|
||||
battery.externalVoltagePin = 34;
|
||||
|
||||
lowPowerMode = false;
|
||||
lowVoltageCutOff = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
int powerOff;
|
||||
};
|
||||
|
||||
class Beacon {
|
||||
class BEACON {
|
||||
public:
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
|
@ -66,6 +66,13 @@ public:
|
|||
bool turn180;
|
||||
};
|
||||
|
||||
class BATTERY {
|
||||
public:
|
||||
bool sendBatteryVoltage;
|
||||
bool externalVoltageMeasurement;
|
||||
int externalVoltagePin;
|
||||
};
|
||||
|
||||
class BME {
|
||||
public:
|
||||
bool active;
|
||||
|
|
@ -98,9 +105,9 @@ public:
|
|||
bool reload; // ?
|
||||
String callsign;
|
||||
int rememberStationTime;
|
||||
bool sendBatteryVoltage;
|
||||
/*bool sendBatteryVoltage;
|
||||
bool externalVoltageMeasurement;
|
||||
int externalVoltagePin;
|
||||
int externalVoltagePin;*/
|
||||
bool lowPowerMode;
|
||||
double lowVoltageCutOff;
|
||||
bool backupDigiMode;
|
||||
|
|
@ -108,14 +115,15 @@ public:
|
|||
int rebootModeTime;
|
||||
std::vector<WiFi_AP> wifiAPs;
|
||||
WiFi_Auto_AP wifiAutoAP;
|
||||
Beacon beacon;
|
||||
DIGI digi;
|
||||
TNC tnc;
|
||||
BEACON beacon;
|
||||
APRS_IS aprs_is;
|
||||
DIGI digi;
|
||||
LoraModule loramodule;
|
||||
Display display;
|
||||
SYSLOG syslog;
|
||||
BATTERY battery;
|
||||
BME bme;
|
||||
SYSLOG syslog;
|
||||
TNC tnc;
|
||||
OTA ota;
|
||||
|
||||
void init();
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@ namespace POWER_Utils {
|
|||
pinMode(INTERNAL_LED_PIN, OUTPUT);
|
||||
#endif
|
||||
|
||||
if (Config.externalVoltageMeasurement) {
|
||||
pinMode(Config.externalVoltagePin, INPUT);
|
||||
if (Config.battery.externalVoltageMeasurement) {
|
||||
pinMode(Config.battery.externalVoltagePin, INPUT);
|
||||
}
|
||||
|
||||
#ifdef VEXT_CTRL
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ namespace Utils {
|
|||
secondaryBeaconPacket += Config.beacon.comment;
|
||||
|
||||
#ifdef BATTERY_PIN
|
||||
if (Config.sendBatteryVoltage) {
|
||||
if (Config.battery.sendBatteryVoltage) {
|
||||
String batteryInfo = "Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V";
|
||||
beaconPacket += " " + batteryInfo;
|
||||
secondaryBeaconPacket += " " + batteryInfo;
|
||||
|
|
@ -130,7 +130,7 @@ namespace Utils {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (Config.externalVoltageMeasurement) {
|
||||
if (Config.battery.externalVoltageMeasurement) {
|
||||
String externalVoltage = String(BATTERY_Utils::checkExternalVoltage(),2) + "V";
|
||||
beaconPacket += " Ext=" + externalVoltage;
|
||||
secondaryBeaconPacket += " Ext=" + externalVoltage;
|
||||
|
|
|
|||
|
|
@ -157,10 +157,10 @@ namespace WEB_Utils {
|
|||
Config.ota.password = request->getParam("ota.password", true)->value();
|
||||
|
||||
Config.rememberStationTime = request->getParam("other.rememberStationTime", true)->value().toInt();
|
||||
Config.sendBatteryVoltage = request->hasParam("other.sendBatteryVoltage", true);
|
||||
Config.externalVoltageMeasurement = request->hasParam("other.externalVoltageMeasurement", true);
|
||||
if (Config.externalVoltageMeasurement) {
|
||||
Config.externalVoltagePin = request->getParam("other.externalVoltagePin", true)->value().toInt();
|
||||
Config.battery.sendBatteryVoltage = request->hasParam("battery.sendBatteryVoltage", true);
|
||||
Config.battery.externalVoltageMeasurement = request->hasParam("battery.externalVoltageMeasurement", true);
|
||||
if (Config.battery.externalVoltageMeasurement) {
|
||||
Config.battery.externalVoltagePin = request->getParam("battery.externalVoltagePin", true)->value().toInt();
|
||||
}
|
||||
|
||||
Config.backupDigiMode = request->hasParam("other.backupDigiMode", true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue