Compare commits

...

10 Commits

Author SHA1 Message Date
jomjol
d4342a77c8 Update README.md 2020-12-31 11:57:48 +01:00
jomjol
054d2296c4 Update README.md 2020-12-31 11:54:52 +01:00
jomjol
3a66385059 Update README.md 2020-12-23 22:06:48 +01:00
jomjol
11fed9394a Update 2020-12-06 19:34:52 +01:00
jomjol
bcdd0c66c0 Merge pull request #70 from jomjol/rolling
Update to v5.0.0
2020-12-06 19:31:04 +01:00
jomjol
e988215d8a Prepare for v5.0.0 2020-12-06 19:28:17 +01:00
jomjol
f616643335 Rolling 2020-06-12 2020-12-06 08:24:32 +01:00
jomjol
816f93222b Rolling 20201204 2020-12-04 22:09:20 +01:00
jomjol
9e85b1240a Rolling - 202-12-03 2020-12-03 20:38:28 +01:00
jomjol
c5059b4568 Merge pull request #69 from jomjol/master
Sync rolling master to v4.1.1
2020-12-02 21:58:42 +01:00
49 changed files with 857 additions and 77 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
.code-workspace
.helper/
/sd-card/htm./.vscode/
/code/build
CMakeLists.txt.user
CMakeCache.txt

View File

@@ -12,6 +12,16 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
## Donate
If you would like to support the developer with a cup of coffee you can do that via [[Paypal]](https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL).
<form action="https://www.paypal.com/donate" method="post" target="_top">
<input type="hidden" name="hosted_button_id" value="8TRSVYNYKDSWL" />
<input type="image" src="https://www.paypalobjects.com/en_US/DK/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_DE/i/scr/pixel.gif" width="1" height="1" />
</form>
## Change log
@@ -25,6 +35,13 @@ 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!
##### 5.0.0 Setup Modus - (2020-12-06)
* Implementation of intial setup modus for fresh installation
* Code restructuring (full compatibility between pure ESP-IDF and Platformio w/ espressif)
##### 4.1.1 Configuration editor - (2020-12-02)
* Bug fixing: internal improvement of file handling (reduce not responding)
@@ -155,4 +172,4 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
## Solved topics
* n.a.
* n.a.

View File

@@ -11,6 +11,10 @@
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <arpa/inet.h>
#include "Helper.h"
@@ -23,6 +27,9 @@ std::string ssid;
std::string passphrase;
std::string hostname;
std::string ipaddress;
std::string gw;
std::string netmask;
std::string dns;
std::string std_hostname = "watermeter";
@@ -86,7 +93,7 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
{
switch(event->event_id) {
case SYSTEM_EVENT_STA_START:
blinkstatus(200, 5);
blinkstatus(200, 1);
wifi_connect();
break;
case SYSTEM_EVENT_STA_GOT_IP:
@@ -125,10 +132,97 @@ void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _ho
tcpip_adapter_ip_info_t ip_info;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
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("HostName : %s\n", hostname.c_str());
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
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, std::string _dns)
{
ssid = _ssid;
passphrase = _passphrase;
hostname = _hostname;
dns = _dns;
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));
if (dns.length() > 0) {
esp_netif_dns_info_t dns_info;
ip4_addr_t ip;
ip.addr = esp_ip4addr_aton(dns.c_str());
ip_addr_set_ip4_u32(&dns_info.ip, ip.addr);
ESP_ERROR_CHECK(esp_netif_set_dns_info(my_sta, ESP_NETIF_DNS_MAIN, &dns_info));
}
ESP_ERROR_CHECK(esp_event_loop_init(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);
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());
}
tcpip_adapter_ip_info_t ip_info2;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info2));
ipaddress = std::string(ip4addr_ntoa(&ip_info2.ip));
netmask = std::string(ip4addr_ntoa(&ip_info2.netmask));
gw = std::string(ip4addr_ntoa(&ip_info2.gw));
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, std::string &_dns)
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
{
@@ -140,6 +234,8 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
fn = FormatFileName(fn);
pFile = fopen(fn.c_str(), "r");
printf("file loaded\n");
if (pFile == NULL)
return;
@@ -149,7 +245,7 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
while ((line.size() > 0) || !(feof(pFile)))
{
// printf("%s", line.c_str());
printf("%s", line.c_str());
zerlegt = ZerlegeZeile(line, "=");
zerlegt[0] = trim(zerlegt[0], " ");
@@ -174,6 +270,37 @@ 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 ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "DNS")){
_dns = zerlegt[1];
if ((_dns[0] == '"') && (_dns[_dns.length()-1] == '"')){
_dns = _dns.substr(1, _dns.length()-2);
}
}
*/
if (fgets(zw, 1024, pFile) == NULL)
{
line = "";
@@ -204,3 +331,12 @@ std::string getIPAddress(){
std::string getSSID(){
return ssid;
}
std::string getNetMask(){
return netmask;
}
std::string getGW(){
return gw;
}

View File

@@ -7,11 +7,16 @@
const int CONNECTED_BIT = BIT0;
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, std::string _dns = "");
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);
void LoadNetConfigFromFile(std::string &_ip, std::string &_gw, std::string &_netmask, std::string &_dns);
std::string getHostname();
std::string getIPAddress();
std::string getSSID();
std::string getNetMask();
std::string getGW();
#endif

