This commit is contained in:
Magnus Persson 2022-04-29 06:48:17 +02:00
parent 31dc2bae5f
commit 396608bd7e
5 changed files with 31 additions and 6 deletions

View File

@ -38,10 +38,10 @@ build_flags =
lib_deps = # Switched to forks for better version control.
# Using local copy of these libraries
#https://github.com/jrowberg/i2cdevlib.git#<document>
https://github.com/mp-se/ESP_WiFiManager#v1.9.0 # https://github.com/khoih-prog/ESP_WiFiManager
https://github.com/mp-se/ESP_DoubleResetDetector#v1.2.1 # https://github.com/khoih-prog/ESP_DoubleResetDetector
#https://github.com/PaulStoffregen/OneWire
#https://github.com/milesburton/Arduino-Temperature-Control-Library
https://github.com/mp-se/ESP_WiFiManager#v1.9.0 # https://github.com/khoih-prog/ESP_WiFiManager
https://github.com/mp-se/ESP_DoubleResetDetector#v1.2.1 # https://github.com/khoih-prog/ESP_DoubleResetDetector
https://github.com/mp-se/tinyexpr # https://github.com/codeplea/tinyexpr
https://github.com/mp-se/incbin # https://github.com/graphitemaster/incbin
https://github.com/mp-se/Arduino-Log#1.1.1 # https://github.com/thijse/Arduino-Log

View File

@ -318,7 +318,7 @@ void PerfLogging::pushInflux() {
if (!myConfig.isInfluxDb2Active()) return;
if (myConfig.isInfluxSSL()) {
Log.warning(F("PERF: InfluxDB2 with SSL is not supported when pushing performance data, skipping" CR);
Log.warning(F("PERF: InfluxDB2 with SSL is not supported when pushing performance data, skipping" CR));
return;
}

View File

@ -32,6 +32,8 @@ SOFTWARE.
#include <webserver.hpp>
#include <wifi.hpp>
//#define FORCE_GRAVITY_MODE
// Define constats for this program
#ifdef DEACTIVATE_SLEEPMODE
const int interval = 1000; // ms, time to wait between changes to output
@ -46,8 +48,6 @@ uint32_t runtimeMillis; // Used to calculate the total time since start/wakeup
uint32_t stableGyroMillis; // Used to calculate the total time since last
// stable gyro reading
enum RunMode { gravityMode = 0, configurationMode = 1, wifiSetupMode = 2 };
RunMode runMode = RunMode::gravityMode;
//
@ -63,6 +63,7 @@ void checkSleepMode(float angle, float volt) {
#if defined(FORCE_GRAVITY_MODE)
Log.notice(F("MAIN: Forcing device into gravity mode for debugging" CR));
runMode = RunMode::gravityMode;
return;
#endif
const RawGyroData &g = myConfig.getGyroCalibration();

View File

@ -29,6 +29,9 @@ SOFTWARE.
#include <ArduinoLog.h>
#include <stdlib.h>
enum RunMode { gravityMode = 0, configurationMode = 1, wifiSetupMode = 2 };
extern RunMode runMode;
#if defined(ESP8266)
#include <LittleFS.h>
#define ESP_RESET ESP.reset

View File

@ -204,12 +204,18 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine, bool isSecure) {
String auth = "Token " + String(myConfig.getInfluxDb2PushToken());
if (isSecure) {
if (runMode == RunMode::configurationMode) {
Log.notice(F("PUSH: Skipping InfluxDB since SSL is enabled and we are in config mode." CR));
return;
}
Log.notice(F("PUSH: InfluxDB, SSL enabled without validation." CR));
_wifiSecure.setInsecure();
probeMaxFragement(serverPath);
_httpSecure.setTimeout(myAdvancedConfig.getPushTimeout() * 1000);
_httpSecure.begin(_wifiSecure, serverPath);
_httpSecure.addHeader(F("Authorization"), auth.c_str());
_httpSecure.addHeader(F("Authorization"), auth.c_str());
_httpSecure.setReuse(true);
_lastCode = _httpSecure.POST(doc);
} else {
_http.setTimeout(myAdvancedConfig.getPushTimeout() * 1000);
@ -284,6 +290,11 @@ void PushTarget::sendHttpPost(TemplatingEngine& engine, bool isSecure,
#endif
if (isSecure) {
if (runMode == RunMode::configurationMode) {
Log.notice(F("PUSH: Skipping HTTP since SSL is enabled and we are in config mode." CR));
return;
}
Log.notice(F("PUSH: HTTP, SSL enabled without validation." CR));
_wifiSecure.setInsecure();
probeMaxFragement(serverPath);
@ -353,6 +364,11 @@ void PushTarget::sendHttpGet(TemplatingEngine& engine, bool isSecure) {
#endif
if (isSecure) {
if (runMode == RunMode::configurationMode) {
Log.notice(F("PUSH: Skipping HTTP since SSL is enabled and we are in config mode." CR));
return;
}
Log.notice(F("PUSH: HTTP, SSL enabled without validation." CR));
_wifiSecure.setInsecure();
probeMaxFragement(serverPath);
@ -399,6 +415,11 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
int port = myConfig.getMqttPort();
if (myConfig.isMqttSSL()) {
if (runMode == RunMode::configurationMode) {
Log.notice(F("PUSH: Skipping MQTT since SSL is enabled and we are in config mode." CR));
return;
}
Log.notice(F("PUSH: MQTT, SSL enabled without validation." CR));
_wifiSecure.setInsecure();