diff --git a/FeatureRequest.md b/FeatureRequest.md index d9157b90..e2e97fd1 100644 --- a/FeatureRequest.md +++ b/FeatureRequest.md @@ -11,6 +11,14 @@ ____ + + +#### #25 Trigger Measurement via MQTT + +* https://github.com/jomjol/AI-on-the-edge-device/issues/727 + + + #### #24 Show Mqtt state directly in Webserver * Show MQTT log in Web page. E.g. connection established or failed to connect... @@ -48,9 +56,9 @@ ____ -#### #18 Document WLAN-strength in web page +#### ~~#18 Document WLAN-strength in web page~~ -* https://github.com/jomjol/AI-on-the-edge-device/issues/563 +* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/563~~ @@ -101,9 +109,9 @@ ____ -#### #12 Less reboots due to memory leakage +#### ~~#12 Less reboots due to memory leakage~~ -* Issue: #414 & #425 #430 +* ~~Issue: #414 & #425 #430~~ diff --git a/README.md b/README.md index c69d2615..61df24d7 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ This is an example of Artificial Intelligence (AI) calculations on a very cheap ### Details on **function**, **installation** and **configuration** can be found on the **[Wiki Page](https://github.com/jomjol/AI-on-the-edge-device/wiki)** -A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4573481 - -or here https://www.thingiverse.com/thing:5028229 - -respectively ESP32-Cam housing only: https://www.thingiverse.com/thing:4571627 +A 3d-printable housing can be found here: + - https://www.thingiverse.com/thing:4573481 (Water Meter) + - https://www.thingiverse.com/thing:5028229 (Power Meter) + - https://www.thingiverse.com/thing:4571627 (ESP32-Cam housing only) @@ -45,20 +44,28 @@ In other cases you can contact the developer via email: no return value in the field "value" anymore - (still reported back via field "raw value") +- Some readings will have removable "N"s that can not be removed automatically and are handled with an "error" --> no return value in the field "value" anymore (still reported back via field "raw value") - Updated esp32 camera hardware driver -- Bug fix: MQTT, html improvements +- Bug fix: MQTT, HTML improvements -**ATTENTION: The new ESP32 camera hardware driver is much more stable on newer OV2640 versions (no or much less reboots) but seems to be not fully compatible with older versions.** +**ATTENTION: The new ESP32 camera hardware driver is much more stable on newer OV2640 versions (no or much less reboots) but seems to be not fully compatible with older versions.** * If you have problem with stalled systems you can try the following - Update the parameter `ImageQuality` to `12` instead of current value `5` (manually in the `config.ini`) @@ -95,8 +101,7 @@ In other cases you can contact the developer via email: * New housing published for external LEDs and small clearing: https://www.thingiverse.com/thing:5028229 @@ -177,9 +182,9 @@ In other cases you can contact the developer via email: uri = zerlegt[1]; } + if ((toUpper(zerlegt[0]) == "SETRETAINFLAG") && (zerlegt.size() > 1)) + { + if (toUpper(zerlegt[1]) == "TRUE") + SetRetainFlag = 1; + } + if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1)) { @@ -118,7 +125,7 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph) mainerrortopic = maintopic + "/connection"; printf("Init MQTT with uri: %s, clientname: %s, user: %s, password: %s, maintopic: %s\n", uri.c_str(), clientname.c_str(), user.c_str(), password.c_str(), mainerrortopic.c_str()); MQTTInit(uri, clientname, user, password, mainerrortopic, 60); - MQTTPublish(mainerrortopic, "connected"); + MQTTPublish(mainerrortopic, "connected", SetRetainFlag); MQTTenable = true; } @@ -150,17 +157,17 @@ bool ClassFlowMQTT::doFlow(string zwtime) zw = maintopic + "/" + "uptime"; char uptimeStr[11]; sprintf(uptimeStr, "%ld", (long)getUpTime()); - MQTTPublish(zw, uptimeStr); + MQTTPublish(zw, uptimeStr, SetRetainFlag); zw = maintopic + "/" + "freeMem"; char freeheapmem[11]; sprintf(freeheapmem, "%zu", esp_get_free_heap_size()); - MQTTPublish(zw, freeheapmem); + MQTTPublish(zw, freeheapmem, SetRetainFlag); zw = maintopic + "/" + "wifiRSSI"; char rssi[11]; sprintf(rssi, "%d", get_WIFI_RSSI()); - MQTTPublish(zw, rssi); + MQTTPublish(zw, rssi, SetRetainFlag); if (flowpostprocessing) @@ -183,23 +190,23 @@ bool ClassFlowMQTT::doFlow(string zwtime) zw = namenumber + "value"; if (result.length() > 0) - MQTTPublish(zw, result); + MQTTPublish(zw, result, SetRetainFlag); zw = namenumber + "error"; if (resulterror.length() > 0) - MQTTPublish(zw, resulterror, 1); + MQTTPublish(zw, resulterror, SetRetainFlag); zw = namenumber + "rate"; if (resultrate.length() > 0) - MQTTPublish(zw, resultrate); + MQTTPublish(zw, resultrate, SetRetainFlag); zw = namenumber + "raw"; if (resultraw.length() > 0) - MQTTPublish(zw, resultraw); + MQTTPublish(zw, resultraw, SetRetainFlag); zw = namenumber + "timestamp"; if (resulttimestamp.length() > 0) - MQTTPublish(zw, resulttimestamp); + MQTTPublish(zw, resulttimestamp, SetRetainFlag); std::string json = ""; @@ -218,7 +225,7 @@ bool ClassFlowMQTT::doFlow(string zwtime) json += ",\"timestamp\":\""+resulttimestamp+"\"}"; zw = namenumber + "json"; - MQTTPublish(zw, json); + MQTTPublish(zw, json, SetRetainFlag); } } else @@ -234,7 +241,7 @@ bool ClassFlowMQTT::doFlow(string zwtime) result = result + "\t" + zw; } } - MQTTPublish(topic, result); + MQTTPublish(topic, result, SetRetainFlag); } OldValue = result; diff --git a/code/components/jomjol_flowcontroll/ClassFlowMQTT.h b/code/components/jomjol_flowcontroll/ClassFlowMQTT.h index 19cc9fdf..816389b1 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMQTT.h +++ b/code/components/jomjol_flowcontroll/ClassFlowMQTT.h @@ -13,6 +13,7 @@ protected: std::string OldValue; ClassFlowPostProcessing* flowpostprocessing; std::string user, password; + int SetRetainFlag; bool MQTTenable; std::string maintopic, mainerrortopic; diff --git a/code/components/jomjol_mqtt/interface_mqtt.h b/code/components/jomjol_mqtt/interface_mqtt.h index 50990e6f..397d1787 100644 --- a/code/components/jomjol_mqtt/interface_mqtt.h +++ b/code/components/jomjol_mqtt/interface_mqtt.h @@ -10,7 +10,7 @@ void MQTTdestroy(); //void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = ""); -void MQTTPublish(std::string _key, std::string _content, int retained_flag = 0); +void MQTTPublish(std::string _key, std::string _content, int retained_flag = 1); // retained Flag as Standart bool MQTTisConnected(); diff --git a/code/components/jomjol_wlan/connect_wlan.cpp b/code/components/jomjol_wlan/connect_wlan.cpp index ebcdf4be..3b2c1a1a 100644 --- a/code/components/jomjol_wlan/connect_wlan.cpp +++ b/code/components/jomjol_wlan/connect_wlan.cpp @@ -151,8 +151,24 @@ void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostna if ((_ipadr != NULL) && (_gw != NULL) && (_netmask != NULL)) { + /* + tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA); + tcpip_adapter_ip_info_t ip_info; + int a, b, c, d; + strinttoip4(_ipadr, 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); + + tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info); + */ + + ESP_LOGI(TAG, "set IP %s, GW %s, Netmask %s manual", _ipadr, _gw, _netmask); esp_netif_dhcpc_stop(my_sta); + esp_netif_ip_info_t ip_info; int a, b, c, d; strinttoip4(_ipadr, a, b, c, d); @@ -168,6 +184,22 @@ void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostna wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); + if ((_ipadr != NULL) && (_gw != NULL) && (_netmask != NULL)) + { + if (_dns == NULL) + _dns = _gw; + + ESP_LOGI(TAG, "set DNS manual"); + esp_netif_dns_info_t dns_info; + ip4_addr_t ip; + ip.addr = esp_ip4addr_aton(_dns); + 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_event_handler_instance_t instance_any_id; esp_event_handler_instance_t instance_got_ip; ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, diff --git a/code/main/version.cpp b/code/main/version.cpp index 34a3aeed..76ac8a6f 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="7187101"; +const char* GIT_REV="0e90bcb"; const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2022-02-22 19:05"; \ No newline at end of file +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2022-03-22 20:46"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index 34a3aeed..76ac8a6f 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="7187101"; +const char* GIT_REV="0e90bcb"; const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2022-02-22 19:05"; \ No newline at end of file +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2022-03-22 20:46"; \ No newline at end of file diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index ae05db13..f820697c 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/dig-s1-q-20220227.tflite b/firmware/dig-s1-q-20220227.tflite new file mode 100644 index 00000000..3ced1fcc Binary files /dev/null and b/firmware/dig-s1-q-20220227.tflite differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 6314d0e3..878205eb 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ diff --git a/firmware/html.zip b/firmware/html.zip index ec069237..a7abb32e 100644 Binary files a/firmware/html.zip and b/firmware/html.zip differ diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html index 587bbb3c..bfadb0da 100644 --- a/sd-card/html/edit_config_param.html +++ b/sd-card/html/edit_config_param.html @@ -636,7 +636,24 @@ textarea { Password for MQTT authentication - + + + + + + Enable MQTT Retain Flag + + + + + + Enable or disable the retain flag for all MQTT entries + + +

