Compare commits

...

10 Commits

Author SHA1 Message Date
richonguzman
438a6ee536 js update too 2025-08-19 12:52:18 -04:00
richonguzman
206c79f0a9 lora32 test ok 2025-08-19 12:30:40 -04:00
richonguzman
236cfa724e ready for testing 2025-08-17 22:04:22 -04:00
richonguzman
028a82a40e adcMods1 2025-08-15 15:53:19 -04:00
richonguzman
bb9a061266 better reading accuracy 2025-08-07 20:15:23 -04:00
richonguzman
fd24ce8598 versionDate update 2025-08-04 14:50:33 -04:00
richonguzman
6cbe8173e8 test1 2025-07-30 08:53:02 -04:00
richonguzman
b4261f37cb index Requires update 2025-07-26 10:23:46 -04:00
richonguzman
b5a68a6758 index date update 2025-07-26 10:03:06 -04:00
richonguzman
ce3d136954 versionDate 2025-07-26 09:58:38 -04:00
12 changed files with 156 additions and 69 deletions

View File

@@ -16,7 +16,9 @@
"symbol": "a",
"path": "WIDE1-1",
"sendViaAPRSIS": false,
"sendViaRF": false
"sendViaRF": false,
"statusActive": false,
"statusPacket": ""
},
"aprs_is": {
"active": false,

View File

@@ -253,7 +253,36 @@
name="personalNote"
id="personalNote"
class="form-control"
placeholder="A Couple of words."
placeholder="A couple of words"
/>
</div>
<div class="col-12 mt-3">
<div class="form-check form-switch">
<input
type="checkbox"
name="beacon.statusActive"
id="beacon.statusActive"
class="form-check-input"
/>
<label
for="beacon.statusActive"
class="form-label"
>Send Status at each Boot</label
>
</div>
</div>
<div class="col-12">
<label
for="beacon.statusPacket"
class="form-label"
>Status</label
>
<input
type="text"
name="beacon.statusPacket"
id="beacon.statusPacket"
class="form-control"
placeholder="Custom Status"
/>
</div>
</div>
@@ -661,7 +690,10 @@
<label
for="digi.ecoMode"
class="form-label"
>Eco Mode</label
>Eco Mode
<small
>(Requires Digipeating enabled and APRS-IS connection disabled).</small
></label
>
<select
class="form-select form-select"
@@ -1245,9 +1277,9 @@
<label
for="wxsensor.active"
class="form-label"
><b>Activate Wx Telemetry</b>
>Activate Wx Telemetry
<small
>Requires a BME/BMP280, BME680 or Si7021 sensor.</small
>(Requires a BME/BMP280, BME680 or Si7021 sensor).</small
></label
>
</div>
@@ -1889,7 +1921,7 @@
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.408 5.89c.681 0 1.138.47 1.187 1.107h1.147v-.11c-.053-1.187-1.024-2-2.343-2-1.604 0-2.518 1.05-2.518 2.751v.747c0 1.7.906 2.73 2.518 2.73 1.314 0 2.285-.792 2.343-1.939v-.114H6.595c-.049.615-.497 1.05-1.187 1.05-.84 0-1.318-.62-1.318-1.727v-.742c0-1.112.488-1.754 1.318-1.754Zm5.404 0c.68 0 1.138.47 1.186 1.107h1.147v-.11c-.053-1.187-1.024-2-2.342-2-1.604 0-2.518 1.05-2.518 2.751v.747c0 1.7.905 2.73 2.518 2.73 1.314 0 2.285-.792 2.342-1.939v-.114h-1.147c-.048.615-.496 1.05-1.186 1.05-.84 0-1.319-.62-1.319-1.727v-.742c0-1.112.488-1.754 1.319-1.754Z"
/>
</svg>
2023-24
2023-25
<b
><a href="https://github.com/richonguzman"
>CA2RXU</a

View File

@@ -134,6 +134,9 @@ function loadSettings(settings) {
document.getElementById("beacon.sendViaAPRSIS").checked = settings.beacon.sendViaAPRSIS;
document.getElementById("beacon.sendViaRF").checked = settings.beacon.sendViaRF;
document.getElementById("beacon.statusActive").checked = settings.beacon.statusActive;
document.getElementById("beacon.statusPacket").value = settings.beacon.statusPacket;
document.getElementById("beacon.gpsActive").checked = settings.beacon.gpsActive;
document.getElementById("beacon.gpsAmbiguity").checked = settings.beacon.gpsAmbiguity;

View File

@@ -49,6 +49,8 @@ public:
bool sendViaAPRSIS;
bool gpsActive;
bool gpsAmbiguity;
bool statusActive;
String statusPacket;
};
class APRS_IS {

View File

@@ -29,6 +29,16 @@
namespace POWER_Utils {
#ifdef VEXT_CTRL
void vext_ctrl_ON();
void vext_ctrl_OFF();
#endif
#ifdef ADC_CTRL
void adc_ctrl_ON();
void adc_ctrl_OFF();
#endif
double getBatteryVoltage();
bool isBatteryConnected();
void activateMeasurement();

View File

@@ -66,7 +66,7 @@ ___________________________________________________________________*/
#endif
String versionDate = "2025-06-20";
String versionDate = "2025-08-19";
Configuration Config;
WiFiClient espClient;
#ifdef HAS_GPS

View File

@@ -30,6 +30,7 @@ extern uint32_t lastBatteryCheck;
bool shouldSleepLowVoltage = false;
float adcReadingTransformation = (3.3/4095);
int adcReadings = 20;
float voltageDividerCorrection = 0.288;
float readingCorrection = 0.125;
float multiplyCorrection = 0.035;
@@ -39,6 +40,7 @@ float voltageDividerTransformation = 0.0;
int telemetryCounter = random(1,999);
#ifdef HAS_ADC_CALIBRATION
#include <esp_adc_cal.h>
@@ -117,69 +119,58 @@ namespace BATTERY_Utils {
return 0.0;
}
#else
int sample;
int sampleSum = 0;
#ifdef ADC_CTRL
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3_2)
digitalWrite(ADC_CTRL, HIGH);
#endif
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, LOW);
#endif
POWER_Utils::adc_ctrl_ON();
#endif
for (int i = 0; i < 100; i++) {
int sampleSum = 0;
for (int i = 0; i < adcReadings; i++) {
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_LoRa_915) || defined(ESP32_DIY_1W_LoRa) || defined(ESP32_DIY_1W_LoRa_915)
sample = 0;
sampleSum = 0;
#else
#ifdef HAS_ADC_CALIBRATION
if (calibrationEnable){
sample = adc1_get_raw(InternalBattery_ADC_Channel);
sampleSum += adc1_get_raw(InternalBattery_ADC_Channel);
} else {
sample = analogRead(BATTERY_PIN);
sampleSum += analogRead(BATTERY_PIN);
}
#else
#ifdef BATTERY_PIN
sample = analogRead(BATTERY_PIN);
sampleSum += analogRead(BATTERY_PIN);
#else
sample = 0;
sampleSum += 0;
#endif
#endif
#endif
sampleSum += sample;
delayMicroseconds(50);
delay(3);
}
#ifdef ADC_CTRL
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3_2)
digitalWrite(ADC_CTRL, LOW);
#endif
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, HIGH);
#endif
POWER_Utils::adc_ctrl_OFF();
#ifdef HELTEC_WP
double inputDivider = (1.0 / (10.0 + 10.0)) * 10.0; // The voltage divider is a 10k + 10k resistor in series
#else
double inputDivider = (1.0 / (390.0 + 100.0)) * 100.0; // The voltage divider is a 390k + 100k resistor in series, 100k on the low side.
#endif
return (((sampleSum/100) * adcReadingTransformation) / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
return (((sampleSum/adcReadings) * adcReadingTransformation) / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
#else
#ifdef HAS_ADC_CALIBRATION
if (calibrationEnable){
float voltage = esp_adc_cal_raw_to_voltage(sampleSum / 100, &adc_chars);
float voltage = esp_adc_cal_raw_to_voltage(sampleSum / adcReadings, &adc_chars);
voltage *= 2; // for 100K/100K voltage divider
voltage /= 1000;
return voltage;
} else {
return (2 * (sampleSum/100) * adcReadingTransformation) + voltageDividerCorrection; // raw voltage without mapping
return (2 * (sampleSum/adcReadings) * adcReadingTransformation) + voltageDividerCorrection; // raw voltage without mapping
}
#else
#ifdef LIGHTGATEWAY_PLUS_1_0
double inputDivider = (1.0 / (560.0 + 100.0)) * 100.0; // The voltage divider is a 560k + 100k resistor in series, 100k on the low side.
return (((sampleSum/100) * adcReadingTransformation) / inputDivider) + 0.41;
return (((sampleSum/adcReadings) * adcReadingTransformation) / inputDivider) + 0.41;
#else
return (2 * (sampleSum/100) * adcReadingTransformation) + voltageDividerCorrection; // raw voltage without mapping
return (2 * (sampleSum/adcReadings) * adcReadingTransformation) + voltageDividerCorrection; // raw voltage without mapping
#endif
#endif
#endif

View File

@@ -62,6 +62,9 @@ void Configuration::writeFile() {
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
data["beacon"]["path"] = beacon.path;
data["beacon"]["statusActive"] = beacon.statusActive;
data["beacon"]["statusPacket"] = beacon.statusPacket;
data["beacon"]["gpsActive"] = beacon.gpsActive;
data["beacon"]["gpsAmbiguity"] = beacon.gpsAmbiguity;
@@ -178,6 +181,9 @@ bool Configuration::readFile() {
beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"] | false;
beacon.sendViaRF = data["beacon"]["sendViaRF"] | false;
beacon.statusActive = data["beacon"]["statusActive"] | false;
beacon.statusPacket = data["beacon"]["statusPacket"] | "";
beacon.gpsActive = data["beacon"]["gpsActive"] | false;
beacon.gpsAmbiguity = data["beacon"]["gpsAmbiguity"] | false;
@@ -295,6 +301,9 @@ void Configuration::init() {
beacon.sendViaRF = false;
beacon.path = "WIDE1-1";
beacon.statusActive = false;
beacon.statusPacket = "";
beacon.gpsActive = false;
beacon.gpsAmbiguity = false;

View File

@@ -47,6 +47,47 @@ extern Configuration Config;
namespace POWER_Utils {
#ifdef VEXT_CTRL
void vext_ctrl_ON() {
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? LOW : HIGH);
#endif
#if defined(HELTEC_WP) || defined(HELTEC_WS) || defined(HELTEC_V3_2) || defined(HELTEC_WSL_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? HIGH : LOW);
#endif
}
void vext_ctrl_OFF() {
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? HIGH : LOW);
#endif
#if defined(HELTEC_WP) || defined(HELTEC_WS) || defined(HELTEC_V3_2) || defined(HELTEC_WSL_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? LOW : HIGH);
#endif
}
#endif
#ifdef ADC_CTRL
void adc_ctrl_ON() {
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3_2)
digitalWrite(ADC_CTRL, HIGH);
#endif
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, LOW);
#endif
}
void adc_ctrl_OFF() {
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3_2)
digitalWrite(ADC_CTRL, LOW);
#endif
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, HIGH);
#endif
}
#endif
double getBatteryVoltage() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
return (PMU.getBattVoltage() / 1000.0);
@@ -89,7 +130,7 @@ namespace POWER_Utils {
#endif
#endif
#ifdef HELTEC_WIRELESS_TRACKER
digitalWrite(VEXT_CTRL, HIGH);
adc_ctrl_ON();
#endif
//gpsIsActive = true;
}
@@ -107,7 +148,7 @@ namespace POWER_Utils {
#endif
#endif
#ifdef HELTEC_WIRELESS_TRACKER
digitalWrite(VEXT_CTRL, LOW);
adc_ctrl_OFF();
#endif
//gpsIsActive = false;
}
@@ -243,12 +284,7 @@ namespace POWER_Utils {
#ifdef VEXT_CTRL
pinMode(VEXT_CTRL,OUTPUT); // GPS + TFT on HELTEC Wireless_Tracker and only for Oled in HELTEC V3
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? LOW : HIGH);
#endif
#if defined(HELTEC_WP) || defined(HELTEC_WS) || defined(HELTEC_V3_2) || defined(HELTEC_WSL_V3)
digitalWrite(VEXT_CTRL, Config.digi.ecoMode == 1 ? HIGH : LOW);
#endif
vext_ctrl_ON();
#endif
#ifdef HAS_GPS
@@ -257,12 +293,7 @@ namespace POWER_Utils {
#ifdef ADC_CTRL
pinMode(ADC_CTRL, OUTPUT);
#if defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_V3_2)
digitalWrite(ADC_CTRL, LOW);
#endif
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, HIGH);
#endif
adc_ctrl_OFF();
#endif
#if defined(HELTEC_WIRELESS_TRACKER)

