jomjol %!s(int64=5) %!d(string=hai) anos
pai
achega
f30dc8d7cf

+ 1 - 1
code/lib/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -124,7 +124,7 @@ bool ClassFlowControll::doFlow(string time)
 string ClassFlowControll::getReadout(bool _rawvalue = false)
 string ClassFlowControll::getReadout(bool _rawvalue = false)
 {
 {
     if (flowpostprocessing)
     if (flowpostprocessing)
-        return flowpostprocessing->getReadout();
+        return flowpostprocessing->getReadoutParam(_rawvalue);
 
 
     string zw = "";
     string zw = "";
     string result = "";
     string result = "";

+ 2 - 1
code/lib/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -244,13 +244,14 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
         if (isanalog)
         if (isanalog)
             ReturnValue = ReturnValue + analog;
             ReturnValue = ReturnValue + analog;
 
 
+        ReturnRawValue = ReturnValue;
+
         if ((findDelimiterPos(ReturnValue, "N") == std::string::npos) && (ReturnValue.length() > 0))
         if ((findDelimiterPos(ReturnValue, "N") == std::string::npos) && (ReturnValue.length() > 0))
         {
         {
             while ((ReturnValue.length() > 1) && (ReturnValue[0] == '0'))
             while ((ReturnValue.length() > 1) && (ReturnValue[0] == '0'))
             {
             {
                 ReturnValue.erase(0, 1);
                 ReturnValue.erase(0, 1);
             }
             }
-            ReturnRawValue = ReturnValue;
             Value = std::stof(ReturnValue);
             Value = std::stof(ReturnValue);
             SavePreValue(Value, zwtime);
             SavePreValue(Value, zwtime);
         }
         }

+ 11 - 17
code/lib/jomjol_time_sntp/time_sntp.cpp

@@ -48,7 +48,7 @@ std::string gettimestring(const char * frm)
     time(&now);
     time(&now);
     localtime_r(&now, &timeinfo);
     localtime_r(&now, &timeinfo);
     // Is time set? If not, tm_year will be (1970 - 1900).
     // Is time set? If not, tm_year will be (1970 - 1900).
-    if (setTimeAlwaysOnReboot || (timeinfo.tm_year < (2016 - 1900))) {
+    if (timeinfo.tm_year < (2016 - 1900)) {
         ESP_LOGI(TAG, "Reboot - Connecting to WiFi and getting time over NTP.");
         ESP_LOGI(TAG, "Reboot - Connecting to WiFi and getting time over NTP.");
         obtain_time();
         obtain_time();
         // update 'now' variable with current time
         // update 'now' variable with current time
@@ -77,27 +77,20 @@ void setup_time(void)
     // Is time set? If not, tm_year will be (1970 - 1900).
     // Is time set? If not, tm_year will be (1970 - 1900).
     if (timeinfo.tm_year < (2016 - 1900)) {
     if (timeinfo.tm_year < (2016 - 1900)) {
         ESP_LOGI(TAG, "Time is not set yet. Connecting to WiFi and getting time over NTP.");
         ESP_LOGI(TAG, "Time is not set yet. Connecting to WiFi and getting time over NTP.");
+        initialize_sntp();
         obtain_time();
         obtain_time();
         // update 'now' variable with current time
         // update 'now' variable with current time
         time(&now);
         time(&now);
     }
     }
+    else
+    {
+        if (setTimeAlwaysOnReboot)
+        {
+            obtain_time();
+        }
+    }
     char strftime_buf[64];
     char strftime_buf[64];
 
 
-/*
-    // Set timezone to Eastern Standard Time and print local time
-    setenv("TZ", "EST5EDT,M3.2.0/2,M11.1.0", 1);
-    tzset();
-    localtime_r(&now, &timeinfo);
-    strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
-    ESP_LOGI(TAG, "The current date/time in New York is: %s", strftime_buf);
-
-    // Set timezone to China Standard Time
-    setenv("TZ", "CST-8", 1);
-    tzset();
-    localtime_r(&now, &timeinfo);
-    strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
-    ESP_LOGI(TAG, "The current date/time in Shanghai is: %s", strftime_buf);
-*/
     // Set timezone to Berlin Standard Time
     // Set timezone to Berlin Standard Time
     setenv("TZ", "UTC+9", 1);
     setenv("TZ", "UTC+9", 1);
     tzset();
     tzset();
@@ -112,9 +105,10 @@ void setup_time(void)
     printf("time %s\n", zw.c_str());
     printf("time %s\n", zw.c_str());
 }
 }
 
 
+
 static void obtain_time(void)
 static void obtain_time(void)
 {
 {
-    initialize_sntp();
+//    initialize_sntp();
 
 
     // wait for time to be set
     // wait for time to be set
     time_t now = 0;
     time_t now = 0;

BIN=BIN
firmware/firmware.bin