mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-20 20:36:11 +02:00
Merge branch 'development02' into asyncWeb02
This commit is contained in:
commit
b871ed06d2
7 changed files with 36 additions and 14 deletions
|
@ -1,3 +1,5 @@
|
|||
 
|
||||
|
||||

|
||||
|
||||
# ahoy
|
||||
|
@ -9,7 +11,7 @@ Click on the link below you are interested in.
|
|||
There you will find further explanations on how to proceed. (*Note: It is still under construction!*)
|
||||
|
||||
##### Most updated section
|
||||
- [ESP8266](tools/esp8266/) that includes an web interface 
|
||||
- [ESP8266](tools/esp8266/) that includes an web interface
|
||||
|
||||
##### will be updated as needed
|
||||
- [Arduino Nano](tools/nano/NRF24_SendRcv/)
|
||||
|
|
|
@ -54,16 +54,20 @@ void app::loop(void) {
|
|||
mWebInst->loop();
|
||||
|
||||
if(checkTicker(&mUptimeTicker, mUptimeInterval)) {
|
||||
if(millis() - mPrevMillis >= 1000) {
|
||||
mPrevMillis += 1000;
|
||||
mUptimeSecs++;
|
||||
if(0 != mTimestamp)
|
||||
mTimestamp++;
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
if(checkTicker(&mNtpRefreshTicker, mNtpRefreshInterval)) {
|
||||
if(!apActive) {
|
||||
mTimestamp = mWifi->getNtpTime();
|
||||
DPRINTLN(DBG_INFO, "[NTP]: " + getDateTimeStr(mTimestamp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mShouldReboot) {
|
||||
DPRINTLN(DBG_INFO, F("Rebooting..."));
|
||||
|
@ -661,7 +665,11 @@ const char* app::getFieldStateClass(uint8_t fieldId) {
|
|||
void app::resetSystem(void) {
|
||||
mUptimeSecs = 0;
|
||||
mUptimeTicker = 0xffffffff;
|
||||
mUptimeInterval = 1000;
|
||||
mUptimeInterval = 500; // [ms]
|
||||
mPrevMillis = 0;
|
||||
|
||||
mNtpRefreshTicker = 0;
|
||||
mNtpRefreshInterval = NTP_REFRESH_INTERVAL; // [ms]
|
||||
|
||||
#ifdef AP_ONLY
|
||||
mTimestamp = 1;
|
||||
|
|
|
@ -217,7 +217,10 @@ class app {
|
|||
uint32_t mUptimeTicker;
|
||||
uint16_t mUptimeInterval;
|
||||
uint32_t mUptimeSecs;
|
||||
uint32_t mPrevMillis;
|
||||
uint8_t mHeapStatCnt;
|
||||
uint32_t mNtpRefreshTicker;
|
||||
uint32_t mNtpRefreshInterval;
|
||||
|
||||
|
||||
bool mWifiSettingsValid;
|
||||
|
|
|
@ -72,12 +72,15 @@
|
|||
// threshold of minimum power on which the inverter is marked as inactive
|
||||
#define INACT_PWR_THRESH 3
|
||||
|
||||
// default ntp server uri
|
||||
// default NTP server uri
|
||||
#define DEF_NTP_SERVER_NAME "pool.ntp.org"
|
||||
|
||||
// default ntp server port
|
||||
// default NTP server port
|
||||
#define DEF_NTP_PORT 8888
|
||||
|
||||
// NTP refresh interval in ms (default 12h)
|
||||
#define NTP_REFRESH_INTERVAL 12 * 3600 * 1000
|
||||
|
||||
// default mqtt interval
|
||||
#define MQTT_INTERVAL 60
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import re
|
|||
import os
|
||||
import gzip
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
def convert2Header(inFile, compress):
|
||||
fileType = inFile.split(".")[1]
|
||||
define = inFile.split(".")[0].upper()
|
||||
|
@ -12,8 +14,10 @@ def convert2Header(inFile, compress):
|
|||
if os.getcwd()[-4:] != "html":
|
||||
outName = "html/" + "h/" + inFileVarName + ".h"
|
||||
inFile = "html/" + inFile
|
||||
Path("html/h").mkdir(exist_ok=True)
|
||||
else:
|
||||
outName = "h/" + inFileVarName + ".h"
|
||||
Path("h").mkdir(exist_ok=True)
|
||||
|
||||
f = open(inFile, "r")
|
||||
data = f.read()
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<fieldset>
|
||||
<legend class="des">MQTT</legend>
|
||||
<label for="mqttAddr">Broker / Server IP</label>
|
||||
<input type="text" class="text" name="mqttAddr"/>
|
||||
<input type="text" class="text" name="mqttAddr" maxlength="32" />
|
||||
<label for="mqttPort">Port</label>
|
||||
<input type="text" class="text" name="mqttPort"/>
|
||||
<label for="mqttUser">Username (optional)</label>
|
||||
|
|
|
@ -288,7 +288,9 @@ void web::showSave(AsyncWebServerRequest *request) {
|
|||
|
||||
// mqtt
|
||||
if(request->arg("mqttAddr") != "") {
|
||||
request->arg("mqttAddr").toCharArray(mConfig->mqtt.broker, MQTT_ADDR_LEN);
|
||||
String addr = mWeb->arg("mqttAddr");
|
||||
addr.trim();
|
||||
addr.toCharArray(mConfig->mqtt.broker, MQTT_ADDR_LEN);
|
||||
request->arg("mqttUser").toCharArray(mConfig->mqtt.user, MQTT_USER_LEN);
|
||||
if(request->arg("mqttPwd") != "{PWD}")
|
||||
request->arg("mqttPwd").toCharArray(mConfig->mqtt.pwd, MQTT_PWD_LEN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue