ソースを参照

Rolling 20210520

jomjol 4 年 前
コミット
528a4435a9

+ 3 - 0
README.md

@@ -44,9 +44,12 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
 **General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
 
 ##### Rolling - (2021-05-20)
+* Bug fix: mqtt retain message flag
 
+Rolling - (2021-05-20)
 * Bug fix: WLan reconnect after connection lost
 
+
 Rolling - (2021-05-17)
 * Update wlan handling to esp-idf 4.1
 * Set mqtt error message with retain flag

+ 12 - 0
code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp

@@ -14,6 +14,9 @@ static const char* TAG = "flow_make_image";
 esp_err_t ClassFlowMakeImage::camera_capture(){
     string nm =  namerawimage;
     Camera.CaptureToFile(nm);
+    time(&TimeImageTaken);
+    localtime(&TimeImageTaken);
+
     return ESP_OK;
 }
 
@@ -24,6 +27,9 @@ void ClassFlowMakeImage::takePictureWithFlash(int flashdauer)
     rawImage->height = image_height;
     /////////////////////////////////////////////////////////////////////////////////////
     Camera.CaptureToBasisImage(rawImage, flashdauer);
+    time(&TimeImageTaken);
+    localtime(&TimeImageTaken);
+
     if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
 }
 
@@ -169,6 +175,9 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
 esp_err_t ClassFlowMakeImage::SendRawJPG(httpd_req_t *req)
 {
     int flashdauer = (int) (waitbeforepicture * 1000);
+    time(&TimeImageTaken);
+    localtime(&TimeImageTaken);
+
     return Camera.CaptureToHTTP(req, flashdauer);
 }
 
@@ -179,6 +188,9 @@ ImageData* ClassFlowMakeImage::SendRawImage()
     ImageData *id;
     int flashdauer = (int) (waitbeforepicture * 1000);
     Camera.CaptureToBasisImage(zw, flashdauer);
+    time(&TimeImageTaken);
+    localtime(&TimeImageTaken);
+
     id = zw->writeToMemoryAsJPG();    
     delete zw;
     return id;  

+ 1 - 0
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -392,6 +392,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
         time_t currenttime;
         time(&currenttime);
         localtime(&currenttime);
+//        currenttime = 
         double difference = difftime(currenttime, lastvalue);      // in Sekunden
         difference /= 60;                                          // in Minuten
         FlowRateAct = (Value - PreValue) / difference;

+ 2 - 1
code/components/jomjol_mqtt/interface_mqtt.cpp

@@ -74,6 +74,7 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
         .client_id = _clientid.c_str(),
         .lwt_topic = _LWTContext.c_str(),
         .lwt_msg = _zwmessage.c_str(),
+        .lwt_retain = 1,
         .lwt_msg_len = _lzw,
         .keepalive = _keepalive
     };
@@ -88,5 +89,5 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
     esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
     esp_mqtt_client_start(client);
 
-    MQTTPublish(_LWTContext, "");
+    MQTTPublish(_LWTContext, "", 1);
 }

+ 11 - 0
code/components/jomjol_time_sntp/time_sntp.cpp

@@ -27,6 +27,17 @@ void time_sync_notification_cb(struct timeval *tv)
     ESP_LOGI(TAG, "Notification of a time synchronization event");
 }
 
+std::string ConvertTimeToString(time_t _time, const char * frm)
+{
+    struct tm timeinfo;
+    char strftime_buf[64];
+    localtime_r(&_time, &timeinfo);
+    strftime(strftime_buf, sizeof(strftime_buf), frm, &timeinfo);
+
+    std::string result(strftime_buf);
+    return result;
+}
+
 std::string gettimestring(const char * frm)
 {
     time_t now;

+ 2 - 0
code/components/jomjol_time_sntp/time_sntp.h

@@ -15,5 +15,7 @@
 void setup_time(void);
 
 std::string gettimestring(const char * frm);
+std::string ConvertTimeToString(time_t _time, const char * frm);
+
 void setTimeZone(std::string _tzstring);
 void reset_servername(std::string _servername);

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="58eb0b1";
+const char* GIT_REV="9b791bb";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-05-20 06:55";
+const char* BUILD_TIME="2021-05-20 21:43";

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="58eb0b1";
+const char* GIT_REV="9b791bb";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-05-20 06:55";
+const char* BUILD_TIME="2021-05-20 21:43";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin