mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-01-27 12:50:39 +03:00
Update 2020-11-30
This commit is contained in:
@@ -27,9 +27,15 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Rolling - (2020-11-29)
|
##### Rolling - (2020-11-30)
|
||||||
|
|
||||||
|
* New feature: time zone can be specified, regular time synchronization possible (see new section `[System]` in configuration)
|
||||||
|
|
||||||
|
2020-11-29
|
||||||
|
|
||||||
|
* New feature: errors message can be reported in a separate tag in the MQTT Adapter (parameter: `TopicError`)
|
||||||
* New html interface for modification of configuration parameters (access to direct edit of `config.ini` moved to new expert mode)
|
* New html interface for modification of configuration parameters (access to direct edit of `config.ini` moved to new expert mode)
|
||||||
|
* Bug fixing: wrong truncation of checked value, in case no analog counter present
|
||||||
* Preparation for feature implementation
|
* Preparation for feature implementation
|
||||||
|
|
||||||
2020-11-26
|
2020-11-26
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ void ClassFlow::SetInitialParameter(void)
|
|||||||
ListFlowControll = NULL;
|
ListFlowControll = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<string> ClassFlow::ZerlegeZeile(std::string input)
|
//std::vector<string> ClassFlow::ZerlegeZeile(std::string input, std::string delimiter);
|
||||||
|
|
||||||
|
std::vector<string> ClassFlow::ZerlegeZeile(std::string input, std::string delimiter)
|
||||||
{
|
{
|
||||||
std::vector<string> Output;
|
std::vector<string> Output;
|
||||||
std::string delimiter = " =,";
|
// std::string delimiter = " =,";
|
||||||
|
|
||||||
input = trim(input, delimiter);
|
input = trim(input, delimiter);
|
||||||
size_t pos = findDelimiterPos(input, delimiter);
|
size_t pos = findDelimiterPos(input, delimiter);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ struct HTMLInfo
|
|||||||
class ClassFlow
|
class ClassFlow
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::vector<string> ZerlegeZeile(string input);
|
// std::vector<string> ZerlegeZeile(string input);
|
||||||
|
std::vector<string> ZerlegeZeile(string input, string delimiter = " =, ");
|
||||||
bool isNewParagraph(string input);
|
bool isNewParagraph(string input);
|
||||||
bool GetNextParagraph(FILE* pfile, string& aktparamgraph);
|
bool GetNextParagraph(FILE* pfile, string& aktparamgraph);
|
||||||
bool getNextLine(FILE* pfile, string* rt);
|
bool getNextLine(FILE* pfile, string* rt);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "ClassFlowControll.h"
|
#include "ClassFlowControll.h"
|
||||||
|
|
||||||
|
#include "freertos/task.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
@@ -104,6 +106,9 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
|||||||
if (toUpper(_type).compare("[DEBUG]") == 0)
|
if (toUpper(_type).compare("[DEBUG]") == 0)
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
|
||||||
|
if (toUpper(_type).compare("[SYSTEM]") == 0)
|
||||||
|
cfc = this;
|
||||||
|
|
||||||
return cfc;
|
return cfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,12 +264,12 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0)) // Paragraph passt nicht zu MakeImage
|
if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0) && (toUpper(aktparamgraph).compare("[SYSTEM]") != 0)) // Paragraph passt nicht zu MakeImage
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
zerlegt = this->ZerlegeZeile(aktparamgraph, " =");
|
||||||
if ((toUpper(zerlegt[0]) == "AUTOSTART") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "AUTOSTART") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(zerlegt[1]) == "TRUE")
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
@@ -291,6 +296,19 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
{
|
{
|
||||||
LogFile.SetRetention(std::stoi(zerlegt[1]));
|
LogFile.SetRetention(std::stoi(zerlegt[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "TIMEZONE") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
string zw = "Set TimeZone: " + zerlegt[1];
|
||||||
|
setTimeZone(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "TIMEUPDATEINTERVALL") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
TimeUpdateIntervall = stof(zerlegt[1]);
|
||||||
|
xTaskCreate(&task_doTimeSync, "update_time", configMINIMAL_STACK_SIZE * 16, &TimeUpdateIntervall, tskIDLE_PRIORITY, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ protected:
|
|||||||
float AutoIntervall;
|
float AutoIntervall;
|
||||||
void SetInitialParameter(void);
|
void SetInitialParameter(void);
|
||||||
std::string aktstatus;
|
std::string aktstatus;
|
||||||
|
int TimeUpdateIntervall;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ ClassFlowMQTT::ClassFlowMQTT()
|
|||||||
{
|
{
|
||||||
uri = "";
|
uri = "";
|
||||||
topic = "";
|
topic = "";
|
||||||
|
topicError = "";
|
||||||
clientname = "watermeter";
|
clientname = "watermeter";
|
||||||
OldValue = "";
|
OldValue = "";
|
||||||
flowpostprocessing = NULL;
|
flowpostprocessing = NULL;
|
||||||
@@ -21,6 +22,7 @@ ClassFlowMQTT::ClassFlowMQTT(std::vector<ClassFlow*>* lfc)
|
|||||||
{
|
{
|
||||||
uri = "";
|
uri = "";
|
||||||
topic = "";
|
topic = "";
|
||||||
|
topicError = "";
|
||||||
clientname = "watermeter";
|
clientname = "watermeter";
|
||||||
OldValue = "";
|
OldValue = "";
|
||||||
flowpostprocessing = NULL;
|
flowpostprocessing = NULL;
|
||||||
@@ -71,6 +73,10 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
{
|
{
|
||||||
this->topic = zerlegt[1];
|
this->topic = zerlegt[1];
|
||||||
}
|
}
|
||||||
|
if ((toUpper(zerlegt[0]) == "TOPICERROR") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
this->topicError = zerlegt[1];
|
||||||
|
}
|
||||||
if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
this->clientname = zerlegt[1];
|
this->clientname = zerlegt[1];
|
||||||
@@ -90,11 +96,13 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
bool ClassFlowMQTT::doFlow(string zwtime)
|
bool ClassFlowMQTT::doFlow(string zwtime)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
std::string resulterror = "";
|
||||||
string zw = "";
|
string zw = "";
|
||||||
|
|
||||||
if (flowpostprocessing)
|
if (flowpostprocessing)
|
||||||
{
|
{
|
||||||
result = flowpostprocessing->getReadoutParam(false, true);
|
result = flowpostprocessing->getReadoutParam(false, true);
|
||||||
|
resulterror = flowpostprocessing->getReadoutError();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -113,6 +121,10 @@ bool ClassFlowMQTT::doFlow(string zwtime)
|
|||||||
|
|
||||||
MQTTPublish(topic, result);
|
MQTTPublish(topic, result);
|
||||||
|
|
||||||
|
if (topicError.length() > 0) {
|
||||||
|
MQTTPublish(topicError, resulterror);
|
||||||
|
}
|
||||||
|
|
||||||
OldValue = result;
|
OldValue = result;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class ClassFlowMQTT :
|
|||||||
public ClassFlow
|
public ClassFlow
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::string uri, topic, clientname;
|
std::string uri, topic, topicError, clientname;
|
||||||
std::string OldValue;
|
std::string OldValue;
|
||||||
ClassFlowPostProcessing* flowpostprocessing;
|
ClassFlowPostProcessing* flowpostprocessing;
|
||||||
std::string user, password;
|
std::string user, password;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
string ClassFlowPostProcessing::GetPreValue()
|
string ClassFlowPostProcessing::GetPreValue()
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
result = to_string(PreValue);
|
result = RundeOutput(PreValue, -DecimalShift);
|
||||||
|
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
{
|
{
|
||||||
@@ -130,6 +130,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing()
|
|||||||
useMaxRateValue = false;
|
useMaxRateValue = false;
|
||||||
checkDigitIncreaseConsistency = false;
|
checkDigitIncreaseConsistency = false;
|
||||||
DecimalShift = 0;
|
DecimalShift = 0;
|
||||||
|
ErrorMessageText = "";
|
||||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +146,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
|
|||||||
useMaxRateValue = false;
|
useMaxRateValue = false;
|
||||||
checkDigitIncreaseConsistency = false;
|
checkDigitIncreaseConsistency = false;
|
||||||
DecimalShift = 0;
|
DecimalShift = 0;
|
||||||
|
ErrorMessageText = "";
|
||||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
||||||
ListFlowControll = lfc;
|
ListFlowControll = lfc;
|
||||||
}
|
}
|
||||||
@@ -263,9 +265,10 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
bool isanalog = false;
|
bool isanalog = false;
|
||||||
int AnzahlAnalog = 0;
|
int AnzahlAnalog = 0;
|
||||||
string zw;
|
string zw;
|
||||||
string error = "";
|
|
||||||
time_t imagetime = 0;
|
time_t imagetime = 0;
|
||||||
|
|
||||||
|
ErrorMessageText = "";
|
||||||
|
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
{
|
{
|
||||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
|
||||||
@@ -344,24 +347,24 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
|
|
||||||
if ((!AllowNegativeRates) && (Value < PreValue))
|
if ((!AllowNegativeRates) && (Value < PreValue))
|
||||||
{
|
{
|
||||||
error = error + "Negative Rate - Returned old value - read value: " + zwvalue + " ";
|
ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " ";
|
||||||
Value = PreValue;
|
Value = PreValue;
|
||||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
|
if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
|
||||||
{
|
{
|
||||||
error = error + "Rate too high - Returned old value - read value: " + zwvalue + " ";
|
ErrorMessageText = ErrorMessageText + "Rate too high - Returned old value - read value: " + zwvalue + " ";
|
||||||
Value = PreValue;
|
Value = PreValue;
|
||||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValueNoError = zwvalue;
|
ReturnValueNoError = zwvalue;
|
||||||
ReturnValue = zwvalue;
|
ReturnValue = zwvalue;
|
||||||
if (ErrorMessage && (error.length() > 0))
|
if (ErrorMessage && (ErrorMessageText.length() > 0))
|
||||||
ReturnValue = ReturnValue + "\t" + error;
|
ReturnValue = ReturnValue + "\t" + ErrorMessageText;
|
||||||
|
|
||||||
if (error.length() == 0)
|
if (ErrorMessageText.length() == 0)
|
||||||
{
|
{
|
||||||
PreValue = Value;
|
PreValue = Value;
|
||||||
SavePreValue(Value, zwtime);
|
SavePreValue(Value, zwtime);
|
||||||
@@ -471,3 +474,9 @@ float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamsh
|
|||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string ClassFlowPostProcessing::getReadoutError()
|
||||||
|
{
|
||||||
|
return ErrorMessageText;
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ protected:
|
|||||||
string ReturnRawValue; // Rohwert (mit N & führenden 0)
|
string ReturnRawValue; // Rohwert (mit N & führenden 0)
|
||||||
string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
|
string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
|
||||||
string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
|
string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
|
||||||
|
string ErrorMessageText; // Fehlermeldung bei Consistency Check
|
||||||
|
|
||||||
bool LoadPreValue(void);
|
bool LoadPreValue(void);
|
||||||
string ShiftDecimal(string in, int _decShift);
|
string ShiftDecimal(string in, int _decShift);
|
||||||
@@ -39,6 +40,7 @@ public:
|
|||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
string getReadout();
|
string getReadout();
|
||||||
string getReadoutParam(bool _rawValue, bool _noerror);
|
string getReadoutParam(bool _rawValue, bool _noerror);
|
||||||
|
string getReadoutError();
|
||||||
void SavePreValue(float value, string time = "");
|
void SavePreValue(float value, string time = "");
|
||||||
string GetPreValue();
|
string GetPreValue();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
|||||||
|
|
||||||
idf_component_register(SRCS ${app_sources}
|
idf_component_register(SRCS ${app_sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES tfmicro)
|
REQUIRES tfmicro jomjol_logfile)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
// #include "protocol_examples_common.h"
|
// #include "protocol_examples_common.h"
|
||||||
#include "esp_sntp.h"
|
#include "esp_sntp.h"
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
static const char *TAG = "sntp";
|
static const char *TAG = "sntp";
|
||||||
|
|
||||||
RTC_DATA_ATTR int boot_count = 0;
|
RTC_DATA_ATTR int boot_count = 0;
|
||||||
@@ -56,8 +58,8 @@ std::string gettimestring(const char * frm)
|
|||||||
}
|
}
|
||||||
char strftime_buf[64];
|
char strftime_buf[64];
|
||||||
|
|
||||||
setenv("TZ", "UTC-2", 1);
|
// setenv("TZ", "UTC-2", 1);
|
||||||
tzset();
|
// tzset();
|
||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
strftime(strftime_buf, sizeof(strftime_buf), frm, &timeinfo);
|
strftime(strftime_buf, sizeof(strftime_buf), frm, &timeinfo);
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ std::string gettimestring(const char * frm)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_time(void)
|
void setup_time()
|
||||||
{
|
{
|
||||||
++boot_count;
|
++boot_count;
|
||||||
ESP_LOGI(TAG, "Boot count: %d", boot_count);
|
ESP_LOGI(TAG, "Boot count: %d", boot_count);
|
||||||
@@ -84,10 +86,10 @@ void setup_time(void)
|
|||||||
}
|
}
|
||||||
char strftime_buf[64];
|
char strftime_buf[64];
|
||||||
|
|
||||||
// Set timezone to Berlin Standard Time
|
setTimeZone("CET-1CEST,M3.5.0,M10.5.0/3");
|
||||||
setenv("TZ", "UTC+9", 1);
|
// setTimeZone("Europe/Berlin");
|
||||||
// setenv("TZ", "Europe/Berlin", 1);
|
// setTimeZone("Asia/Tokyo");
|
||||||
tzset();
|
|
||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||||
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
||||||
@@ -96,9 +98,17 @@ void setup_time(void)
|
|||||||
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
||||||
|
|
||||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
printf("time %s\n", zw.c_str());
|
printf("timeist %s\n", zw.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTimeZone(std::string _tzstring)
|
||||||
|
{
|
||||||
|
setenv("TZ", _tzstring.c_str(), 1);
|
||||||
|
tzset();
|
||||||
|
printf("TimeZone set to %s\n", _tzstring.c_str());
|
||||||
|
_tzstring = "Time zone set to " + _tzstring;
|
||||||
|
LogFile.WriteToFile(_tzstring);
|
||||||
|
}
|
||||||
|
|
||||||
static void obtain_time(void)
|
static void obtain_time(void)
|
||||||
{
|
{
|
||||||
@@ -113,6 +123,14 @@ static void obtain_time(void)
|
|||||||
ESP_LOGI(TAG, "Waiting for system time to be set... (%d/%d)", retry, retry_count);
|
ESP_LOGI(TAG, "Waiting for system time to be set... (%d/%d)", retry, retry_count);
|
||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
if (retry == retry_count) {
|
||||||
|
LogFile.WriteToFile("Time Synchzronisation nicht erfolgreich ...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogFile.WriteToFile("Time erfolgreich ...");
|
||||||
|
}
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
}
|
}
|
||||||
@@ -125,3 +143,32 @@ static void initialize_sntp(void)
|
|||||||
sntp_set_time_sync_notification_cb(time_sync_notification_cb);
|
sntp_set_time_sync_notification_cb(time_sync_notification_cb);
|
||||||
sntp_init();
|
sntp_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void task_doTimeSync(void *pvParameter)
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
struct tm timeinfo;
|
||||||
|
char strftime_buf[64];
|
||||||
|
int *zw_int = (int*) pvParameter;
|
||||||
|
|
||||||
|
printf("Start Autoupdate Time every: %d Stunden\n", *zw_int );
|
||||||
|
TickType_t xDelay = ((*zw_int) * 60 * 60 * 1000) / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
obtain_time();
|
||||||
|
localtime_r(&now, &timeinfo);
|
||||||
|
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||||
|
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
||||||
|
|
||||||
|
strftime(strftime_buf, sizeof(strftime_buf), "%Y-%m-%d_%H:%M", &timeinfo);
|
||||||
|
ESP_LOGI(TAG, "The current date/time in Berlin is: %s", strftime_buf);
|
||||||
|
|
||||||
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
|
printf("time %s\n", zw.c_str());
|
||||||
|
|
||||||
|
vTaskDelay( xDelay );
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||||
|
}
|
||||||
@@ -18,3 +18,5 @@ extern int boot_count;
|
|||||||
void setup_time(void);
|
void setup_time(void);
|
||||||
|
|
||||||
std::string gettimestring(const char * frm);
|
std::string gettimestring(const char * frm);
|
||||||
|
void task_doTimeSync(void *pvParameter);
|
||||||
|
void setTimeZone(std::string _tzstring);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="891adf3";
|
const char* GIT_REV="1b5f6b4";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-11-29 15:14";
|
const char* BUILD_TIME="2020-11-30 12:06";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="891adf3";
|
const char* GIT_REV="1b5f6b4";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-11-29 15:14";
|
const char* BUILD_TIME="2020-11-30 12:06";
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
[MakeImage]
|
[MakeImage]
|
||||||
;LogImageLocation = /log/source
|
;LogImageLocation = /log/source
|
||||||
;LogfileRetentionInDays = 15
|
;LogfileRetentionInDays = 15
|
||||||
WaitBeforeTakingPicture=5
|
WaitBeforeTakingPicture = 5
|
||||||
ImageQuality = 5
|
ImageQuality = 5
|
||||||
ImageSize = VGA
|
ImageSize = VGA
|
||||||
|
|
||||||
@@ -14,19 +14,19 @@ SearchFieldY = 20
|
|||||||
|
|
||||||
|
|
||||||
[Digits]
|
[Digits]
|
||||||
Model=/config/dig0710s3.tflite
|
Model = /config/dig0720s1.tflite
|
||||||
LogImageLocation = /log/digit
|
;LogImageLocation = /log/digit
|
||||||
LogfileRetentionInDays = 15
|
;LogfileRetentionInDays = 3
|
||||||
ModelInputSize 20, 32
|
ModelInputSize = 20 32
|
||||||
digit1, 306, 120, 37, 67
|
digit1, 306, 120, 37, 67
|
||||||
digit2, 355, 120, 37, 67
|
digit2, 355, 120, 37, 67
|
||||||
digit3, 404, 120, 37, 67
|
digit3, 404, 120, 37, 67
|
||||||
|
|
||||||
[Analog]
|
[Analog]
|
||||||
Model=/config/ana0630s2.tflite
|
Model = /config/ana0630s2.tflite
|
||||||
LogImageLocation = /log/analog
|
;LogImageLocation = /log/analog
|
||||||
LogfileRetentionInDays = 15
|
;LogfileRetentionInDays = 3
|
||||||
ModelInputSize 32, 32
|
ModelInputSize = 32 32
|
||||||
analog1, 444, 225, 92, 92
|
analog1, 444, 225, 92, 92
|
||||||
analog2, 391, 329, 92, 92
|
analog2, 391, 329, 92, 92
|
||||||
analog3, 294, 369, 92, 92
|
analog3, 294, 369, 92, 92
|
||||||
@@ -39,22 +39,25 @@ PreValueAgeStartup = 720
|
|||||||
AllowNegativeRates = False
|
AllowNegativeRates = False
|
||||||
MaxRateValue = 0.1
|
MaxRateValue = 0.1
|
||||||
ErrorMessage = True
|
ErrorMessage = True
|
||||||
CheckDigitIncreaseConsistency = False
|
CheckDigitIncreaseConsistency = True
|
||||||
|
|
||||||
;[MQTT]
|
[MQTT]
|
||||||
;Uri = mqtt://IP-MQTT-SERVER:1883
|
;Uri = mqtt://IP-ADRESS:1883
|
||||||
;Topic = watermeter/readout
|
;Topic = wasserzaehler/zaehlerstand
|
||||||
|
;TopicError = wasserzaehler/error
|
||||||
;ClientID = wasser
|
;ClientID = wasser
|
||||||
;user = USERNAME
|
;user = USERNAME
|
||||||
;password = PASSWORD
|
;password = PASSWORD
|
||||||
|
|
||||||
[AutoTimer]
|
[AutoTimer]
|
||||||
AutoStart= True
|
AutoStart = True
|
||||||
Intervall = 4.85
|
Intervall = 4.85
|
||||||
|
|
||||||
[Debug]
|
[Debug]
|
||||||
Logfile = False
|
Logfile = False
|
||||||
; Number of days before a log file is deleted. 0 = disabled. 10 is default value (if not defined)
|
LogfileRetentionInDays = 3
|
||||||
;LogfileRetentionInDays = 10
|
|
||||||
|
[System]
|
||||||
|
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
|
||||||
|
|
||||||
[Ende]
|
[Ende]
|
||||||
2
sd-card/config/prevalue.ini
Normal file
2
sd-card/config/prevalue.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
2020-11-30_12-02-22
|
||||||
|
42.013401
|
||||||
@@ -561,27 +561,10 @@ textarea {
|
|||||||
<class id="System_TimeZone_text" style="color:black;">TimeZone</class>
|
<class id="System_TimeZone_text" style="color:black;">TimeZone</class>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="number" id="System_TimeZone_value1" size="13" min="-12" max="12" step="1">
|
<input type="text" id="System_TimeZone_value1">
|
||||||
</td>
|
</td>
|
||||||
<td style="font-size: 80%;">
|
<td style="font-size: 80%;">
|
||||||
Adjustment of time zone relative to UTC (in hours)
|
Time zone in POSIX syntax (Europe/Berlin = "CET-1CEST,M3.5.0,M10.5.0/3" - incl. daylight saving)
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="20px" style="padding-left: 40px;">
|
|
||||||
<input type="checkbox" id="System_AutoAdjustSummertime_enabled" value="1" onclick = 'document.getElementById("System_AutoAdjustSummertime_value1").disabled = !document.getElementById("System_AutoAdjustSummertime_value1").disabled' unchecked >
|
|
||||||
</td>
|
|
||||||
<td width="200px">
|
|
||||||
<class id="System_AutoAdjustSummertime_text" style="color:black;">AutoAdjustSummertime</class>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select id="System_AutoAdjustSummertime_value1">
|
|
||||||
<option value="0" selected>True</option>
|
|
||||||
<option value="1" >False</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td style="font-size: 80%;">
|
|
||||||
Autoadjust the summertime
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="expert" id="ex16">
|
<tr class="expert" id="ex16">
|
||||||
@@ -726,10 +709,7 @@ function UpdateInput() {
|
|||||||
WriteParameter(param, "Debug", "LogfileRetentionInDays", true);
|
WriteParameter(param, "Debug", "LogfileRetentionInDays", true);
|
||||||
|
|
||||||
WriteParameter(param, "System", "TimeZone", true);
|
WriteParameter(param, "System", "TimeZone", true);
|
||||||
WriteParameter(param, "System", "AutoAdjustSummertime", true, true);
|
|
||||||
WriteParameter(param, "System", "TimeUpdateIntervall", true);
|
WriteParameter(param, "System", "TimeUpdateIntervall", true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function WriteConfig(){
|
function WriteConfig(){
|
||||||
@@ -774,11 +754,8 @@ function WriteConfig(){
|
|||||||
ReadParameter(param, "Debug", "LogfileRetentionInDays", true);
|
ReadParameter(param, "Debug", "LogfileRetentionInDays", true);
|
||||||
|
|
||||||
ReadParameter(param, "System", "TimeZone", true);
|
ReadParameter(param, "System", "TimeZone", true);
|
||||||
ReadParameter(param, "System", "AutoAdjustSummertime", true, true);
|
|
||||||
ReadParameter(param, "System", "TimeUpdateIntervall", true);
|
ReadParameter(param, "System", "TimeUpdateIntervall", true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FormatDecimalValue(param, "PostProcessing", "MaxRateValue");
|
FormatDecimalValue(param, "PostProcessing", "MaxRateValue");
|
||||||
|
|
||||||
return setConfigParameters(param);
|
return setConfigParameters(param);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ function ParseConfigParamSystem(_aktline){
|
|||||||
while ((akt_ref < 2) && (_aktline < config_split.length) && (config_split[_aktline][0] != "[")) {
|
while ((akt_ref < 2) && (_aktline < config_split.length) && (config_split[_aktline][0] != "[")) {
|
||||||
var _input = config_split[_aktline];
|
var _input = config_split[_aktline];
|
||||||
let [isCom, input] = isCommented(_input);
|
let [isCom, input] = isCommented(_input);
|
||||||
var linesplit = ZerlegeZeile(input);
|
var linesplit = ZerlegeZeile(input, " =");
|
||||||
|
|
||||||
ParamExtractValue(param, linesplit, catname, "TimeZone", _aktline, isCom);
|
ParamExtractValue(param, linesplit, catname, "TimeZone", _aktline, isCom);
|
||||||
ParamExtractValue(param, linesplit, catname, "AutoAdjustSummertime", _aktline, isCom);
|
ParamExtractValue(param, linesplit, catname, "AutoAdjustSummertime", _aktline, isCom);
|
||||||
@@ -412,10 +412,10 @@ function createReader(file) {
|
|||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ZerlegeZeile(input)
|
function ZerlegeZeile(input, delimiter = " =,")
|
||||||
{
|
{
|
||||||
var Output = Array(0);
|
var Output = Array(0);
|
||||||
delimiter = " =,";
|
// delimiter = " =,";
|
||||||
|
|
||||||
input = trim(input, delimiter);
|
input = trim(input, delimiter);
|
||||||
var pos = findDelimiterPos(input, delimiter);
|
var pos = findDelimiterPos(input, delimiter);
|
||||||
|
|||||||
Reference in New Issue
Block a user