mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 04:26:58 +03:00
Rolling 2020-06-12
This commit is contained in:
@@ -25,7 +25,12 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
|
|||||||
|
|
||||||
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||||
|
|
||||||
##### Rolling - (2020-12-04)
|
##### Rolling - (2020-12-06)
|
||||||
|
|
||||||
|
* Update of the initial setup routine
|
||||||
|
* frequent time synchronization
|
||||||
|
|
||||||
|
2020-12-04
|
||||||
|
|
||||||
* Implementation of a setup modus at the beginning of a new installation. It guides the user through a check of the parameters and setting and disables at the end automatically.
|
* Implementation of a setup modus at the beginning of a new installation. It guides the user through a check of the parameters and setting and disables at the end automatically.
|
||||||
Special modus is entered if `SetupMode=true` in section `[System]`
|
Special modus is entered if `SetupMode=true` in section `[System]`
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
|
|
||||||
@@ -23,6 +27,8 @@ std::string ssid;
|
|||||||
std::string passphrase;
|
std::string passphrase;
|
||||||
std::string hostname;
|
std::string hostname;
|
||||||
std::string ipaddress;
|
std::string ipaddress;
|
||||||
|
std::string gw;
|
||||||
|
std::string netmask;
|
||||||
|
|
||||||
std::string std_hostname = "watermeter";
|
std::string std_hostname = "watermeter";
|
||||||
|
|
||||||
@@ -86,7 +92,7 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
|||||||
{
|
{
|
||||||
switch(event->event_id) {
|
switch(event->event_id) {
|
||||||
case SYSTEM_EVENT_STA_START:
|
case SYSTEM_EVENT_STA_START:
|
||||||
blinkstatus(200, 5);
|
blinkstatus(200, 1);
|
||||||
wifi_connect();
|
wifi_connect();
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_GOT_IP:
|
case SYSTEM_EVENT_STA_GOT_IP:
|
||||||
@@ -125,12 +131,96 @@ void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _ho
|
|||||||
tcpip_adapter_ip_info_t ip_info;
|
tcpip_adapter_ip_info_t ip_info;
|
||||||
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
|
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
|
||||||
ipaddress = std::string(ip4addr_ntoa(&ip_info.ip));
|
ipaddress = std::string(ip4addr_ntoa(&ip_info.ip));
|
||||||
|
netmask = std::string(ip4addr_ntoa(&ip_info.netmask));
|
||||||
|
gw = std::string(ip4addr_ntoa(&ip_info.gw));
|
||||||
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
|
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
|
||||||
printf("HostName : %s\n", hostname.c_str());
|
printf("HostName : %s\n", hostname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
|
void strinttoip4(std::string ip, int &a, int &b, int &c, int &d) {
|
||||||
|
std::stringstream s(ip);
|
||||||
|
char ch; //to temporarily store the '.'
|
||||||
|
s >> a >> ch >> b >> ch >> c >> ch >> d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _netmask, std::string _ssid, std::string _passphrase, std::string _hostname)
|
||||||
|
{
|
||||||
|
|
||||||
|
ssid = _ssid;
|
||||||
|
passphrase = _passphrase;
|
||||||
|
hostname = _hostname;
|
||||||
|
|
||||||
|
wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
|
|
||||||
|
esp_netif_t *my_sta = esp_netif_create_default_wifi_sta();
|
||||||
|
|
||||||
|
esp_netif_dhcpc_stop(my_sta);
|
||||||
|
|
||||||
|
esp_netif_ip_info_t ip_info;
|
||||||
|
|
||||||
|
int a, b, c, d;
|
||||||
|
|
||||||
|
strinttoip4(_ip, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.ip, a, b, c, d);
|
||||||
|
|
||||||
|
strinttoip4(_gw, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.gw, a, b, c, d);
|
||||||
|
|
||||||
|
strinttoip4(_netmask, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.netmask, a, b, c, d);
|
||||||
|
|
||||||
|
esp_netif_set_ip_info(my_sta, &ip_info);
|
||||||
|
|
||||||
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
|
||||||
|
|
||||||
|
|
||||||
|
// ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
|
||||||
|
// ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
|
||||||
|
|
||||||
|
wifi_config_t wifi_config = { };
|
||||||
|
strcpy((char*)wifi_config.sta.ssid, (const char*)ssid.c_str());
|
||||||
|
strcpy((char*)wifi_config.sta.password, (const char*)passphrase.c_str());
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||||
|
|
||||||
|
ESP_LOGI(MAIN_TAG, "wifi_init_sta finished.");
|
||||||
|
|
||||||
|
EventBits_t bits = xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
|
||||||
|
|
||||||
|
// EventBits_t bits = xEventGroupWaitBits(wifi_event_group,
|
||||||
|
// WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
||||||
|
// pdFALSE,
|
||||||
|
// pdFALSE,
|
||||||
|
// portMAX_DELAY);
|
||||||
|
|
||||||
|
if (bits & CONNECTED_BIT) {
|
||||||
|
ESP_LOGI(MAIN_TAG, "connected to ap SSID:%s password:%s",
|
||||||
|
ssid.c_str(), passphrase.c_str());
|
||||||
|
} else {
|
||||||
|
ESP_LOGI(MAIN_TAG, "Failed to connect to SSID:%s, password:%s",
|
||||||
|
ssid.c_str(), passphrase.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler));
|
||||||
|
// ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler));
|
||||||
|
vEventGroupDelete(wifi_event_group);
|
||||||
|
|
||||||
|
}
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname, std::string &_ip, std::string &_gw, std::string &_netmask)
|
||||||
{
|
{
|
||||||
string line = "";
|
string line = "";
|
||||||
std::vector<string> zerlegt;
|
std::vector<string> zerlegt;
|
||||||
@@ -174,6 +264,28 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "IP")){
|
||||||
|
_ip = zerlegt[1];
|
||||||
|
if ((_ip[0] == '"') && (_ip[_ip.length()-1] == '"')){
|
||||||
|
_ip = _ip.substr(1, _ip.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "GATEWAY")){
|
||||||
|
_gw = zerlegt[1];
|
||||||
|
if ((_gw[0] == '"') && (_gw[_gw.length()-1] == '"')){
|
||||||
|
_gw = _gw.substr(1, _gw.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "NETMASK")){
|
||||||
|
_netmask = zerlegt[1];
|
||||||
|
if ((_netmask[0] == '"') && (_netmask[_netmask.length()-1] == '"')){
|
||||||
|
_netmask = _netmask.substr(1, _netmask.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fgets(zw, 1024, pFile) == NULL)
|
if (fgets(zw, 1024, pFile) == NULL)
|
||||||
{
|
{
|
||||||
line = "";
|
line = "";
|
||||||
@@ -204,3 +316,12 @@ std::string getIPAddress(){
|
|||||||
std::string getSSID(){
|
std::string getSSID(){
|
||||||
return ssid;
|
return ssid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getNetMask(){
|
||||||
|
return netmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getGW(){
|
||||||
|
return gw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,15 @@
|
|||||||
const int CONNECTED_BIT = BIT0;
|
const int CONNECTED_BIT = BIT0;
|
||||||
|
|
||||||
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);
|
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);
|
||||||
|
void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _netmask, std::string _ssid, std::string _passphrase, std::string _hostname);
|
||||||
|
|
||||||
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);
|
|
||||||
|
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname, std::string &_ip, std::string &_gw, std::string &_netmask);
|
||||||
|
|
||||||
std::string getHostname();
|
std::string getHostname();
|
||||||
std::string getIPAddress();
|
std::string getIPAddress();
|
||||||
std::string getSSID();
|
std::string getSSID();
|
||||||
|
std::string getNetMask();
|
||||||
|
std::string getGW();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -137,6 +137,7 @@ CCamera Camera;
|
|||||||
|
|
||||||
|
|
||||||
#define FLASH_GPIO GPIO_NUM_4
|
#define FLASH_GPIO GPIO_NUM_4
|
||||||
|
#define BLINK_GPIO GPIO_NUM_33
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
httpd_req_t *req;
|
httpd_req_t *req;
|
||||||
@@ -207,6 +208,8 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
|
|||||||
// nm = "/sdcard/josef_zw.bmp";
|
// nm = "/sdcard/josef_zw.bmp";
|
||||||
string ftype;
|
string ftype;
|
||||||
|
|
||||||
|
LEDOnOff(true);
|
||||||
|
|
||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
{
|
{
|
||||||
LightOnOff(true);
|
LightOnOff(true);
|
||||||
@@ -217,8 +220,11 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
|
|||||||
camera_fb_t * fb = esp_camera_fb_get();
|
camera_fb_t * fb = esp_camera_fb_get();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
||||||
|
LEDOnOff(false);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
LEDOnOff(false);
|
||||||
|
|
||||||
printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
|
printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
|
||||||
|
|
||||||
nm = FormatFileName(nm);
|
nm = FormatFileName(nm);
|
||||||
@@ -322,6 +328,20 @@ void CCamera::LightOnOff(bool status)
|
|||||||
gpio_set_level(FLASH_GPIO, 0);
|
gpio_set_level(FLASH_GPIO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCamera::LEDOnOff(bool status)
|
||||||
|
{
|
||||||
|
// Init the GPIO
|
||||||
|
gpio_pad_select_gpio(BLINK_GPIO);
|
||||||
|
/* Set the GPIO as a push/pull output */
|
||||||
|
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
|
if (!status)
|
||||||
|
gpio_set_level(BLINK_GPIO, 1);
|
||||||
|
else
|
||||||
|
gpio_set_level(BLINK_GPIO, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CCamera::GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol)
|
void CCamera::GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol)
|
||||||
{
|
{
|
||||||
char _query[100];
|
char _query[100];
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class CCamera {
|
|||||||
esp_err_t InitCam();
|
esp_err_t InitCam();
|
||||||
|
|
||||||
void LightOnOff(bool status);
|
void LightOnOff(bool status);
|
||||||
|
void LEDOnOff(bool status);
|
||||||
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
||||||
void SetQualitySize(int qual, framesize_t resol);
|
void SetQualitySize(int qual, framesize_t resol);
|
||||||
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
|
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
|
||||||
|
|||||||
@@ -157,6 +157,22 @@ std::string ClassFlowControll::getActStatus(){
|
|||||||
return aktstatus;
|
return aktstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassFlowControll::doFlowMakeImageOnly(string time){
|
||||||
|
bool result = true;
|
||||||
|
std::string zw_time;
|
||||||
|
int repeat = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
{
|
||||||
|
if (FlowControll[i]->name() == "ClassFlowMakeImage") {
|
||||||
|
zw_time = gettimestring("%Y%m%d-%H%M%S");
|
||||||
|
aktstatus = zw_time + ": " + FlowControll[i]->name();
|
||||||
|
string zw = "FlowControll.doFlowMakeImageOnly - " + FlowControll[i]->name();
|
||||||
|
FlowControll[i]->doFlow(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ClassFlowControll::doFlow(string time)
|
bool ClassFlowControll::doFlow(string time)
|
||||||
{
|
{
|
||||||
// CleanTempFolder(); // dazu muss man noch eine Rolling einführen
|
// CleanTempFolder(); // dazu muss man noch eine Rolling einführen
|
||||||
@@ -304,12 +320,6 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
setTimeZone(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(zerlegt[0]) == "SETUPMODE") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "SETUPMODE") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(zerlegt[1]) == "TRUE")
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ protected:
|
|||||||
bool SetupModeActive;
|
bool SetupModeActive;
|
||||||
void SetInitialParameter(void);
|
void SetInitialParameter(void);
|
||||||
std::string aktstatus;
|
std::string aktstatus;
|
||||||
int TimeUpdateIntervall;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void InitFlow(std::string config);
|
void InitFlow(std::string config);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
|
void doFlowMakeImageOnly(string time);
|
||||||
bool getStatusSetupModus(){return SetupModeActive;};
|
bool getStatusSetupModus(){return SetupModeActive;};
|
||||||
string getReadout(bool _rawvalue, bool _noerror);
|
string getReadout(bool _rawvalue, bool _noerror);
|
||||||
string UpdatePrevalue(std::string _newvalue);
|
string UpdatePrevalue(std::string _newvalue);
|
||||||
|
|||||||
@@ -424,7 +424,13 @@ void task_autodoFlow(void *pvParameter)
|
|||||||
doInit();
|
doInit();
|
||||||
|
|
||||||
auto_isrunning = tfliteflow.isAutoStart(auto_intervall);
|
auto_isrunning = tfliteflow.isAutoStart(auto_intervall);
|
||||||
auto_isrunning = auto_isrunning && (!isSetupModusActive());
|
|
||||||
|
if (isSetupModusActive()) {
|
||||||
|
auto_isrunning = false;
|
||||||
|
std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
|
||||||
|
tfliteflow.doFlowMakeImageOnly(zw_time);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
while (auto_isrunning)
|
while (auto_isrunning)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,17 +29,13 @@ RTC_DATA_ATTR int boot_count = 0;
|
|||||||
|
|
||||||
bool setTimeAlwaysOnReboot = true;
|
bool setTimeAlwaysOnReboot = true;
|
||||||
|
|
||||||
/* Variable holding number of times ESP32 restarted since first boot.
|
|
||||||
* It is placed into RTC memory using RTC_DATA_ATTR and
|
|
||||||
* maintains its value when ESP32 wakes from deep sleep.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void obtain_time(void);
|
static void obtain_time(void);
|
||||||
static void initialize_sntp(void);
|
static void initialize_sntp(void);
|
||||||
|
|
||||||
|
|
||||||
void time_sync_notification_cb(struct timeval *tv)
|
void time_sync_notification_cb(struct timeval *tv)
|
||||||
{
|
{
|
||||||
|
// LogFile.WriteToFile("Notification of a time synchronization event");
|
||||||
ESP_LOGI(TAG, "Notification of a time synchronization event");
|
ESP_LOGI(TAG, "Notification of a time synchronization event");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,11 +111,11 @@ static void obtain_time(void)
|
|||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
if (retry == retry_count) {
|
if (retry == retry_count) {
|
||||||
LogFile.WriteToFile("Time Synchzronisation nicht erfolgreich ...");
|
// LogFile.WriteToFile("Time Synchzronisation nicht erfolgreich ...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogFile.WriteToFile("Time erfolgreich ...");
|
// LogFile.WriteToFile("Time erfolgreich ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
@@ -131,35 +127,6 @@ static void initialize_sntp(void)
|
|||||||
ESP_LOGI(TAG, "Initializing SNTP");
|
ESP_LOGI(TAG, "Initializing SNTP");
|
||||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||||
sntp_setservername(0, "pool.ntp.org");
|
sntp_setservername(0, "pool.ntp.org");
|
||||||
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
|
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,7 @@
|
|||||||
// #include "nvs_flash.h"
|
// #include "nvs_flash.h"
|
||||||
#include "esp_sntp.h"
|
#include "esp_sntp.h"
|
||||||
|
|
||||||
|
|
||||||
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);
|
void setTimeZone(std::string _tzstring);
|
||||||
@@ -81,13 +81,30 @@ extern "C" void app_main(void)
|
|||||||
std::string ssid = "";
|
std::string ssid = "";
|
||||||
std::string password = "";
|
std::string password = "";
|
||||||
std::string hostname = "";
|
std::string hostname = "";
|
||||||
|
std::string ip = "";
|
||||||
|
std::string gw = "";
|
||||||
|
std::string netmask = "";
|
||||||
|
|
||||||
|
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname, ip, gw, netmask);
|
||||||
|
|
||||||
|
|
||||||
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
|
|
||||||
// LogFile.WriteToFile("Startsequence 04");
|
// LogFile.WriteToFile("Startsequence 04");
|
||||||
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
|
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
|
||||||
printf("To set Hostename: %s\n", hostname.c_str());
|
printf("To set Hostename: %s\n", hostname.c_str());
|
||||||
|
printf("Fixed IP: %s, Gateway %s, Netmask %s\n", ip.c_str(), gw.c_str(), netmask.c_str());
|
||||||
|
|
||||||
initialise_wifi(ssid, password, hostname);
|
if (ip.length() == 0 || gw.length() == 0 || netmask.length() == 0)
|
||||||
|
{
|
||||||
|
initialise_wifi(ssid, password, hostname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
initialise_wifi_fixed_ip(ip, gw, netmask, ssid, password, hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Netparameter: IP: %s - GW: %s - NetMask %s\n", getIPAddress().c_str(), getGW().c_str(), getNetMask().c_str());
|
||||||
|
|
||||||
|
|
||||||
// LogFile.WriteToFile("Startsequence 05");
|
// LogFile.WriteToFile("Startsequence 05");
|
||||||
|
|
||||||
TickType_t xDelay;
|
TickType_t xDelay;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="9e85b12";
|
const char* GIT_REV="816f932";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-12-04 22:01";
|
const char* BUILD_TIME="2020-12-06 08:08";
|
||||||
@@ -83,11 +83,11 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
|
|||||||
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
|
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
|
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||||
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
||||||
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
||||||
@@ -109,11 +109,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
|||||||
#
|
#
|
||||||
# Partition Table
|
# Partition Table
|
||||||
#
|
#
|
||||||
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
|
||||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||||
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
CONFIG_PARTITION_TABLE_MD5=y
|
CONFIG_PARTITION_TABLE_MD5=y
|
||||||
# end of Partition Table
|
# end of Partition Table
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
|||||||
#
|
#
|
||||||
# Partition Table
|
# Partition Table
|
||||||
#
|
#
|
||||||
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
|
||||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||||
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
CONFIG_PARTITION_TABLE_MD5=y
|
CONFIG_PARTITION_TABLE_MD5=y
|
||||||
# end of Partition Table
|
# end of Partition Table
|
||||||
@@ -537,7 +537,7 @@ CONFIG_FATFS_MAX_LFN=255
|
|||||||
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
|
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
|
||||||
# CONFIG_FATFS_API_ENCODING_UTF_16 is not set
|
# CONFIG_FATFS_API_ENCODING_UTF_16 is not set
|
||||||
# CONFIG_FATFS_API_ENCODING_UTF_8 is not set
|
# CONFIG_FATFS_API_ENCODING_UTF_8 is not set
|
||||||
CONFIG_FATFS_FS_LOCK=2
|
CONFIG_FATFS_FS_LOCK=5
|
||||||
CONFIG_FATFS_TIMEOUT_MS=10000
|
CONFIG_FATFS_TIMEOUT_MS=10000
|
||||||
CONFIG_FATFS_PER_FILE_CACHE=y
|
CONFIG_FATFS_PER_FILE_CACHE=y
|
||||||
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
|
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="9e85b12";
|
const char* GIT_REV="816f932";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-12-04 22:01";
|
const char* BUILD_TIME="2020-12-06 08:07";
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
sd-card/html/cnn_images.jpg
Normal file
BIN
sd-card/html/cnn_images.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -21,17 +21,46 @@ p {font-size: 1em;}
|
|||||||
|
|
||||||
<body style="font-family: arial">
|
<body style="font-family: arial">
|
||||||
|
|
||||||
This is your first start of the digitizer. You need to go through 5 steps, to customize the setting. Just follow the instructions:
|
<h2>Welcome to the Setup of the Digitizer</h2>
|
||||||
<p>
|
|
||||||
<ol>
|
|
||||||
<li>Define a reference image on which the digits, counters and reference points are marked</li>
|
<p>
|
||||||
<li>Define two references, which are used to align the image and identify fixed positions on the image</li>
|
<img src="flow_overview.jpg" alt=""><img src="cnn_images.jpg" alt="">
|
||||||
<li>Mark and define the digits to recognize</li>
|
</p>
|
||||||
<li>Mark and define the analog counters to be recognized</li>
|
|
||||||
<li>Adopt general settings</li>
|
<p>
|
||||||
</ol>
|
This is the first time you the digitizer. You have been automatically routed to the <b>initial setup procedure</b>.
|
||||||
<p>
|
This procedure should adjust the setting to your local counter. Basically you can customize your settings in five steps.
|
||||||
Just use the buttons "Next" and "Previous" to nagivate through the process.
|
<br>
|
||||||
|
In the final step the inital setup will be disabled and it will restart to the normal mode.
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Just use the buttons "Next" and "Previous" to nagivate through the process.
|
||||||
|
<br>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Follow the instructions:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<ol>
|
||||||
|
<li>Create reference image <br>
|
||||||
|
Basis for the position references and the marking of the digits and counters.</li>
|
||||||
|
<li>Define two unique references <br>
|
||||||
|
Used to align the individual camera shot and identify the absolut positions</li>
|
||||||
|
<li>Define the digits <br>
|
||||||
|
Digital digits to be recognized</li>
|
||||||
|
<li>Define the analog counters <br>
|
||||||
|
Analog counters to be identified</li>
|
||||||
|
<li>General settings <br>
|
||||||
|
Most can stay to the default value - also MQTT connection can be specified here</li>
|
||||||
|
</ol>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
After step 5 you switch of the setup mode, reboot and start in normal mode!
|
||||||
|
|
||||||
|
<h4>Have fun with the digitizer!</h4>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -39,7 +39,7 @@ table {
|
|||||||
<tr>
|
<tr>
|
||||||
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
|
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
|
||||||
<td><input class="button" type="button" value="Create New Reference" onclick="loadRawImage()"></td>
|
<td><input class="button" type="button" value="Create New Reference" onclick="loadRawImage()"></td>
|
||||||
<td><input class="button" type="submit" id="take" onclick="doTake()" value="New Raw Image (raw.jpg)"></td>
|
<td><input class="button" type="submit" id="take" onclick="doTake()" value="Take Image"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
|
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
|
||||||
|
|||||||
BIN
sd-card/html/flow_overview.jpg
Normal file
BIN
sd-card/html/flow_overview.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Reference in New Issue
Block a user