Просмотр исходного кода

Merge pull request #35 from jomjol/rolling

Rolling
jomjol 5 лет назад
Родитель
Сommit
26144815d2

+ 15 - 1
README.md

@@ -27,7 +27,21 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
 
 
 
-##### Rolling - (2020-09-28)
+##### Rolling - (2020-10-13)
+
+* Implementation of user and password for MQTT Authentication (see `config.ini`)
+
+2020-10-04
+
+* First simple MQTT Client - to be configured in `config.ini` (see example)
+
+
+
+2020-09-29
+
+* Implementation of HTML-Version (thanks to phlupp)
+
+* ESP32 Temperature is now written correctly to log file
 
 * based on v2.2.1 (2020-09-28)
 

BIN
code/.DS_Store


+ 16 - 2
code/lib/jomjol_flowcontroll/ClassFlowAnalog.cpp

@@ -12,6 +12,8 @@
 
 #include "ClassLogFile.h"
 
+bool debugdetailanalog = false;
+
 ClassFlowAnalog::ClassFlowAnalog()
 {
     isLogImage = false;
@@ -147,6 +149,8 @@ bool ClassFlowAnalog::doFlow(string time)
         return false;
     };
 
+    if (debugdetailanalog) LogFile.WriteToFile("ClassFlowAnalog::doFlow nach Alignment");
+
     doNeuralNetwork(time);
 
     return true;
@@ -167,7 +171,7 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
     CAlignAndCutImage *caic = new CAlignAndCutImage(input);
 
     if (!caic->ImageOkay()){
-        LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
+        if (debugdetailanalog) LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
         delete caic;
         return false;
     }
@@ -175,7 +179,7 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
     if (input_roi.length() > 0){
         img_roi = new CImageBasis(input_roi);
         if (!img_roi->ImageOkay()){
-            LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut ImageRoi not okay!");
+            if (debugdetailanalog) LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut ImageRoi not okay!");
             delete caic;
             delete img_roi;
             return false;
@@ -190,6 +194,13 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
         caic->CutAndSave(output, ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay);
 
         rs = new CResizeImage(output);
+        if (!rs->ImageOkay()){
+            if (debugdetailanalog) LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut CResizeImage(output);!");
+            delete caic;
+            delete rs;
+            return false;
+        }
+
         rs->Resize(modelxsize, modelysize);
         ioresize = "/sdcard/img_tmp/ra" + std::to_string(i) + ".bmp";
         ioresize = FormatFileName(ioresize);
@@ -248,8 +259,11 @@ bool ClassFlowAnalog::doNeuralNetwork(string time)
         f1 = 0; f2 = 0;
 
 #ifndef OHNETFLITE
+//        LogFile.WriteToFile("ClassFlowAnalog::doNeuralNetwork vor CNN tflite->LoadInputImage(ioresize)");
         tflite->LoadInputImage(ioresize);
         tflite->Invoke();
+        if (debugdetailanalog) LogFile.WriteToFile("Nach Invoke");
+
 
         f1 = tflite->GetOutputValue(0);
         f2 = tflite->GetOutputValue(1);

+ 5 - 0
code/lib/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -20,6 +20,9 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
     if (_stepname.compare("[Analog]") == 0){
         _classname = "ClassFlowAnalog";
     }
+    if (_stepname.compare("[MQTT]") == 0){
+        _classname = "ClassFlowMQTT";
+    }
 //    std::string zw = "Classname: " + _classname + "\n";
 //    printf(zw.c_str());
 
@@ -80,6 +83,8 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
         cfc = new ClassFlowAnalog(&FlowControll);
     if (toUpper(_type).compare("[DIGITS]") == 0)
         cfc = new ClassFlowDigit(&FlowControll);
+    if (toUpper(_type).compare("[MQTT]") == 0)
+        cfc = new ClassFlowMQTT(&FlowControll);
     if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
     {
         cfc = new ClassFlowPostProcessing(&FlowControll); 

+ 1 - 0
code/lib/jomjol_flowcontroll/ClassFlowControll.h

@@ -8,6 +8,7 @@
 #include "ClassFlowDigit.h"
 #include "ClassFlowAnalog.h"
 #include "ClassFlowPostProcessing.h"
+#include "ClassFlowMQTT.h"
 
 
 class ClassFlowControll :

+ 122 - 0
code/lib/jomjol_flowcontroll/ClassFlowMQTT.cpp

@@ -0,0 +1,122 @@
+#include "ClassFlowMQTT.h"
+#include "Helper.h"
+
+#include "interface_mqtt.h"
+#include "ClassFlowPostProcessing.h"
+
+#include <time.h>
+
+static const char* TAG2 = "example";
+
+ClassFlowMQTT::ClassFlowMQTT()
+{
+    uri = "";
+    topic = "";
+    clientname = "watermeter";
+    OldValue = "";
+    flowpostprocessing = NULL;  
+    user = "";
+    password = "";    
+}
+
+ClassFlowMQTT::ClassFlowMQTT(std::vector<ClassFlow*>* lfc)
+{
+    uri = "";
+    topic = "";
+    clientname = "watermeter";
+    OldValue = "";
+    flowpostprocessing = NULL;
+    user = "";
+    password = "";        
+
+    ListFlowControll = lfc;
+
+    for (int i = 0; i < ListFlowControll->size(); ++i)
+    {
+        if (((*ListFlowControll)[i])->name().compare("ClassFlowPostProcessing") == 0)
+        {
+            flowpostprocessing = (ClassFlowPostProcessing*) (*ListFlowControll)[i];
+        }
+    }
+
+}
+
+bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
+{
+    std::vector<string> zerlegt;
+
+    aktparamgraph = trim(aktparamgraph);
+
+    if (aktparamgraph.size() == 0)
+        if (!this->GetNextParagraph(pfile, aktparamgraph))
+            return false;
+
+    if (toUpper(aktparamgraph).compare("[MQTT]") != 0)       // Paragraph passt nich zu MakeImage
+        return false;
+
+    while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
+    {
+        zerlegt = this->ZerlegeZeile(aktparamgraph);
+        if ((toUpper(zerlegt[0]) == "USER") && (zerlegt.size() > 1))
+        {
+            this->user = zerlegt[1];
+        }  
+        if ((toUpper(zerlegt[0]) == "PASSWORD") && (zerlegt.size() > 1))
+        {
+            this->password = zerlegt[1];
+        }               
+        if ((toUpper(zerlegt[0]) == "URI") && (zerlegt.size() > 1))
+        {
+            this->uri = zerlegt[1];
+        }
+        if ((toUpper(zerlegt[0]) == "TOPIC") && (zerlegt.size() > 1))
+        {
+            this->topic = zerlegt[1];
+        }
+        if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1))
+        {
+            this->clientname = zerlegt[1];
+        }
+
+    }
+
+    if ((uri.length() > 0) && (topic.length() > 0)) 
+    {
+        MQTTInit(uri, clientname, user, password);
+    }
+   
+    return true;
+}
+
+
+bool ClassFlowMQTT::doFlow(string zwtime)
+{
+    std::string result;
+    string zw = "";
+    
+    if (flowpostprocessing)
+    {
+        result =  flowpostprocessing->getReadoutParam(false, true);
+    }
+    else
+    {
+        for (int i = 0; i < ListFlowControll->size(); ++i)
+        {
+            zw = (*ListFlowControll)[i]->getReadout();
+            if (zw.length() > 0)
+            {
+                if (result.length() == 0)
+                    result = zw;
+                else
+                    result = result + "\t" + zw;
+            }
+        }
+    }
+
+    MQTTPublish(topic, result);
+
+    OldValue = result;
+
+
+    return true;
+}

+ 25 - 0
code/lib/jomjol_flowcontroll/ClassFlowMQTT.h

@@ -0,0 +1,25 @@
+#pragma once
+#include "ClassFlow.h"
+
+#include "ClassFlowPostProcessing.h"
+
+#include <string>
+
+class ClassFlowMQTT :
+    public ClassFlow
+{
+protected:
+    std::string uri, topic, clientname;
+    std::string OldValue;
+	ClassFlowPostProcessing* flowpostprocessing;  
+    std::string user, password;  
+
+
+public:
+    ClassFlowMQTT();
+    ClassFlowMQTT(std::vector<ClassFlow*>* lfc);
+    bool ReadParameter(FILE* pfile, string& aktparamgraph);
+    bool doFlow(string time);
+    string name(){return "ClassFlowMQTT";};
+};
+

+ 3 - 3
code/lib/jomjol_image_proc/CFindTemplate.cpp

@@ -391,11 +391,11 @@ CImageBasis::CImageBasis(std::string _image)
     channels = 3;
     externalImage = false;
     filename = _image;
-    long freebefore = esp_get_free_heap_size();
+//    long freebefore = esp_get_free_heap_size();
 
     rgb_image = stbi_load(_image.c_str(), &width, &height, &bpp, channels);
-    if (rgb_image == NULL)
-        LogFile.WriteToFile("Image Load failed:" + _image + " FreeHeapSize before: " + to_string(freebefore) + " after: " + to_string(esp_get_free_heap_size()));
+//    if (rgb_image == NULL)
+//        LogFile.WriteToFile("Image Load failed:" + _image + " FreeHeapSize before: " + to_string(freebefore) + " after: " + to_string(esp_get_free_heap_size()));
     //    printf("CImageBasis after load\n");
     //    printf("w %d, h %d, b %d, c %d", this->width, this->height, this->bpp, this->channels);
 }

+ 82 - 0
code/lib/jomjol_mqtt/interface_mqtt.cpp

@@ -0,0 +1,82 @@
+#include "interface_mqtt.h"
+
+
+#include "esp_log.h"
+#include "mqtt_client.h"
+#include "ClassLogFile.h"
+
+static const char *TAG = "interface_mqtt";
+
+bool debugdetail = true;
+
+// #define CONFIG_BROKER_URL "mqtt://192.168.178.43:1883"
+
+esp_mqtt_event_id_t esp_mmqtt_ID = MQTT_EVENT_ANY;
+
+bool mqtt_connected = false;
+esp_mqtt_client_handle_t client = NULL;
+
+void MQTTPublish(std::string _key, std::string _content){
+    if (client && mqtt_connected) {
+        int msg_id;
+        std::string zw;
+        msg_id = esp_mqtt_client_publish(client, _key.c_str(), _content.c_str(), 0, 1, 0);
+        zw = "sent publish successful in MQTTPublish, msg_id=" + std::to_string(msg_id) + ", " + _key + ", " + _content;
+        if (debugdetail) LogFile.WriteToFile(zw);
+        ESP_LOGI(TAG, "sent publish successful in MQTTPublish, msg_id=%d, %s, %s", msg_id, _key.c_str(), _content.c_str());
+    }
+    else {
+        ESP_LOGI(TAG, "Problem with Publish, client=%d, mqtt_connected %d", (int) client, (int) mqtt_connected);
+    }
+}
+
+
+static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
+{
+    switch (event->event_id) {
+        case MQTT_EVENT_CONNECTED:
+            ESP_LOGI(TAG, "MQTT_EVENT_CONNECTED");
+            mqtt_connected = true;
+            break;
+        case MQTT_EVENT_DISCONNECTED:
+            ESP_LOGI(TAG, "MQTT_EVENT_DISCONNECTED");
+            break;
+        case MQTT_EVENT_PUBLISHED:
+            ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
+            break;
+        case MQTT_EVENT_DATA:
+            ESP_LOGI(TAG, "MQTT_EVENT_DATA");
+            printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
+            printf("DATA=%.*s\r\n", event->data_len, event->data);
+            break;
+        case MQTT_EVENT_ERROR:
+            ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
+            break;
+        default:
+            ESP_LOGI(TAG, "Other event id:%d", event->event_id);
+            break;
+    }
+    return ESP_OK;
+}
+
+static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) {
+    ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
+    mqtt_event_handler_cb((esp_mqtt_event_handle_t) event_data);
+}
+
+void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password){
+    esp_mqtt_client_config_t mqtt_cfg = {
+        .uri = _mqttURI.c_str(),
+        .client_id = _clientid.c_str(),
+    };
+
+    if (_user.length() && _password.length()){
+        mqtt_cfg.username = _user.c_str();
+        mqtt_cfg.password = _password.c_str();
+        printf("Connect to MQTT: %s, %s", mqtt_cfg.username, mqtt_cfg.password);
+    };
+
+    client = esp_mqtt_client_init(&mqtt_cfg);
+    esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
+    esp_mqtt_client_start(client);
+}

+ 4 - 0
code/lib/jomjol_mqtt/interface_mqtt.h

@@ -0,0 +1,4 @@
+#include <string>
+
+void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = "");
+void MQTTPublish(std::string _key, std::string _content);

+ 11 - 0
code/lib/jomjol_tfliteclass/CTfLiteClass.cpp

@@ -2,8 +2,12 @@
 
 #include "bitmap_image.hpp"
 
+#include "ClassLogFile.h"
+
 #include <sys/stat.h>
 
+bool debugdetailtflite = false;
+
 float CTfLiteClass::GetOutputValue(int nr)
 {
     TfLiteTensor* output2 = this->interpreter->output(0);
@@ -109,7 +113,11 @@ void CTfLiteClass::Invoke()
 
 bool CTfLiteClass::LoadInputImage(std::string _fn)
 {
+    std::string zw = "ClassFlowAnalog::doNeuralNetwork nach Load Image: " + _fn;
+//    LogFile.WriteToFile(zw);
     bitmap_image image(_fn);
+    if (debugdetailtflite) LogFile.WriteToFile(zw);
+
     unsigned int w = image.width();
     unsigned int h = image.height();
     unsigned char red, green, blue;
@@ -135,6 +143,9 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
 //                printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
 
             }
+    
+    if (debugdetailtflite) LogFile.WriteToFile("Nach dem Laden in input");
+
     return true;
 }
 

+ 1 - 1
code/platformio.ini

@@ -23,7 +23,7 @@ board_build.embed_files  =
 ;board_build.partitions = partitions_singleapp.csv
 board_build.partitions = partition.csv
 
-lib_deps = jomjol_helper, connect_wlan, conversions, driver, sensors, jomjol_image_proc, jomjol_controlcamera, jomjol_flowcontroll, jomjol_tfliteclass, tfmicro, jomjol_fileserver_ota, jomjol_time_sntp, jomjol_logfile
+lib_deps = jomjol_helper, connect_wlan, conversions, driver, sensors, jomjol_image_proc, jomjol_controlcamera, jomjol_flowcontroll, jomjol_tfliteclass, tfmicro, jomjol_fileserver_ota, jomjol_time_sntp, jomjol_logfile, jomjol_mqtt
 monitor_speed = 115200
 
 debug_tool = esp-prog

+ 8 - 45
code/src/main.cpp

@@ -5,63 +5,26 @@
 
 #include "driver/gpio.h"
 #include "sdkconfig.h"
-//#include "version.h"
 
-#include "ClassLogFile.h"
-
-
-//#include "esp_wifi.h"
-//#include "protocol_examples_common.h"
-
-#include "connect_wlan.h"
-
-#include <esp_http_server.h>
-
-#include "lwip/err.h"
-#include "lwip/sockets.h"
-#include "lwip/sys.h"
-#include "lwip/netdb.h"
-#include "lwip/dns.h"
-
-
-#include <sys/unistd.h>
-#include <sys/stat.h>
-#include "esp_log.h"
-#include "esp_system.h"
-#include "esp_event.h"
-#include "esp_event_loop.h"
+// SD-Card ////////////////////
 #include "nvs_flash.h"
-#include "esp_err.h"
 #include "esp_vfs_fat.h"
+#include "sdmmc_cmd.h"
 #include "driver/sdmmc_host.h"
 #include "driver/sdmmc_defs.h"
-#include "sdmmc_cmd.h"
+///////////////////////////////
+
+#include "ClassLogFile.h"
+
+#include "connect_wlan.h"
 
-#include "server_main.h"
-#include "server_camera.h"
 #include "server_tflite.h"
 #include "server_file.h"
 #include "server_ota.h"
 #include "time_sntp.h"
 #include "ClassControllCamera.h"
-
-
-#include "freertos/FreeRTOS.h"
-#include "freertos/task.h"
-#include "freertos/event_groups.h"
-
-#include "freertos/FreeRTOS.h"
-
-// SD-Card
-#include "nvs_flash.h"
-#include "esp_vfs_fat.h"
-#include "sdmmc_cmd.h"
-
 #include "server_main.h"
 #include "server_camera.h"
-#include "ClassControllCamera.h"
-#include "connect_wlan.h"
-#include "time_sntp.h"
 
 static const char *TAGMAIN = "connect_wlan_main";
 
@@ -130,7 +93,7 @@ extern "C" void app_main()
     vTaskDelay( xDelay );   
 //    LogFile.WriteToFile("Startsequence 07");  
     setup_time();
-    LogFile.WriteToFile("======================== Main Started ================================");
+    LogFile.WriteToFile("============================== Main Started =======================================");
     LogFile.SwitchOnOff(false);
 
     std::string zw = gettimestring("%Y%m%d-%H%M%S");

+ 56 - 2
code/src/server_main.cpp

@@ -9,6 +9,8 @@
 
 #include "version.h"
 
+#include "esp_wifi.h"
+
 
 httpd_handle_t server = NULL;   
 
@@ -83,6 +85,14 @@ esp_err_t info_get_handler(httpd_req_t *req)
         return ESP_OK;        
     }
 
+    if (_task.compare("HTMLVersion") == 0)
+    {
+        std::string zw;
+        zw = std::string(getHTMLversion());
+        httpd_resp_sendstr_chunk(req, zw.c_str());
+        httpd_resp_sendstr_chunk(req, NULL);  
+        return ESP_OK;        
+    }
 
     return ESP_OK;
 }
@@ -155,8 +165,6 @@ esp_err_t hello_main_handler(httpd_req_t *req)
     return ESP_OK;
 }
 
-
-
 esp_err_t img_tmp_handler(httpd_req_t *req)
 {
     char filepath[50];
@@ -197,7 +205,45 @@ esp_err_t img_tmp_handler(httpd_req_t *req)
     return ESP_OK;
 }
 
+esp_err_t sysinfo_handler(httpd_req_t *req)
+{
+    const char* resp_str; 
+    std::string zw;
+    std::string cputemp = std::to_string(temperatureRead());
+    std::string gitversion = libfive_git_version();
+    std::string buildtime = build_time();
+    std::string gitbranch = libfive_git_branch();
+    std::string gitbasebranch = git_base_branch();
+    std::string htmlversion = getHTMLversion();
+
+    tcpip_adapter_ip_info_t ip_info;
+    ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
+    const char *hostname;
+    ESP_ERROR_CHECK(tcpip_adapter_get_hostname(TCPIP_ADAPTER_IF_STA, &hostname));
+    
+    zw = "[\
+            {\
+                \"firmware\" : \"" + gitversion + "\",\
+                \"buildtime\" : \"" + buildtime + "\",\
+                \"gitbranch\" : \"" + gitbranch + "\",\
+                \"gitbasebranch\" : \"" + gitbasebranch + "\",\
+                \"html\" : \"" + htmlversion + "\",\
+                \"cputemp\" : \"" + cputemp + "\",\
+                \"hostname\" : \"" + hostname + "\",\
+                \"IPv4\" : \"" + ip4addr_ntoa(&ip_info.ip) + "\"\
+            }\
+        ]";
+
+
+    resp_str = zw.c_str();
+
+    httpd_resp_set_type(req, "application/json");
+    httpd_resp_send(req, resp_str, strlen(resp_str));   
+    /* Respond with an empty chunk to signal HTTP response completion */
+    httpd_resp_send_chunk(req, NULL, 0);      
 
+    return ESP_OK;
+}
 
 void register_server_main_uri(httpd_handle_t server, const char *base_path)
 {
@@ -209,6 +255,13 @@ void register_server_main_uri(httpd_handle_t server, const char *base_path)
     };
     httpd_register_uri_handler(server, &info_get_handle);
 
