html_confSens.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* clang-format off */
  2. static const char html_confSens_script[] PROGMEM = R"=====(
  3. function transmit(f) {
  4. if (!xhttp) {
  5. reqTime = 0;
  6. reqFin = false;
  7. updCbxVal(g('DHT_enable'));
  8. xhttp = new XMLHttpRequest();
  9. xhttp.timeout = 1000;
  10. xhttp.overrideMimeType('application/json');
  11. xhttp.open('POST', 'confDataSens');
  12. xhttp.send(f ? (new FormData(f)) : '');
  13. xhttp.onreadystatechange = function () {
  14. if (xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
  15. var data = JSON.parse(xhttp.responseText);
  16. selectElement(g('assignSens_0'), data.assignSens_0);
  17. selectElement(g('assignSens_1'), data.assignSens_1);
  18. selectElement(g('assignSens_2'), data.assignSens_2);
  19. g('measInt').value = data.measInt;
  20. g('DHT_tempCorr').value = data.DHT_tempCorr;
  21. g('DHT_humCorr').value = data.DHT_tempCorr;
  22. setCbx(g('DHT_enable'), data.DHT_enable);
  23. xhttp = null;
  24. reqFin = true;
  25. }
  26. else {
  27. if(!reqFin && reqTime > 10) {
  28. xhttp = null;
  29. reqFin = true;
  30. }
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. //transmit();
  37. function saveConf() {
  38. updCbxVal(g('DHT_enable'));
  39. g('frmConf').submit();
  40. }
  41. function init() {
  42. transmit();
  43. }
  44. )====="; // html_confSens_script
  45. static const char html_confSens_body_start[] PROGMEM = R"=====(
  46. <b>Configuration - Sensors</b>
  47. <div class='config'>
  48. <form id='frmConf' action='setConfSens' method='POST'>
  49. <br>
  50. <fieldset>
  51. <legend>Intervals</legend>
  52. <p><b>Measurement Interval [s]</b><br><input type='number' name='measInt' id='measInt'></p>
  53. </fieldset>
  54. )=====";
  55. #ifdef ENABLE_SENSORS_ONEWIRE
  56. static const char html_confSens_oneWire_start[] PROGMEM = R"=====(
  57. <div></div><br>
  58. <div></div><br>
  59. <fieldset>
  60. <legend>OneWire Temperature Sensors</legend>
  61. <table>
  62. <tr><th>#</th><th>Address</th><th>T [°C]</th><th>Assign to</th></tr>
  63. )=====";
  64. static const char html_confSens_oneWire_AssignSelector_options[] PROGMEM = R"=====(
  65. <option value="255">-</option>
  66. <option value="0">Feed</option>
  67. <option value="1">Return</option>
  68. <option value="2">Outside</option>
  69. )=====";
  70. static const char html_confSens_oneWire_end[] PROGMEM = R"=====(
  71. </table>
  72. </fieldset>
  73. <div></div><br>
  74. )=====";
  75. #endif
  76. #ifdef ENABLE_SENSOR_DHT22
  77. static const char html_confSens_dht[] PROGMEM = R"=====(
  78. <div></div><br>
  79. <fieldset>
  80. <legend>DHT Temperature Sensors</legend>
  81. <p><b>Enable DHT Sensor</b>&nbsp;<input type='checkbox' name='DHT_enable' id='DHT_enable'></p>
  82. <p><b>Measured Temp Correction [°C] *</b><br><input type='text' name='DHT_tempCorr' id='DHT_tempCorr'></p>
  83. <p><b>Measured Hum Correction [%] *</b><br><input type='text' name='DHT_humCorr' id='DHT_humCorr'></p>
  84. <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>
  85. </fieldset>
  86. )=====";
  87. #endif
  88. static const char html_confSens_body_end[] PROGMEM = R"=====(
  89. <div></div><br>
  90. </form>
  91. <div></div>
  92. <table style='width:100%'>
  93. <td style='width:50%'><button onclick='location="conf";' class='bgrey'>Cancel</button></td>
  94. <td style='width:50%'><button onclick='return saveConf()' class='bred'>Save</button></td>
  95. </tr></table>
  96. </div>
  97. )====="; // html_confSens_body