InfluxDB

@@ -711,7 +728,6 @@ textarea { -

AutoTimer

@@ -1867,6 +1883,7 @@ function UpdateInput() { WriteParameter(param, category, "MQTT", "ClientID", true); WriteParameter(param, category, "MQTT", "user", true); WriteParameter(param, category, "MQTT", "password", true); + WriteParameter(param, category, "MQTT", "SetRetainFlag", true); WriteParameter(param, category, "InfluxDB", "Uri", true); WriteParameter(param, category, "InfluxDB", "Database", true); @@ -1967,6 +1984,7 @@ function ReadParameterAll() ReadParameter(param, "MQTT", "ClientID", true); ReadParameter(param, "MQTT", "user", true); ReadParameter(param, "MQTT", "password", true); + ReadParameter(param, "MQTT", "SetRetainFlag", true); ReadParameter(param, "InfluxDB", "Uri", true); ReadParameter(param, "InfluxDB", "Measurement", true); diff --git a/sd-card/html/gethost.js b/sd-card/html/gethost.js index 8a9df763..751e4b11 100644 --- a/sd-card/html/gethost.js +++ b/sd-card/html/gethost.js @@ -13,7 +13,7 @@ function getbasepath(){ { // host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.178.46"; // jomjol interner test - host = "http://192.168.178.34"; // jomjol interner Real + host = "http://192.168.178.62"; // jomjol interner Real // host = "http://192.168.43.191"; // host = "."; // jomjol interner localhost diff --git a/sd-card/html/readconfigparam.js b/sd-card/html/readconfigparam.js index 09d9bff4..d3b17741 100644 --- a/sd-card/html/readconfigparam.js +++ b/sd-card/html/readconfigparam.js @@ -124,6 +124,7 @@ function ParseConfig() { ParamAddValue(param, catname, "ClientID"); ParamAddValue(param, catname, "user"); ParamAddValue(param, catname, "password"); + ParamAddValue(param, catname, "SetRetainFlag"); var catname = "InfluxDB"; category[catname] = new Object(); diff --git a/sd-card/html/testcnn.html b/sd-card/html/testcnn.html new file mode 100644 index 00000000..ab2b44c2 --- /dev/null +++ b/sd-card/html/testcnn.html @@ -0,0 +1 @@ +

Not-a-Number

\ No newline at end of file