Browse Source

2023-03-06
- fixed bug in config_set.ino - sensor configuration items were only available when compiled as variant thermostat
- fixed web interface - conf UI sensors and heat control
- moved one wire pre compile config to settings.h

FloKra 1 year ago
parent
commit
40c7c0d301
5 changed files with 129 additions and 118 deletions
  1. 1 7
      src/ESPIoTBase.ino
  2. 109 100
      src/config_set.ino
  3. 8 7
      src/html_confHeatcontrol_DE.h
  4. 1 1
      src/html_confSens_DE.h
  5. 10 3
      src/settings.h

+ 1 - 7
src/ESPIoTBase.ino

@@ -67,13 +67,7 @@ FSInfo fs_info;  // struct for file system infos
 #ifdef ENABLE_SENSORS_ONEWIRE
   #include <OneWire.h>
   #include <DallasTemperature.h>
-  #define ONE_WIRE_BUS 13
-  #define ONEWIRE_SENSORS_COUNT 3
-
-  #define ONEWIRE_SENSOR_INDEX_FEED 0
-  #define ONEWIRE_SENSOR_INDEX_RETURN 1
-  #define ONEWIRE_SENSOR_INDEX_OUT 2
-
+  
   // Setup a oneWire instance to communicate with any OneWire devices
   OneWire oneWire(ONE_WIRE_BUS);
   // Pass our oneWire reference to Dallas Temperature sensor 

+ 109 - 100
src/config_set.ino

@@ -1084,6 +1084,107 @@ void setConfig(char *param, char *value)
     }
   }
 
+
+
+  // DISPLAY
+  else if (strcmp(param, "dispint") == 0)
+  {
+    int valueInt = atoi(value);
+    if (valueInt != confDisplay.displayInterval)
+    {
+      if (valueInt >= 1 && valueInt <= 60)
+      {
+        confDisplay.displayInterval = valueInt;
+        confDisplay_wasChanged = true;
+      }
+      else {
+        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
+       sendLog(logBuf, LOGLEVEL_ERROR);
+      }
+    }
+  }
+
+  else if (strcmp(param, "disptout") == 0)
+  {
+    int valueInt = atoi(value);
+    if (valueInt != confDisplay.displayTimeout)
+    {
+      if (valueInt >= 2 && valueInt <= 3600)
+      {
+        confDisplay.displayTimeout = valueInt;
+        confDisplay_wasChanged = true;
+      }
+      else {
+        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
+        sendLog(logBuf, LOGLEVEL_ERROR);
+      }
+    }
+  }
+
+  else if (strcmp(param, "pirendisp") == 0)
+  {
+    bool tmpval;
+    if (atoi(value) == 1)
+      tmpval = true;
+    else
+      tmpval = false;
+
+    if (tmpval != confDisplay.PIRenablesDisplay)
+    {
+      confDisplay.PIRenablesDisplay = tmpval;
+      confDisplay_wasChanged = true;
+    }
+  }
+  // /DISPLAY
+
+
+
+  // SENSORS
+  else if (strcmp(param, "measint") == 0)
+  {
+    int valueInt = atoi(value);
+    if (valueInt != confSens.measureInterval)
+    {
+      if (valueInt >= 5 && valueInt <= 60)
+      {
+        confSens.measureInterval = valueInt;
+        confSens_wasChanged = true;
+      }
+      else {
+        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
+       sendLog(logBuf, LOGLEVEL_ERROR);
+      }
+    }
+  }
+
+  #ifdef ENABLE_SENSOR_DHT22
+    else if (strcmp(param, "dht_tempcorr") == 0)
+    {
+      float valueFloat = atof(value);
+      if (valueFloat != confSens.DHT_tempCorrVal)
+      {
+        if (valueFloat >= -5.0 && valueFloat <= 5.0)
+        {
+          confSens.DHT_tempCorrVal = valueFloat;
+          confSens_wasChanged = true;
+        }
+      }
+    }
+  
+    else if (strcmp(param, "dht_humcorr") == 0)
+    {
+      int valueInt = atoi(value);
+      if (valueInt != confSens.DHT_humCorrVal)
+      {
+        if (valueInt >= -40 && valueInt <= 40)
+        {
+          confSens.DHT_humCorrVal = valueInt;
+          confSens_wasChanged = true;
+        }
+      }
+    }
+  #endif //ENABLE_SENSOR_DHT22
+  
   #ifdef ENABLE_SENSORS_ONEWIRE
     // assign sensors - console commands
     else if (strcmp(param, "sens_feed") == 0)
@@ -1170,10 +1271,12 @@ void setConfig(char *param, char *value)
         sendLog(logBuf, LOGLEVEL_ERROR);
       }
     }
-  #endif
+  #endif // ENABLE_SENSORS_ONEWIRE
+  // /SENSORS - confSens
   
+
   
-  // confTherm
+  // THERMOSTAT - confTherm
   #ifdef FIRMWARE_VARIANT_THERMOSTAT
   else if (strcmp(param, "autosavetemp") == 0)
   {
@@ -1258,72 +1361,6 @@ void setConfig(char *param, char *value)
     }
   }
 
-  else if (strcmp(param, "measint") == 0)
-  {
-    int valueInt = atoi(value);
-    if (valueInt != confSens.measureInterval)
-    {
-      if (valueInt >= 5 && valueInt <= 60)
-      {
-        confSens.measureInterval = valueInt;
-        confSens_wasChanged = true;
-      }
-      else {
-        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
-       sendLog(logBuf, LOGLEVEL_ERROR);
-      }
-    }
-  }
-
-  else if (strcmp(param, "dispint") == 0)
-  {
-    int valueInt = atoi(value);
-    if (valueInt != confDisplay.displayInterval)
-    {
-      if (valueInt >= 1 && valueInt <= 60)
-      {
-        confDisplay.displayInterval = valueInt;
-        confDisplay_wasChanged = true;
-      }
-      else {
-        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
-       sendLog(logBuf, LOGLEVEL_ERROR);
-      }
-    }
-  }
-
-  else if (strcmp(param, "disptout") == 0)
-  {
-    int valueInt = atoi(value);
-    if (valueInt != confDisplay.displayTimeout)
-    {
-      if (valueInt >= 2 && valueInt <= 3600)
-      {
-        confDisplay.displayTimeout = valueInt;
-        confDisplay_wasChanged = true;
-      }
-      else {
-        sprintf_P(logBuf, PGMStr_conf_invalidValue, param);
-        sendLog(logBuf, LOGLEVEL_ERROR);
-      }
-    }
-  }
-
-  else if (strcmp(param, "pirendisp") == 0)
-  {
-    bool tmpval;
-    if (atoi(value) == 1)
-      tmpval = true;
-    else
-      tmpval = false;
-
-    if (tmpval != confDisplay.PIRenablesDisplay)
-    {
-      confDisplay.PIRenablesDisplay = tmpval;
-      confDisplay_wasChanged = true;
-    }
-  }
-
   else if (strcmp(param, "pirendispps0") == 0)
   {
     bool tmpval;
@@ -1597,10 +1634,11 @@ void setConfig(char *param, char *value)
     }
   }
   #endif // FIRMWARE_VARIANT_THERMOSTAT
-  
+  // /THERMOSTAT
 
 
-  // confHeatc
+
+  // HEAT CONTROL - confHeatc
   #ifdef FIRMWARE_VARIANT_HEATCONTROL
   else if (strcmp(param, "heatcm20") == 0)
   {
@@ -2028,38 +2066,9 @@ void setConfig(char *param, char *value)
     }
   }
 