View File

@@ -79,15 +79,15 @@ namespace Utils {
}
if (WiFi.status() == WL_CONNECTED && Config.aprs_is.active && Config.beacon.sendViaAPRSIS) {
delay(1000);
status.concat(",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate ");
status.concat(versionDate);
status.concat(",qAC:>");
status.concat(Config.beacon.statusPacket);
APRS_IS_Utils::upload(status);
SYSLOG_Utils::log(2, status, 0, 0.0, 0); // APRSIS TX
SYSLOG_Utils::log(2, status, 0, 0.0, 0); // APRSIS TX
statusAfterBoot = false;
}
if (statusAfterBoot && !Config.beacon.sendViaAPRSIS && Config.beacon.sendViaRF) {
status.concat(":>https://github.com/richonguzman/LoRa_APRS_iGate ");
status.concat(versionDate);
status.concat(":>");
status.concat(Config.beacon.statusPacket);
STATION_Utils::addToOutputPacketBuffer(status);
statusAfterBoot = false;
}
@@ -337,7 +337,7 @@ namespace Utils {
beaconUpdate = false;
}
if (statusAfterBoot) {
if (statusAfterBoot && Config.beacon.statusActive && !Config.beacon.statusPacket.isEmpty()) {
processStatus();
}
}

View File