+    httpd_uri_t sysinfo_handle = {
+        .uri       = "/sysinfo",  // Match all URIs of type /path/to/file
+        .method    = HTTP_GET,
+        .handler   = sysinfo_handler,
+        .user_ctx  = (void*) base_path    // Pass server data as context
+    };
+    httpd_register_uri_handler(server, &sysinfo_handle);
 
     httpd_uri_t starttime_tmp_handle = {
         .uri       = "/starttime",  // Match all URIs of type /path/to/file
@@ -235,6 +288,7 @@ void register_server_main_uri(httpd_handle_t server, const char *base_path)
         .user_ctx  = (void*) base_path    // Pass server data as context
     };
     httpd_register_uri_handler(server, &main_rest_handle);
+
 }
 
 

+ 5 - 36
code/src/server_tflite.cpp

@@ -410,36 +410,6 @@ esp_err_t handler_prevalue(httpd_req_t *req)
     return ESP_OK;
 };
 
-
-esp_err_t handler_sysinfo(httpd_req_t *req)
-{
-    LogFile.WriteToFile("handler_sysinfo"); 
-    const char* resp_str;
-    string zw;
-    string cputemp = std::to_string(temperatureRead());
-
-    zw = "[\
-            {\
-                \"firmware\" : \"2.0.0\",\
-                \"html\" : \"1.0.1\",\
-                \"cputemp\" : \"" + cputemp + "\",\
-                \"hostname\" : \"host\",\
-                \"IPv4\" : \"IP\"\
-            }\
-        ]";
-
-
-    resp_str = zw.c_str();
-
-    httpd_resp_set_type(req, "application/json");
-    httpd_resp_send(req, resp_str, strlen(resp_str));   
-    /* Respond with an empty chunk to signal HTTP response completion */
-    httpd_resp_send_chunk(req, NULL, 0);      
-
-    return ESP_OK;
-};
-
-
 void task_autodoFlow(void *pvParameter)
 {
     int64_t fr_start, fr_delta_ms;
@@ -468,7 +438,10 @@ void task_autodoFlow(void *pvParameter)
         LogFile.WriteToFile("task_autodoFlow - round done");
         //CPU Temp
         float cputmp = temperatureRead();
-//        LogFile.WriteToFile("CPU Temperature: %.2f", cputmp); 
+        std::stringstream stream;
+        stream << std::fixed << std::setprecision(1) << cputmp;
+        string zwtemp = "CPU Temperature: " + stream.str();
+        LogFile.WriteToFile(zwtemp); 
         printf("CPU Temperature: %.2f\n", cputmp);
         fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
         const TickType_t xDelay = (auto_intervall - fr_delta_ms)  / portTICK_PERIOD_MS;
@@ -518,9 +491,5 @@ void register_server_tflite_uri(httpd_handle_t server)
     camuri.handler   = handler_wasserzaehler;
     camuri.user_ctx  = (void*) "Wasserzaehler"; 
     httpd_register_uri_handler(server, &camuri);  
-    
-    camuri.uri       = "/sysinfo";
-    camuri.handler   = handler_sysinfo;
-    camuri.user_ctx  = (void*) "Sysinfo"; 
-    httpd_register_uri_handler(server, &camuri);
+
 }

