/* clang-format off */
  
static const char html_confSens_script[] PROGMEM = R"=====(
  function transmit(f) {
    if (!xhttp) {   
    reqTime = 0;
    reqFin = false;
    //updCbxVal(g('togTHdisp'));
    xhttp = new XMLHttpRequest();
    xhttp.timeout = 1000;
    xhttp.overrideMimeType('application/json');
    xhttp.open('POST', 'confDataSens');
    xhttp.send(f ? (new FormData(f)) : '');
    xhttp.onreadystatechange = function () {
      if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
        var data = JSON.parse(xhttp.responseText);
        selectElement(g('assignSens_0'), data.assignSens_0);
        selectElement(g('assignSens_1'), data.assignSens_1);
        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;
        //setCbx(g('togTHdisp'), data.togTHdisp);
        xhttp = null;
        reqFin = true;
       }
       else {
         if(!reqFin && reqTime > 10) {
           xhttp = null;
           reqFin = true;
         }
       }
     }
   }
    return false;
  }
  //transmit();
  function saveConf() {
    //updCbxVal(g('togTHdisp'));
    g('frmConf').submit();
  }
  function init() {
    transmit();
  }
)====="; // html_confSens_script

static const char html_confSens_body_start[] PROGMEM = R"=====(
<b>Configuration - Sensors</b>
<div class='config'>
<form id='frmConf' action='setConfSens' method='POST'>
<br>
<fieldset>
<legend>Intervals</legend>
<p><b>Measurement Interval [s]</b><br><input type='number' name='measInt' id='measInt'></p>
</fieldset>
)=====";

#ifdef ENABLE_SENSORS_ONEWIRE
static const char html_confSens_oneWire_start[] PROGMEM = R"=====(
<div></div><br>
<div></div><br>
<fieldset>
<legend>OneWire Temperature Sensors</legend>
<table>
<tr><th>#</th><th>Address</th><th>T [°C]</th><th>Assign to</th></tr>
)=====";

static const char html_confSens_oneWire_AssignSelector_options[] PROGMEM = R"=====(
  <option value="255">-</option>
  <option value="0">Feed</option>
  <option value="1">Return</option>
  <option value="2">Outside</option>
)=====";

static const char html_confSens_oneWire_end[] PROGMEM = R"=====(
</table>
</fieldset>
<div></div><br>
)=====";
#endif


#ifdef ENABLE_SENSOR_DHT22
static const char html_confSens_dht[] PROGMEM = R"=====(
<div></div><br>
<fieldset>
<legend>DHT Temperature Sensors</legend>
<p><b>Measured Temp Correction [°C] *</b><br><input type='text' name='DHT_tempCorr' id='DHT_tempCorr'></p>
<p><b>Measured Hum Correction [%] *</b><br><input type='text' name='DHT_humCorr' id='DHT_humCorr'></p>
<p class='n'>* added to the measured values. <br>Can be negative and/or fractions. <br>Use if measurements deviate from a calibrated sensor.</p><br>
</fieldset>
)=====";
#endif


static const char html_confSens_body_end[] PROGMEM = R"=====(

<div></div><br>
</form>
<div></div>
<table style='width:100%'>
<td style='width:50%'><button onclick='location="conf";' class='bgrey'>Cancel</button></td>
<td style='width:50%'><button onclick='return saveConf()' class='bred'>Save</button></td>
</tr></table>
</div>
)====="; // html_confSens_body