View File

@@ -137,6 +137,7 @@ CCamera Camera;
#define FLASH_GPIO GPIO_NUM_4
#define BLINK_GPIO GPIO_NUM_33
typedef struct {
httpd_req_t *req;
@@ -207,6 +208,8 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
// nm = "/sdcard/josef_zw.bmp";
string ftype;
LEDOnOff(true);
if (delay > 0)
{
LightOnOff(true);
@@ -217,8 +220,11 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
camera_fb_t * fb = esp_camera_fb_get();
if (!fb) {
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
LEDOnOff(false);
return ESP_FAIL;
}
LEDOnOff(false);
printf("w %d, h %d, size %d\n", fb->width, fb->height, fb->len);
nm = FormatFileName(nm);
@@ -322,6 +328,20 @@ void CCamera::LightOnOff(bool status)
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)
{
char _query[100];

View File

@@ -28,6 +28,7 @@ class CCamera {
esp_err_t InitCam();
void LightOnOff(bool status);
void LEDOnOff(bool status);
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
void SetQualitySize(int qual, framesize_t resol);
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);

View File

@@ -66,6 +66,7 @@ std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
void ClassFlowControll::SetInitialParameter(void)
{
AutoStart = false;
SetupModeActive = false;
AutoIntervall = 10;
}
@@ -156,6 +157,22 @@ std::string ClassFlowControll::getActStatus(){
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)
{
// CleanTempFolder(); // dazu muss man noch eine Rolling einführen
@@ -303,12 +320,16 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
setTimeZone(zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "TIMEUPDATEINTERVALL") && (zerlegt.size() > 1))
if ((toUpper(zerlegt[0]) == "SETUPMODE") && (zerlegt.size() > 1))
{
TimeUpdateIntervall = stof(zerlegt[1]);
xTaskCreate(&task_doTimeSync, "update_time", configMINIMAL_STACK_SIZE * 16, &TimeUpdateIntervall, tskIDLE_PRIORITY, NULL);
if (toUpper(zerlegt[1]) == "TRUE")
{
SetupModeActive = true;
}
}
}
return true;
}

View File

@@ -21,14 +21,15 @@ protected:
bool AutoStart;
float AutoIntervall;
bool SetupModeActive;
void SetInitialParameter(void);
std::string aktstatus;
int TimeUpdateIntervall;
public:
void InitFlow(std::string config);
bool doFlow(string time);
void doFlowMakeImageOnly(string time);
bool getStatusSetupModus(){return SetupModeActive;};
string getReadout(bool _rawvalue, bool _noerror);
string UpdatePrevalue(std::string _newvalue);
string GetPrevalue();

View File