+ 3 - 3
code/src/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="bafd67b";
+const char* GIT_REV="04f69f0";
 const char* GIT_TAG="";
-const char* GIT_BRANCH="master";
-const char* BUILD_TIME="2020-09-28 19:57";
+const char* GIT_BRANCH="rolling";
+const char* BUILD_TIME="2020-10-13 20:10";

+ 24 - 0
code/src/version.h

@@ -8,6 +8,11 @@ extern "C"
     extern const char* BUILD_TIME;
 }
 
+#include <string>
+#include <string.h>
+#include "Helper.h"
+#include <fstream>
+
 const char* GIT_BASE_BRANCH = "master - v2.1.1 - 2020-09-28";
 
 
@@ -35,4 +40,23 @@ const char* libfive_git_revision(void)
 const char* libfive_git_branch(void)
 {
     return GIT_BRANCH;
+}
+
+std::string getHTMLversion(void){
+    
+    string line = "";
+    
+    FILE* pFile;
+    string fn = FormatFileName("/sdcard/html/version.txt");
+    pFile = fopen(fn.c_str(), "r");
+
+    if (pFile == NULL)
+        return std::string("NAN");
+
+    char zw[1024];
+    fgets(zw, 1024, pFile);
+    line = std::string(trim(zw));
+    fclose(pFile);
+
+    return line;
 }

+ 3 - 3
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="bafd67b";
+const char* GIT_REV="04f69f0";
 const char* GIT_TAG="";
-const char* GIT_BRANCH="master";
-const char* BUILD_TIME="2020-09-28 19:57";
+const char* GIT_BRANCH="rolling";
+const char* BUILD_TIME="2020-10-13 20:10";

BIN
firmware/.DS_Store


BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin


BIN
firmware/html.zip


BIN
sd-card/.DS_Store


+ 6 - 0
sd-card/config/config.ini

@@ -38,6 +38,12 @@ MaxRateValue = 0.1
 ErrorMessage = True
 CheckDigitIncreaseConsistency = False
 
+;[MQTT]
+;Uri = mqtt://IP-MQTT-SERVER:1883
+;Topic = watermeter/readout
+;ClientID = wasser
+;user = USERNAME
+;password = PASSWORD
 
 [AutoTimer]
 AutoStart= True

+ 19 - 8
sd-card/html/info.html

@@ -3,7 +3,7 @@
 <head>
 <title>Set PreValue</title>
 <meta charset="utf-8">
-	
+
 <style>
 h1 {font-size: 2em;}
 h2 {font-size: 1.5em;}
@@ -16,11 +16,11 @@ div {
     border: 1px solid #ccc;
 	font-family: arial;
     font-size: 16px;
-	max-height: 35px;	
+	max-height: 35px;
 }
 
-</style>	
-	
+</style>
+
 </head>
 
 
@@ -38,7 +38,7 @@ div {
 			<object data="/version?type=GitBranch"></object>
 		</div>
 	</td>
-  </tr>	
+  </tr>
 
   <tr>
 	<td>
@@ -49,7 +49,7 @@ div {
 			<object data="/version?type=GitBaseBranch"></object>
 		</div>
 	</td>
-  </tr>	
+  </tr>
 
   <tr>
 	<td>
@@ -60,7 +60,7 @@ div {
 			<object data="/version?type=GitVersion"></object>
 		</div>
 	</td>
-  </tr>	
+  </tr>
 
   <tr>
 	<td>
@@ -71,9 +71,20 @@ div {
 			<object data="/version?type=BuildTime"></object>
 		</div>
 	</td>
+  </tr>
+
+	<tr>
+	<td>
+		HTML Version:
+	</td>
+	<td>
+		<div>
+			<object data="/version?type=HTMLVersion"></object>
+		</div>
+	</td>
   </tr>
 </table>
 
 
 </body>
-</html>
+</html>

+ 1 - 0
sd-card/html/version.txt

@@ -0,0 +1 @@
+1.0.0