-  #endif
-
-
+  #endif //FIRMWARE_VARIANT_HEATCONTROL
 
 
-  // sensors
-
-  else if (strcmp(param, "dhtcorrt") == 0)
-  {
-    float valueFloat = atof(value);
-    if (valueFloat != confSens.DHT_tempCorrVal)
-    {
-      if (valueFloat >= -5.0 && valueFloat <= 5.0)
-      {
-        confSens.DHT_tempCorrVal = valueFloat;
-        confSens_wasChanged = true;
-      }
-    }
-  }
-
-  else if (strcmp(param, "dhtcorrh") == 0)
-  {
-    int valueInt = atoi(value);
-    if (valueInt != confSens.DHT_humCorrVal)
-    {
-      if (valueInt >= -40 && valueInt <= 40)
-      {
-        confSens.DHT_humCorrVal = valueInt;
-        confSens_wasChanged = true;
-      }
-    }
-  }
 
   else {
     snprintf_P(logBuf, LOG_BUFFER_SIZE, PGMStr_conf_setConf_unknownParamName, param);

+ 8 - 7
src/html_confHeatcontrol_DE.h

@@ -147,6 +147,14 @@ immer zur sofortigen Abschaltung. </p>
 
 <fieldset>
 <legend>Heizkurve</legend>
+
+<p><b>Heizkurve verwenden</b>&nbsp;<input type='checkbox' name='heatUseHC' id='heatUseHC'/></p>
+<p class='n'>Wenn <b>deaktiviert</b> folgt die Ansteuerung <br>
+der Heizung ausschließlich der Anforderung <br>
+des Raumthermostats.</p>
+
+<br>
+
 <table>
 <tr><th>Au&szlig;en</th><th> - </th><th>Vorlauf [°C]</th></tr>
 <tr><td><b>< -20°C</b></td><td> - </td><td><input class='smallnum' type='number' min='10' max='90' name='heatcm20' id='heatcm20'></td></tr>
@@ -174,13 +182,6 @@ immer zur sofortigen Abschaltung. </p>
 
 <br>
 
-<p><b>Heizkurve verwenden</b>&nbsp;<input type='checkbox' name='heatUseHC' id='heatUseHC'/></p>
-<p class='n'>Wenn <b>deaktiviert</b> folgt die Ansteuerung <br>
-der Heizung ausschließlich der Anforderung <br>
-des Raumthermostats.</p>
-
-<br>
-
 <p><b>Heizkurve forcieren <br>
 bei Abschaltung</b>&nbsp;
 <input type='checkbox' name='heatForceHC' id='heatForceHC'/></p>

+ 1 - 1
src/html_confSens_DE.h

@@ -19,7 +19,7 @@ static const char html_confSens_script[] PROGMEM = R"=====(
         selectElement(g('assignSens_2'), data.assignSens_2);
         g('measInt').value = data.measInt;
         g('DHT_tempCorr').value = data.DHT_tempCorr;
-        g('DHT_humCorr').value = data.DHT_tempCorr;
+        g('DHT_humCorr').value = data.DHT_humCorr;
         //setCbx(g('togTHdisp'), data.togTHdisp);
         xhttp = null;
         reqFin = true;

+ 10 - 3
src/settings.h

@@ -123,9 +123,11 @@
 
 #ifdef FIRMWARE_VARIANT_HEATCONTROL
     #undef FIRMWARE_VARIANT_THERMOSTAT
+    #undef DISPLAY_USE_MINIMAL_LAYOUT
+    
     #define ENABLE_I2C_INTERFACE
-    #define ENABLE_SENSOR_DHT22
 
+    #define ENABLE_SENSOR_DHT22
     #define PIN_DHTSENSOR 2
     #define DHTTYPE DHT22 // DHT sensor type
 
@@ -143,12 +145,17 @@
     // default logic levels
     #define BUTTONONSTATE LOW
 
-
     #define ENABLE_SENSORS_ONEWIRE
+    #define ONE_WIRE_BUS 13
+    #define ONEWIRE_SENSORS_COUNT 3
+    #define ONEWIRE_SENSOR_INDEX_FEED 0
+    #define ONEWIRE_SENSOR_INDEX_RETURN 1
+    #define ONEWIRE_SENSOR_INDEX_OUT 2
+
     #define ENABLE_LCD_I2C
     #define ENABLE_INPUT_BUTTONS
     #define ENABLE_I2C_PORTEXPANDER
-    #undef DISPLAY_USE_MINIMAL_LAYOUT
+    
 
     #ifdef DEBUGMODE
         #define HEATCONTROL_TESTMODE_MINUTES 2