@@ -313,7 +313,6 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
if (!PreValueUse || !PreValueOkay)
{
ReturnValue = ReturnRawValue;
@@ -391,6 +390,9 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
std::stringstream stream;
if (_anzNachkomma < 0) {
_anzNachkomma = 0;
}
stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
return stream.str();
}

View File

@@ -29,6 +29,12 @@ bool flowisrunning = false;
long auto_intervall = 0;
bool auto_isrunning = false;
bool isSetupModusActive() {
return tfliteflow.getStatusSetupModus();
return false;
}
void KillTFliteTasks()
{
printf("Handle: xHandleblink_task_doFlow: %ld\n", (long) xHandleblink_task_doFlow);
@@ -419,6 +425,13 @@ void task_autodoFlow(void *pvParameter)
auto_isrunning = tfliteflow.isAutoStart(auto_intervall);
if (isSetupModusActive()) {
auto_isrunning = false;
std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
tfliteflow.doFlowMakeImageOnly(zw_time);
}
while (auto_isrunning)
{
LogFile.WriteToFile("task_autodoFlow - next round");

View File

@@ -10,4 +10,6 @@ void register_server_tflite_uri(httpd_handle_t server);
void KillTFliteTasks();
void TFliteDoAutoStart();
void TFliteDoAutoStart();
bool isSetupModusActive();

View File

@@ -29,17 +29,13 @@ RTC_DATA_ATTR int boot_count = 0;
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 initialize_sntp(void);
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");
}
@@ -115,11 +111,11 @@ static void obtain_time(void)
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
if (retry == retry_count) {
LogFile.WriteToFile("Time Synchzronisation nicht erfolgreich ...");
// LogFile.WriteToFile("Time Synchzronisation nicht erfolgreich ...");
}
else
{
LogFile.WriteToFile("Time erfolgreich ...");
// LogFile.WriteToFile("Time erfolgreich ...");
}
time(&now);
@@ -131,35 +127,6 @@ static void initialize_sntp(void)
ESP_LOGI(TAG, "Initializing SNTP");
sntp_setoperatingmode(SNTP_OPMODE_POLL);
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();
}
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
}

View File

@@ -12,11 +12,7 @@
// #include "nvs_flash.h"
#include "esp_sntp.h"
extern int boot_count;
void setup_time(void);
std::string gettimestring(const char * frm);
void task_doTimeSync(void *pvParameter);
void setTimeZone(std::string _tzstring);

View File