@@ -129,19 +129,19 @@ namespace WEB_Utils {
Config.wifiAPs.push_back(wifiap);
}
Config.callsign = request->getParam("callsign", true)->value();
Config.callsign = request->getParam("callsign", true)->value();
Config.wifiAutoAP.password = request->getParam("wifi.autoAP.password", true)->value();
Config.wifiAutoAP.timeout = request->getParam("wifi.autoAP.timeout", true)->value().toInt();
Config.wifiAutoAP.password = request->getParam("wifi.autoAP.password", true)->value();
Config.wifiAutoAP.timeout = request->getParam("wifi.autoAP.timeout", true)->value().toInt();
Config.aprs_is.active = request->hasParam("aprs_is.active", true);
Config.aprs_is.passcode = request->getParam("aprs_is.passcode", true)->value();
Config.aprs_is.server = request->getParam("aprs_is.server", true)->value();
Config.aprs_is.port = request->getParam("aprs_is.port", true)->value().toInt();
Config.aprs_is.filter = request->getParam("aprs_is.filter", true)->value();
Config.aprs_is.messagesToRF = request->hasParam("aprs_is.messagesToRF", true);
Config.aprs_is.objectsToRF = request->hasParam("aprs_is.objectsToRF", true);
Config.aprs_is.active = request->hasParam("aprs_is.active", true);
Config.aprs_is.passcode = request->getParam("aprs_is.passcode", true)->value();
Config.aprs_is.server = request->getParam("aprs_is.server", true)->value();
Config.aprs_is.port = request->getParam("aprs_is.port", true)->value().toInt();
Config.aprs_is.filter = request->getParam("aprs_is.filter", true)->value();
Config.aprs_is.messagesToRF = request->hasParam("aprs_is.messagesToRF", true);
Config.aprs_is.objectsToRF = request->hasParam("aprs_is.objectsToRF", true);
Config.beacon.interval = request->getParam("beacon.interval", true)->value().toInt();
@@ -154,6 +154,9 @@ namespace WEB_Utils {
Config.beacon.symbol = request->getParam("beacon.symbol", true)->value();
Config.beacon.path = request->getParam("beacon.path", true)->value();
Config.beacon.statusActive = request->hasParam("beacon.statusActive", true);
Config.beacon.statusPacket = request->getParam("beacon.statusPacket", true)->value();
Config.beacon.gpsActive = request->hasParam("beacon.gpsActive", true);
Config.beacon.gpsAmbiguity = request->hasParam("beacon.gpsAmbiguity", true);

View File

@@ -224,6 +224,14 @@ namespace WX_Utils {
}
}
float getAltitudeCorrection() {
#ifdef HAS_GPS
return Config.beacon.gpsActive ? gps.altitude.meters() : Config.wxsensor.heightCorrection;
#else
return Config.wxsensor.heightCorrection;
#endif
}
String readDataSensor() {
switch (wxModuleType) {
case 1: // BME280
@@ -282,11 +290,7 @@ namespace WX_Utils {
String presStr = (wxModuleType == 4 || wxModuleType == 5)
? "....."
#ifdef HAS_GPS
: generatePresString(newPress + (gps.altitude.meters() / CORRECTION_FACTOR));
#else
: generatePresString(newPress + (Config.wxsensor.heightCorrection / CORRECTION_FACTOR));
#endif
: generatePresString(newPress + getAltitudeCorrection() / CORRECTION_FACTOR);
fifthLine = "BME-> ";
fifthLine += String(int(newTemp + Config.wxsensor.temperatureCorrection));