mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-27 10:54:16 +01:00
bme into wxsensor
This commit is contained in:
parent
3fd819bd4e
commit
a17900e4d0
|
|
@ -57,7 +57,7 @@
|
|||
"voltageDividerR2": 27.0,
|
||||
"sendVoltageAsTelemetry": true
|
||||
},
|
||||
"bme": {
|
||||
"wxsensor": {
|
||||
"active": false,
|
||||
"heightCorrection": 0,
|
||||
"temperatureCorrection": 0.0
|
||||
|
|
|
|||
|
|
@ -1135,7 +1135,7 @@
|
|||
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>
|
||||
|
|
@ -1145,12 +1145,12 @@
|
|||
<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
|
||||
|
|
@ -1162,14 +1162,14 @@
|
|||
</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"
|
||||
|
|
@ -1181,14 +1181,14 @@
|
|||
</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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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']");
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef BME_UTILS_H_
|
||||
#define BME_UTILS_H_
|
||||
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_BME280.h>
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <Adafruit_BME680.h>
|
||||
#include "Adafruit_Si7021.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
namespace BME_Utils {
|
||||
|
||||
void getWxModuleAddres();
|
||||
void setup();
|
||||
String generateTempString(const float bmeTemp);
|
||||
String generateHumString(const float bmeHum);
|
||||
String generatePresString(const float bmePress);
|
||||
String readDataSensor();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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";
|
||||
|
|
@ -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 = "";
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public:
|
|||
bool sendVoltageAsTelemetry;
|
||||
};
|
||||
|
||||
class BME {
|
||||
class WXSENSOR {
|
||||
public:
|
||||
bool active;
|
||||
int heightCorrection;
|
||||
|
|
@ -132,7 +132,7 @@ public:
|
|||
LoraModule loramodule;
|
||||
Display display;
|
||||
BATTERY battery;
|
||||
BME bme;
|
||||
WXSENSOR wxsensor;
|
||||
SYSLOG syslog;
|
||||
TNC tnc;
|
||||
OTA ota;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
@ -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...";
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -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 = "_";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "bme_utils.h"
|
||||
#include "configuration.h"
|
||||
#include "gps_utils.h"
|
||||
#include "wx_utils.h"
|
||||
#include "display.h"
|
||||
|
||||
|
||||
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||
#define CORRECTION_FACTOR (8.2296) // for meters
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ Adafruit_Si7021 sensor = Adafruit_Si7021();
|
|||
|
||||
|
||||
|
||||
namespace BME_Utils {
|
||||
namespace WX_Utils {
|
||||
|
||||
void getWxModuleAddres() {
|
||||
uint8_t err, addr;
|
||||
|
|
@ -53,7 +54,7 @@ namespace BME_Utils {
|
|||
}
|
||||
|
||||
void setup() {
|
||||
if (Config.bme.active) {
|
||||
if (Config.wxsensor.active) {
|
||||
getWxModuleAddres();
|
||||
if (wxModuleAddress != 0x00) {
|
||||
bool wxModuleFound = false;
|
||||
|
|
@ -129,8 +130,8 @@ namespace BME_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
String generateTempString(const float bmeTemp) {
|
||||
String strTemp = String((int)bmeTemp);
|
||||
String generateTempString(const float sensorTemp) {
|
||||
String strTemp = String((int)sensorTemp);
|
||||
switch (strTemp.length()) {
|
||||
case 1:
|
||||
return "00" + strTemp;
|
||||
|
|
@ -143,15 +144,15 @@ namespace BME_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
String generateHumString(const float bmeHum) {
|
||||
String strHum = String((int)bmeHum);
|
||||
String generateHumString(const float sensorHum) {
|
||||
String strHum = String((int)sensorHum);
|
||||
switch (strHum.length()) {
|
||||
case 1:
|
||||
return "0" + strHum;
|
||||
case 2:
|
||||
return strHum;
|
||||
case 3:
|
||||
if ((int)bmeHum == 100) {
|
||||
if ((int)sensorHum == 100) {
|
||||
return "00";
|
||||
} else {
|
||||
return "-99";
|
||||
|
|
@ -161,9 +162,9 @@ namespace BME_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
String generatePresString(const float bmePress) {
|
||||
String strPress = String((int)bmePress);
|
||||
String decPress = String(int((bmePress - int(bmePress)) * 10));
|
||||
String generatePresString(const float sensorPres) {
|
||||
String strPress = String((int)sensorPres);
|
||||
String decPress = String(int((sensorPres - int(sensorPres)) * 10));
|
||||
switch (strPress.length()) {
|
||||
case 1:
|
||||
return "000" + strPress + decPress;
|
||||
|
|
@ -213,14 +214,12 @@ namespace BME_Utils {
|
|||
break;
|
||||
}
|
||||
|
||||
String wx;
|
||||
if (isnan(newTemp) || isnan(newHum) || isnan(newPress)) {
|
||||
Serial.println("BME/BMP/Si7021 Module data failed");
|
||||
wx = ".../...g...t...";
|
||||
fifthLine = "";
|
||||
return wx;
|
||||
return ".../...g...t...";
|
||||
} else {
|
||||
String tempStr = generateTempString(((newTemp + Config.bme.temperatureCorrection) * 1.8) + 32);
|
||||
String tempStr = generateTempString(((newTemp + Config.wxsensor.temperatureCorrection) * 1.8) + 32);
|
||||
|
||||
String humStr;
|
||||
if (wxModuleType == 1 || wxModuleType == 3 || wxModuleType == 4) {
|
||||
|
|
@ -233,30 +232,30 @@ namespace BME_Utils {
|
|||
if (wxModuleAddress == 4) {
|
||||
presStr = ".....";
|
||||
} else {
|
||||
presStr = generatePresString(newPress + (Config.bme.heightCorrection/CORRECTION_FACTOR));
|
||||
presStr = generatePresString(newPress + (Config.wxsensor.heightCorrection/CORRECTION_FACTOR));
|
||||
}
|
||||
|
||||
fifthLine = "BME-> ";
|
||||
fifthLine += String(int(newTemp + Config.bme.temperatureCorrection));
|
||||
fifthLine += String(int(newTemp + Config.wxsensor.temperatureCorrection));
|
||||
fifthLine += "C ";
|
||||
fifthLine += humStr;
|
||||
fifthLine += "% ";
|
||||
fifthLine += presStr.substring(0,4);
|
||||
fifthLine += "hPa";
|
||||
|
||||
wx = ".../...g...t";
|
||||
wx += tempStr;
|
||||
wx += "h";
|
||||
wx += humStr;
|
||||
wx += "b";
|
||||
wx += presStr;
|
||||
String wxPayload = ".../...g...t";
|
||||
wxPayload += tempStr;
|
||||
wxPayload += "h";
|
||||
wxPayload += humStr;
|
||||
wxPayload += "b";
|
||||
wxPayload += presStr;
|
||||
|
||||
if (wxModuleType == 3) {
|
||||
wx += "Gas: ";
|
||||
wx += String(newGas);
|
||||
wx += "Kohms";
|
||||
wxPayload += "Gas: ";
|
||||
wxPayload += String(newGas);
|
||||
wxPayload += "Kohms";
|
||||
}
|
||||
return wx;
|
||||
return wxPayload;
|
||||
}
|
||||
}
|
||||
|
||||
23
src/wx_utils.h
Normal file
23
src/wx_utils.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef WX_UTILS_H_
|
||||
#define WX_UTILS_H_
|
||||
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_BME280.h>
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <Adafruit_BME680.h>
|
||||
#include "Adafruit_Si7021.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
namespace WX_Utils {
|
||||
|
||||
void getWxModuleAddres();
|
||||
void setup();
|
||||
String generateTempString(const float sensorTemp);
|
||||
String generateHumString(const float sensorHum);
|
||||
String generatePresString(const float sensorPres);
|
||||
String readDataSensor();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue