firmware - add some javascript to soilmoisture sensor select
This commit is contained in:
parent
3795569b07
commit
8218de11b1
5 changed files with 51 additions and 18 deletions
|
@ -29,14 +29,14 @@ long_line_column=72
|
|||
|
||||
[files]
|
||||
current_page=1
|
||||
FILE_NAME_0=0;Arduino;0;EUTF-8;0;1;0;.%2FCanGrow.ino;0;2
|
||||
FILE_NAME_1=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_HTML.h;0;2
|
||||
FILE_NAME_2=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_Init.h;0;2
|
||||
FILE_NAME_0=2265;Arduino;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow.ino;0;2
|
||||
FILE_NAME_1=14609;C++;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow_HTML.h;0;2
|
||||
FILE_NAME_2=2884;C++;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow_Init.h;0;2
|
||||
FILE_NAME_3=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_Logo.h;0;2
|
||||
FILE_NAME_4=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_PinAssignments.h;0;2
|
||||
FILE_NAME_5=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_Sensors.h;0;2
|
||||
FILE_NAME_6=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_SysFunctions.h;0;2
|
||||
FILE_NAME_7=0;C++;0;EUTF-8;0;1;0;.%2FCanGrow_WebFunctions.h;0;2
|
||||
FILE_NAME_5=4277;C++;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow_Sensors.h;0;2
|
||||
FILE_NAME_6=4737;C++;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow_SysFunctions.h;0;2
|
||||
FILE_NAME_7=27858;C++;0;EUTF-8;0;1;0;%2Fhome%2Fmarcus%2Fdistrobox%2Fdebian-cangrow%2FCanGrow%2FArduino%2FCanGrow%2FCanGrow_WebFunctions.h;0;2
|
||||
|
||||
[build-menu]
|
||||
C++FT_00_LB=_Compile
|
||||
|
@ -54,4 +54,4 @@ C++FT_01_CM=~/.local/bin/arduino-cli --no-color compile -v -b esp8266:esp8266:d
|
|||
C++FT_01_WD=
|
||||
|
||||
[VTE]
|
||||
last_dir=~
|
||||
last_dir=/home/marcus/distrobox/debian-cangrow
|
||||
|
|
|
@ -526,3 +526,32 @@ const char HTMLsystemSubNav[] PROGMEM = R"EOF(
|
|||
<li><a href='/system/wipe' >💣 Factory reset</a></li>
|
||||
</ul>
|
||||
)EOF";
|
||||
|
||||
const char JSsoilmoistureTypeSelect[] PROGMEM = R"EOF(
|
||||
<script>
|
||||
function MoistureSensorType() {
|
||||
let selVal = document.getElementById('SelMoistureSensor_Type').value;
|
||||
let wet = document.getElementById('iSoilmoistureWet');
|
||||
let dry = document.getElementById('iSoilmoistureDry');
|
||||
switch(selVal) {
|
||||
case '1':
|
||||
wet.value = 160;
|
||||
dry.value = 360;
|
||||
console.log(selVal);
|
||||
break;
|
||||
|
||||
case '2':
|
||||
wet.value = 485;
|
||||
dry.value = 250;
|
||||
console.log(selVal);
|
||||
break;
|
||||
|
||||
default:
|
||||
wet.value = 0;
|
||||
dry.value = 0;
|
||||
console.log(selVal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
)EOF";
|
||||
|
|
|
@ -108,9 +108,9 @@ bool loadEEPROM() {
|
|||
* 241 PumpIntervalVeg (1 byte)
|
||||
* 242 PumpIntervalBloom (1 byte)
|
||||
* 243 OutputInvert (1 byte)
|
||||
* 244 SoilmoistureWet (1 byte)
|
||||
* 245 SoilmoistureDry (1 byte)
|
||||
* 246 ...
|
||||
* 244 SoilmoistureWet (2 byte)
|
||||
* 246 SoilmoistureDry (2 byte)
|
||||
* 248 ...
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -181,7 +181,7 @@ bool loadEEPROM() {
|
|||
// size is 1 byte
|
||||
EEPROM.get(244, SoilmoistureWet);
|
||||
// size is 1 byte
|
||||
EEPROM.get(245, SoilmoistureDry);
|
||||
EEPROM.get(246, SoilmoistureDry);
|
||||
}
|
||||
// TODO auth does not work atm
|
||||
// EEPROM.get(160, WebUiUsername);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* CanGrow_Version.h gets generated from cangrow.sh */
|
||||
|
||||
const char* CanGrowVer = "0.1-dev";
|
||||
const char* CanGrowBuild = "65e6989-20241205031950";
|
||||
const char* CanGrowBuild = "3795569-20241205035049";
|
||||
|
||||
|
|
|
@ -623,10 +623,9 @@ void WEBsystemSettings() {
|
|||
body += "Pump ON time: <input class='inputShort' type='number' name='PumpOnTime' min='0' max='255' value='";
|
||||
body += PumpOnTime;
|
||||
body += "' required> Seconds<br>\n";
|
||||
|
||||
|
||||
|
||||
// MoistureSensor_Type byte
|
||||
body += "Soilmoisture sensor: <select id='MoistureSensor_Type' name='MoistureSensor_Type' required>\n";
|
||||
body += "Soilmoisture sensor: <select id='SelMoistureSensor_Type' name='MoistureSensor_Type' onchange='MoistureSensorType();' required>\n";
|
||||
if(configured == false) {
|
||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||
}
|
||||
|
@ -640,18 +639,23 @@ void WEBsystemSettings() {
|
|||
body += "' required> %<br>\n";
|
||||
|
||||
// SoilmoistureWet byte
|
||||
body += "Soilmoisture wet: <input class='inputShort' type='number' name='SoilmoistureWet' min='0' value='";
|
||||
body += "Soilmoisture wet: <input type='number' id='iSoilmoistureWet' name='SoilmoistureWet' min='0' value='";
|
||||
body += SoilmoistureWet;
|
||||
body += "' required>\n";
|
||||
body += "<p class='helpbox'><b>Analog capacitive:</b> <i>160</i><br> \
|
||||
<b>I2C Chirp:</b> <i>485</i></p>";
|
||||
|
||||
// SoilmoistureDry byte
|
||||
body += "Soilmoisture dry: <input class='inputShort' type='number' name='SoilmoistureDry' min='0' value='";
|
||||
body += "Soilmoisture dry: <input type='number' id='iSoilmoistureDry' name='SoilmoistureDry' min='0' value='";
|
||||
body += SoilmoistureDry;
|
||||
body += "' required>\n";
|
||||
body += "<p class='helpbox'><b>Analog capacitive:</b> <i>360</i><br> \
|
||||
<b>I2C Chirp:</b> <i>250</i></p>";
|
||||
|
||||
|
||||
// MoistureSensor_Type Javascript
|
||||
body += FPSTR(JSsoilmoistureTypeSelect);
|
||||
|
||||
|
||||
// TemperatureSensor_Type byte
|
||||
body += "Temperature sensor: <select id='TemperatureSensor_Type' name='TemperatureSensor_Type' required>\n";
|
||||
|
@ -890,7 +894,7 @@ void POSTsystemSettings() {
|
|||
EEPROM.put(221, Esp32CamIP);
|
||||
EEPROM.put(243, OutputInvert);
|
||||
EEPROM.put(244, SoilmoistureWet);
|
||||
EEPROM.put(245, SoilmoistureDry);
|
||||
EEPROM.put(246, SoilmoistureDry);
|
||||
|
||||
// write data to EEPROM
|
||||
EEPROM.commit();
|
||||
|
|
Loading…
Reference in a new issue