Skip to content

Commit

Permalink
bme into wxsensor
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Oct 5, 2024
1 parent 3fd819b commit a17900e
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 106 deletions.
2 changes: 1 addition & 1 deletion data/igate_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"voltageDividerR2": 27.0,
"sendVoltageAsTelemetry": true
},
"bme": {
"wxsensor": {
"active": false,
"heightCorrection": 0,
"temperatureCorrection": 0.0
Expand Down
20 changes: 10 additions & 10 deletions data_embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ <h5>
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8"
/>
</svg>
Telemetry
WX Telemetry
</h5>
<small>Define Wx telemetry</small>
</div>
Expand All @@ -1145,12 +1145,12 @@ <h5>
<div class="form-check form-switch">
<input
type="checkbox"
name="bme.active"
id="bme.active"
name="wxsensor.active"
id="wxsensor.active"
class="form-check-input"
/>
<label
for="bme.active"
for="wxsensor.active"
class="form-label"
><b>Activate Wx Telemetry</b>
<small
Expand All @@ -1162,14 +1162,14 @@ <h5>
</div>
<div class="row mt-3">
<div class="col-6">
<label for="bme.heightCorrection" class="form-label"
<label for="wxsensor.heightCorrection" class="form-label"
>Height Correction (Above Sea-Level)</label
>
<div class="input-group">
<input
type="number"
name="bme.heightCorrection"
id="bme.heightCorrection"
name="wxsensor.heightCorrection"
id="wxsensor.heightCorrection"
placeholder="0"
class="form-control"
step="1"
Expand All @@ -1181,14 +1181,14 @@ <h5>
</div>
</div>
<div class="col-6">
<label for="bme.temperatureCorrection" class="form-label"
<label for="wxsensor.temperatureCorrection" class="form-label"
>Temperature Correction</label
>
<div class="input-group">
<input
type="number"
name="bme.temperatureCorrection"
id="bme.temperatureCorrection"
name="wxsensor.temperatureCorrection"
id="wxsensor.temperatureCorrection"
placeholder="0.0"
class="form-control"
step="0.1"
Expand Down
10 changes: 5 additions & 5 deletions data_embed/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ function loadSettings(settings) {
document.getElementById("battery.externalSleepVoltage").value = settings.battery.externalSleepVoltage.toFixed(1);
document.getElementById("battery.sendVoltageAsTelemetry").checked = settings.battery.sendVoltageAsTelemetry;

// TELEMETRY BME/WX
document.getElementById("bme.active").checked = settings.bme.active;
document.getElementById("bme.heightCorrection").value = settings.bme.heightCorrection;
document.getElementById("bme.temperatureCorrection").value = settings.bme.temperatureCorrection.toFixed(1);
// TELEMETRY WX SENSOR
document.getElementById("wxsensor.active").checked = settings.wxsensor.active;
document.getElementById("wxsensor.heightCorrection").value = settings.wxsensor.heightCorrection;
document.getElementById("wxsensor.temperatureCorrection").value = settings.wxsensor.temperatureCorrection.toFixed(1);

// SYSLOG
document.getElementById("syslog.active").checked = settings.syslog.active;
Expand Down Expand Up @@ -242,7 +242,7 @@ document.getElementById('reboot').addEventListener('click', function (e) {
showToast("Your device will be rebooted in a while");
});

const bmeCheckbox = document.querySelector("input[name='bme.active']");
const wxsensorCheckbox = document.querySelector("input[name='wxsensor.active']");

const stationModeSelect = document.querySelector("select[name='stationMode']");

Expand Down
6 changes: 3 additions & 3 deletions src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ ________________________________________________________________________________
#include "wifi_utils.h"
#include "digi_utils.h"
#include "gps_utils.h"
#include "bme_utils.h"
#include "web_utils.h"
#include "tnc_utils.h"
#include "wx_utils.h"
#include "display.h"
#include "utils.h"
#ifdef HAS_A7670
#include "A7670_utils.h"
#endif

String versionDate = "2024.09.25";
String versionDate = "2024.10.05";
Configuration Config;
WiFiClient espClient;

Expand Down Expand Up @@ -113,7 +113,7 @@ void setup() {
#endif
WIFI_Utils::setup();
SYSLOG_Utils::setup();
BME_Utils::setup();
WX_Utils::setup();
WEB_Utils::setup();
TNC_Utils::setup();
#ifdef HAS_A7670
Expand Down
4 changes: 2 additions & 2 deletions src/battery_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace BATTERY_Utils {
void checkIfShouldSleep(); // ????
void startupBatteryHealth();

String generateEncodedTelemetryBytes(float value, bool firstBytes, byte voltageType);
String generateEncodedTelemetry();
String generateEncodedTelemetryBytes(float value, bool firstBytes, byte voltageType);
String generateEncodedTelemetry();

}

Expand Down
23 changes: 0 additions & 23 deletions src/bme_utils.h

This file was deleted.

16 changes: 8 additions & 8 deletions src/boards_pinout.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// LORA MODULES
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa) || defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_LORA32_V2_1_915) || defined(ESP32_DIY_LoRa_915) || defined(TTGO_T_Beam_V1_2_915) || defined(TTGO_T_Beam_V1_0_915)
#define RADIO_SCLK_PIN 5 // GPIO5 - SX1278 SCK
#define RADIO_SCLK_PIN 5 // GPIO5 - SX1278 SCK
#define RADIO_MISO_PIN 19 // GPIO19 - SX1278 MISO
#define RADIO_MOSI_PIN 27 // GPIO27 - SX1278 MOSI
#define RADIO_CS_PIN 18 // GPIO18 - SX1278 CS ---> NSS
Expand All @@ -19,13 +19,13 @@
#endif

#if defined(HELTEC_V3) || defined(HELTEC_WSL_V3) || defined(HELTEC_WSL_V3_DISPLAY) || defined(HELTEC_WIRELESS_TRACKER) || defined(HELTEC_WS) || defined(HELTEC_WP)
#define RADIO_SCLK_PIN 9 // SX1262 SCK
#define RADIO_MISO_PIN 11 // SX1262 MISO
#define RADIO_MOSI_PIN 10 // SX1262 MOSI
#define RADIO_CS_PIN 8 // SX1262 NSS
#define RADIO_RST_PIN 12 // SX1262 RST
#define RADIO_DIO1_PIN 14 // SX1262 DIO1
#define RADIO_BUSY_PIN 13 // SX1262 BUSY
#define RADIO_SCLK_PIN 9 // SX1262 SCK
#define RADIO_MISO_PIN 11 // SX1262 MISO
#define RADIO_MOSI_PIN 10 // SX1262 MOSI
#define RADIO_CS_PIN 8 // SX1262 NSS
#define RADIO_RST_PIN 12 // SX1262 RST
#define RADIO_DIO1_PIN 14 // SX1262 DIO1
#define RADIO_BUSY_PIN 13 // SX1262 BUSY
#endif

#if defined(ESP32_DIY_1W_LoRa) || defined(ESP32_DIY_1W_LoRa_915) || defined(ESP32_DIY_1W_LoRa_LLCC68) // Ebyte E22 400M30S (SX1268) or E22 900M30S (SX1262) or E220 LLCC68
Expand Down
18 changes: 9 additions & 9 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ void Configuration::writeFile() {

data["battery"]["sendVoltageAsTelemetry"] = battery.sendVoltageAsTelemetry;

data["bme"]["active"] = bme.active;
data["bme"]["heightCorrection"] = bme.heightCorrection;
data["bme"]["temperatureCorrection"] = bme.temperatureCorrection;
data["wxsensor"]["active"] = wxsensor.active;
data["wxsensor"]["heightCorrection"] = wxsensor.heightCorrection;
data["wxsensor"]["temperatureCorrection"] = wxsensor.temperatureCorrection;

data["syslog"]["active"] = syslog.active;
data["syslog"]["server"] = syslog.server;
Expand Down Expand Up @@ -180,9 +180,9 @@ bool Configuration::readFile() {

battery.sendVoltageAsTelemetry = data["battery"]["sendVoltageAsTelemetry"] | false;

bme.active = data["bme"]["active"] | false;
bme.heightCorrection = data["bme"]["heightCorrection"] | 0;
bme.temperatureCorrection = data["bme"]["temperatureCorrection"] | 0.0;
wxsensor.active = data["wxsensor"]["active"] | false;
wxsensor.heightCorrection = data["wxsensor"]["heightCorrection"] | 0;
wxsensor.temperatureCorrection = data["wxsensor"]["temperatureCorrection"] | 0.0;

syslog.active = data["syslog"]["active"] | false;
syslog.server = data["syslog"]["server"] | "192.168.0.100";
Expand Down Expand Up @@ -279,9 +279,9 @@ void Configuration::init() {
syslog.server = "192.168.0.100";
syslog.port = 514;

bme.active = false;
bme.heightCorrection = 0;
bme.temperatureCorrection = 0.0;
wxsensor.active = false;
wxsensor.heightCorrection = 0;
wxsensor.temperatureCorrection = 0.0;

ota.username = "";
ota.password = "";
Expand Down
4 changes: 2 additions & 2 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class BATTERY {
bool sendVoltageAsTelemetry;
};

class BME {
class WXSENSOR {
public:
bool active;
int heightCorrection;
Expand Down Expand Up @@ -132,7 +132,7 @@ class Configuration {
LoraModule loramodule;
Display display;
BATTERY battery;
BME bme;
WXSENSOR wxsensor;
SYSLOG syslog;
TNC tnc;
OTA ota;
Expand Down
2 changes: 1 addition & 1 deletion src/gps_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace GPS_Utils {
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
String encodeGPS(float latitude, float longitude, const String& overlay, const String& symbol);
void generateBeacons();
double calculateDistanceCourse(double latitude, double longitude);
//double calculateDistanceCourse(double latitude, double longitude);
String decodeEncodedGPS(const String& packet);
String getReceivedGPS(const String& packet);
String getDistanceAndComment(const String& packet);
Expand Down
12 changes: 6 additions & 6 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "lora_utils.h"
#include "wifi_utils.h"
#include "gps_utils.h"
#include "bme_utils.h"
#include "wx_utils.h"
#include "display.h"
#include "utils.h"

Expand Down Expand Up @@ -184,7 +184,7 @@ namespace Utils {
displayToggle(true);
}

if (sendStartTelemetry && Config.battery.sendVoltageAsTelemetry && !Config.bme.active && (Config.battery.sendInternalVoltage || Config.battery.sendExternalVoltage)) {
if (sendStartTelemetry && Config.battery.sendVoltageAsTelemetry && !Config.wxsensor.active && (Config.battery.sendInternalVoltage || Config.battery.sendExternalVoltage)) {
sendInitialTelemetryPackets();
}

Expand All @@ -194,11 +194,11 @@ namespace Utils {

String beaconPacket = iGateBeaconPacket;
String secondaryBeaconPacket = iGateLoRaBeaconPacket;
if (Config.bme.active && wxModuleType != 0) {
String sensorData = BME_Utils::readDataSensor();
if (Config.wxsensor.active && wxModuleType != 0) {
String sensorData = WX_Utils::readDataSensor();
beaconPacket += sensorData;
secondaryBeaconPacket += sensorData;
} else if (Config.bme.active && wxModuleType == 0) {
} else if (Config.wxsensor.active && wxModuleType == 0) {
beaconPacket += ".../...g...t...";
secondaryBeaconPacket += ".../...g...t...";
}
Expand Down Expand Up @@ -253,7 +253,7 @@ namespace Utils {
}
#endif

if (Config.battery.sendVoltageAsTelemetry && !Config.bme.active && (Config.battery.sendInternalVoltage || Config.battery.sendExternalVoltage)){
if (Config.battery.sendVoltageAsTelemetry && !Config.wxsensor.active && (Config.battery.sendInternalVoltage || Config.battery.sendExternalVoltage)){
String encodedTelemetry = BATTERY_Utils::generateEncodedTelemetry();
beaconPacket += encodedTelemetry;
secondaryBeaconPacket += encodedTelemetry;
Expand Down
16 changes: 8 additions & 8 deletions src/web_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ namespace WEB_Utils {
Config.loramodule.rxActive = request->hasParam("lora.rxActive", true);


Config.display.alwaysOn = request->hasParam("display.alwaysOn", true);
Config.display.alwaysOn = request->hasParam("display.alwaysOn", true);
if (!Config.display.alwaysOn) {
Config.display.timeout = request->getParam("display.timeout", true)->value().toInt();
}
Config.display.turn180 = request->hasParam("display.turn180", true);
Config.display.turn180 = request->hasParam("display.turn180", true);


Config.battery.sendInternalVoltage = request->hasParam("battery.sendInternalVoltage", true);
Expand All @@ -162,18 +162,18 @@ namespace WEB_Utils {
Config.battery.sendExternalVoltage = request->hasParam("battery.sendExternalVoltage", true);
if (Config.battery.sendExternalVoltage) {
Config.battery.externalVoltagePin = request->getParam("battery.externalVoltagePin", true)->value().toInt();
Config.battery.voltageDividerR1 = request->getParam("battery.voltageDividerR1", true)->value().toFloat();
Config.battery.voltageDividerR2 = request->getParam("battery.voltageDividerR2", true)->value().toFloat();
Config.battery.voltageDividerR1 = request->getParam("battery.voltageDividerR1", true)->value().toFloat();
Config.battery.voltageDividerR2 = request->getParam("battery.voltageDividerR2", true)->value().toFloat();
}
Config.battery.monitorExternalVoltage = request->hasParam("battery.monitorExternalVoltage", true);
Config.battery.externalSleepVoltage = request->getParam("battery.externalSleepVoltage", true)->value().toFloat();

Config.battery.sendVoltageAsTelemetry = request->hasParam("battery.sendVoltageAsTelemetry", true);

Config.bme.active = request->hasParam("bme.active", true);
Config.bme.heightCorrection = request->getParam("bme.heightCorrection", true)->value().toInt();
Config.bme.temperatureCorrection = request->getParam("bme.temperatureCorrection", true)->value().toFloat();
if (Config.bme.active) {
Config.wxsensor.active = request->hasParam("wxsensor.active", true);
Config.wxsensor.heightCorrection = request->getParam("wxsensor.heightCorrection", true)->value().toInt();
Config.wxsensor.temperatureCorrection = request->getParam("wxsensor.temperatureCorrection", true)->value().toFloat();
if (Config.wxsensor.active) {
Config.beacon.symbol = "_";
}

Expand Down
2 changes: 1 addition & 1 deletion src/wifi_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace WIFI_Utils {
WiFi.mode(WIFI_MODE_NULL);

WiFi.mode(WIFI_AP);
WiFi.softAP(Config.callsign + " AP", Config.wifiAutoAP.password);
WiFi.softAP(Config.callsign + "-AP", Config.wifiAutoAP.password);

WiFiAutoAPTime = millis();
WiFiAutoAPStarted = true;
Expand Down
Loading

0 comments on commit a17900e

Please sign in to comment.