@@ -53,7 +53,7 @@ endif()
#######################################################################
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/main/*.*)
# idf_component_register(SRCS ${app_sources})

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -81,13 +81,31 @@ extern "C" void app_main(void)
std::string ssid = "";
std::string password = "";
std::string hostname = "";
std::string ip = "";
std::string gw = "";
std::string netmask = "";
std::string dns = "";
// LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname, ip, gw, netmask, dns);
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
// LogFile.WriteToFile("Startsequence 04");
printf("To use WLan: %s, %s\n", ssid.c_str(), password.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, dns);
}
printf("Netparameter: IP: %s - GW: %s - NetMask %s\n", getIPAddress().c_str(), getGW().c_str(), getNetMask().c_str());
// LogFile.WriteToFile("Startsequence 05");
TickType_t xDelay;

View File

@@ -13,6 +13,8 @@
#include "esp_wifi.h"
#include "server_tflite.h"
httpd_handle_t server = NULL;
@@ -152,7 +154,9 @@ esp_err_t hello_main_handler(httpd_req_t *req)
if ((strcmp(req->uri, "/") == 0))
{
filetosend = filetosend + "/html/index.html";
{
filetosend = filetosend + "/html/index.html";
}
}
else
{
@@ -163,6 +167,11 @@ esp_err_t hello_main_handler(httpd_req_t *req)
}
}
if (filetosend == "/sdcard/html/index.html" && isSetupModusActive()) {
printf("System ist im Setupmodus --> index.html --> setup.html");
filetosend = "/sdcard/html/setup.html";
}
printf("Filename: %s\n", filename);
printf("File requested: %s\n", filetosend.c_str());

4
code/main/version.cpp Normal file
View File

@@ -0,0 +1,4 @@
const char* GIT_REV="bcdd0c6";
const char* GIT_TAG="";
const char* GIT_BRANCH="master";
const char* BUILD_TIME="2020-12-06 19:32";

View File

@@ -13,7 +13,7 @@ extern "C"
#include "Helper.h"
#include <fstream>
const char* GIT_BASE_BRANCH = "master - v4.1.0 - 2020-11-30";
const char* GIT_BASE_BRANCH = "master - v5.0.0 - 2020-12-06";
const char* git_base_branch(void)

View File

@@ -9,6 +9,8 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = main
[env:esp32cam]
@@ -17,12 +19,14 @@ board = esp32cam
framework = espidf
board_build.embed_files =
src/favicon.ico
main/favicon.ico
;board_build.partitions = partitions_singleapp.csv
board_build.partitions = partitions.csv
lib_deps =
jomjol_helper
connect_wlan

View File

@@ -83,11 +83,11 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB 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_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
@@ -109,11 +109,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
#
# 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_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
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_MD5=y
# end of Partition Table

View File

@@ -109,11 +109,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
#
# 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_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
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_MD5=y
# end of Partition Table
@@ -537,7 +537,7 @@ CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
# CONFIG_FATFS_API_ENCODING_UTF_16 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_PER_FILE_CACHE=y
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y

View File

@@ -1,4 +0,0 @@
const char* GIT_REV="ffc15aa";
const char* GIT_TAG="";
const char* GIT_BRANCH="master";
const char* BUILD_TIME="2020-12-02 21:56";

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="ffc15aa";
const char* GIT_REV="bcdd0c6";
const char* GIT_TAG="";
const char* GIT_BRANCH="master";
const char* BUILD_TIME="2020-12-02 21:55";
const char* BUILD_TIME="2020-12-06 19:32";

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -59,5 +59,6 @@ LogfileRetentionInDays = 3
[System]
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
SetupMode = true
[Ende]

BIN
sd-card/html/cnn_images.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

1
sd-card/html/debug.log Normal file
View File

@@ -0,0 +1 @@
[1204/185120.033:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h2>Welcome to the Setup of the Digitizer</h2>
<p>
<img src="flow_overview.jpg" alt=""><img src="cnn_images.jpg" alt="">
</p>
<p>
This is the first time you the digitizer. You have been automatically routed to the <b>initial setup procedure</b>.
This procedure should adjust the setting to your local counter. Basically you can customize your settings in five steps.
<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>
</html>

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
.button {
padding: 5px 20px;
width: 211px;
font-size: 16px;
}
</style>
</head>
<body style="font-family: arial">
<h4>Finished!</h4>
<p>
Now you are finished with the setup and ready to reboot to the normal mode.
<br>
Once you have pushed below button, the setup modus will be left and the digitizer start to normal operation mode.
<br>
After a view seconds you can reload this page again and will go to normal operation mode.
<br>
All settings can be changed later on as well in the configuration menue.
</p>
<p>
<button class="button" onclick="reboot()">Leave Setup Modus and Reboot to Normal</button>
</p>
<script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfigparam.js"></script>
<script type="text/javascript">
var canvas = document.getElementById('canvas'),
basepath = "http://192.168.178.22";
aktstatu = 0;
function reboot() {
if (confirm("Do you want to leave the configuration mode and restart the ESP32?\n\nPlease reload the page in about 30s.")) {
basepath = getbasepath();
if (!loadConfig(basepath)) {
alert("Setup Modus could not be deactivated!\Please retry.");
return;
}
ParseConfig();
param = getConfigParameters();
param["System"]["SetupMode"]["enabled"] = false;
param["System"]["SetupMode"]["value1"] = "false";
setConfigParameters(param);
var textToSave = setConfigParameters(param);
FileDeleteOnServer("/config/config.ini", basepath);
FileSendContent(textToSave, "/config/config.ini", basepath);
var stringota = "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
</script>
</body>
</html>

View File

@@ -39,7 +39,7 @@ table {
<tr>
<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="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>
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Introduction</h4>
<p>
Read below!
</body>
</html>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Reference Image</h4>
The reference image is needed to define the digits, counters and references for alignment.
<p>
The last taken raw image from the camera is taken. Use the Button "Create New Reference" to make your own reference.<br>
Most important feature is a straight alignment of the image. Use the Pre roate Angle and the fine alignment to fine tune the rotation of the image<br>
Finish the step by pushing <b>"Update Reference Image"</b>.
</p>
</body>
</html>

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Alignment References</h4>
Two opposite alignment references are needed to identify unique fix points on the image.
<p>
Mark the reference by drag and dop with the mouse or with the coordinates and push <b>"Update Reference"</b>.
<br>
You can switch between the two reference with <b>"Select Reference"</b>.
</p>
<p>
Don't forget to save your changes with <b>"Save to Config.ini"</b>!.
</p>
</body>
</html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Define Digits</h4>
Here you define your digits you want to read.
<p>
With the drop down menue <b>"ROI x"</b> you can change between the different digits. Mark them with the mouse or the coordinates.
<br>
To create new ROIs use <b>"New ROIs"</b>. The order of the ROIs defines the positon within the reading. <br>
You can change it with <b>"move Next" / "move Previous"</b>.
</p>
<p>
Don't forget to save your changes with <b>"Save all to Config.ini"</b>!.
</p>
</body>
</html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Define Digits</h4>
Here you define your analog counters you want to read. If you do not have analog counters delete all ROIs.
<p>
With the drop down menue <b>"ROI x"</b> you can change between the different counters. Mark them with the mouse or the coordinates.
<br>
To create new ROIs use <b>"New ROIs"</b>. The order of the ROIs defines the positon within the reading. <br>
You can change it with <b>"move Next" / "move Previous"</b>.
</p>
<p>
Don't forget to save your changes with <b>"Save all to Config.ini"</b>!.
</p>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>General configuration parameters</h4>
Here you define additional setting. The settings should fit for a normal setup. </p>
<p>
Only if you want to connect to a MQTT-broker you need to adjust the corresponding parameters.
</p>
<p>
Don't forget to save your changes with <b>"Update Config.ini"</b>!.
<br>You should not reboot here, but leave the setup modus on the next page.
</p>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
</style>
</head>
<body style="font-family: arial">
<h4>Finished!</h4>
Read below!
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -7,8 +7,8 @@ function getbasepath(){
var host = window.location.hostname;
if ((host == "127.0.0.1") || (host == "localhost"))
{
// host = "http://192.168.178.26"; // jomjol interner test
host = "http://192.168.178.22"; // jomjol interner Real
host = "http://192.168.178.26"; // jomjol interner test
// host = "http://192.168.178.22"; // jomjol interner Real
// host = "."; // jomjol interner localhost
}
else

View File

@@ -97,6 +97,7 @@ li.dropdown {
</div>
</ul>
<p>
<div class="h_iframe">
<iframe name="maincontent" id ="maincontent" src="/wasserzaehler_roi.html" title="fileserver" allowfullscreen></iframe>
</div>

View File

@@ -73,7 +73,8 @@ function ParseConfig() {
param[catname] = new Object();
ParamAddValue(param, catname, "TimeZone");
ParamAddValue(param, catname, "AutoAdjustSummertime");
ParamAddValue(param, catname, "TimeUpdateIntervall");
ParamAddValue(param, catname, "TimeUpdateIntervall");
ParamAddValue(param, catname, "SetupMode");
while (aktline < config_split.length){
if (config_split[aktline].trim().toUpperCase() == "[MAKEIMAGE]") {
@@ -150,6 +151,7 @@ function ParseConfigParamSystem(_aktline){
ParamExtractValue(param, linesplit, catname, "TimeZone", _aktline, isCom);
ParamExtractValue(param, linesplit, catname, "AutoAdjustSummertime", _aktline, isCom);
ParamExtractValue(param, linesplit, catname, "TimeUpdateIntervall", _aktline, isCom);
ParamExtractValue(param, linesplit, catname, "SetupMode", _aktline, isCom);
++_aktline;
}

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<style>
div {
text-align:center;
width:995px;
height: 600px;
}
.iframe_work {
display:inline-block;
margin: 0px auto;
width:70%;
height: 100%;
}
.iframe_info {
display:inline-block;
margin: 0px auto;
width:20%;
height: 100%;
}
</style>
</head>
<body style="font-family: arial">
<div>
<iframe class="iframe_work" name="iframe_work" id="iframe_work" src="/wasserzaehler_roi.html" allowfullscreen></iframe>
<iframe class="iframe_info" name="iframe_info" id="iframe_info" src="/wasserzaehler_roi.html" allowfullscreen></iframe>
</div>
</body>
</html>

141
sd-card/html/setup.html Normal file
View File

@@ -0,0 +1,141 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:760px;}
.h_iframe {width:995px;height:605px;}
.h_iframe_explain iframe {width:995px;height:200px;}
.h_iframe_explain {width:995px;height:200px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
.button {
padding: 5px 20px;
width: 211px;
font-size: 16px;
}
</style>
</head>
<body style="font-family: arial">
<h1>Digitizer - Initial Setup</h1>
<table>
<tr>
<td>
<button class="button" id="previous" name="previous" onclick="clickPrevious()">Previous</button>
<button class="button" id="next" name="next" onclick="clickNext()">Next</button>
</td>
</tr>
</table>
<div class="h_iframe_explain" id="h_iframe_explain">
<iframe name="explaincontent" id ="explaincontent" src="" allowfullscreen></iframe>
</div>
<div class="h_iframe">
<iframe name="maincontent" id ="maincontent" src="" allowfullscreen></iframe>
</div>
<script type="text/javascript">
var canvas = document.getElementById('canvas'),
basepath = "http://192.168.178.22";
aktstatu = 0;
function clickNext() {
aktstatu++;
if (aktstatu > 6) {
aktstatu = 6;
}
LoadStep();
}
function clickPrevious() {
aktstatu--;
if (aktstatu < 0) {
aktstatu = 0;
}
LoadStep();
}
function LoadStep(){
switch (aktstatu) {
case 0:
document.getElementById('maincontent').src = '/edit_explain_0.html';
document.getElementById('h_iframe_explain').style.display = "none";
document.getElementById("previous").disabled = true;
document.getElementById("next").disabled = false;
break;
case 1:
document.getElementById('maincontent').src = '/edit_reference.html';
document.getElementById('explaincontent').src = '/explain_1.html';
document.getElementById('h_iframe_explain').style.display = "";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = false;
break;
case 2:
document.getElementById('maincontent').src = '/edit_alignment.html';
document.getElementById('explaincontent').src = '/explain_2.html';
document.getElementById('h_iframe_explain').style.display = "";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = false;
break;
case 3:
document.getElementById('maincontent').src = '/edit_digits.html';
document.getElementById('explaincontent').src = '/explain_3.html';
document.getElementById('h_iframe_explain').style.display = "";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = false;
break;
case 4:
document.getElementById('maincontent').src = '/edit_analog.html';
document.getElementById('explaincontent').src = '/explain_4.html';
document.getElementById('h_iframe_explain').style.display = "";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = false;
break;
case 5:
document.getElementById('maincontent').src = '/edit_config_param.html';
document.getElementById('explaincontent').src = '/explain_5.html';
document.getElementById('h_iframe_explain').style.display = "";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = false;
break;
case 6:
document.getElementById('maincontent').src = '/edit_explain_6.html';
document.getElementById('explaincontent').src = '/explain_6.html';
document.getElementById('h_iframe_explain').style.display = "none";
document.getElementById("previous").disabled = false;
document.getElementById("next").disabled = true;
break;
}
}
LoadStep();
</script>
</body>
</html>

View File

@@ -1 +1 @@
2.1.0
3.0.0