firmware wip - various changes, add systemsettings sub menu, cosmetic stuff
This commit is contained in:
parent
bce55a2632
commit
aae6cf071c
5 changed files with 90 additions and 14 deletions
|
@ -91,7 +91,7 @@ void setup() {
|
|||
// Write a line before doing serious output, because before there is some garbage in serial
|
||||
// whats get the cursor somewhere over the place
|
||||
Serial.println("420");
|
||||
Serial.print(".:: CanGrow v");
|
||||
Serial.print(".:: CanGrow firmware v");
|
||||
Serial.print(CanGrowVer);
|
||||
Serial.print(" build ");
|
||||
Serial.print(CanGrowBuild);
|
||||
|
|
|
@ -84,9 +84,28 @@ a:active {
|
|||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.subnav {
|
||||
text-align: center;
|
||||
display: table;
|
||||
margin: auto;
|
||||
margin-bottom: 10px;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
border-radius: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.nav li {
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
border-radius: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.subnav li {
|
||||
background: #026b45;
|
||||
list-style: none;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.nav li:first-of-type {
|
||||
|
@ -94,7 +113,7 @@ a:active {
|
|||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
.nav li a , .nav span, .button, .button:link, input[type=button], input[type=submit], input[type=reset] {
|
||||
.nav li a, .nav span, .subnav li a, .subnav span, .button, .button:link, input[type=button], input[type=submit], input[type=reset] {
|
||||
color: #ddd;
|
||||
display: block;
|
||||
font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
|
||||
|
@ -104,13 +123,13 @@ a:active {
|
|||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.nav li a:hover , .activeMenu, .button:link:hover, .button:visited:hover, input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
||||
.nav li a:hover, .subnav li a:hover, .activeMenu, .button:link:hover, .button:visited:hover, input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
||||
background: #04AA6D;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.nav li a:active {
|
||||
.nav li a:active, .subnav li a:active {
|
||||
background: #026b45;
|
||||
color: #cae0d0;
|
||||
}
|
||||
|
@ -150,6 +169,17 @@ input[type=text], input[type=date], input[type=number], input[type=password], se
|
|||
.center, .nav {
|
||||
width: 60%; min-width: 420px;
|
||||
}
|
||||
.subnav li {
|
||||
display: '';
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 640px) {
|
||||
.subnav li {
|
||||
display: inline-block;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
@ -479,5 +509,13 @@ const char HTMLupdate[] PROGMEM = R"EOF(
|
|||
<input type='file' accept='.bin,.bin.gz' name='firmware'>
|
||||
<input type='submit' value='Update Firmware' onclick="document.getElementById('divUploading').style.display = '';">
|
||||
</form>
|
||||
<div id='divUploading' style='display: none;' class='warnmsg'>Uploading, please wait...<div>
|
||||
<div id='divUploading' style='display: none;' class='warnmsg'>️ Uploading, please wait...<div>
|
||||
)EOF";
|
||||
|
||||
const char HTMLsystemSubNav[] PROGMEM = R"EOF(
|
||||
<ul class='subnav'>
|
||||
<li><a href='/system/update'>🔄 Firmware update</a></li>
|
||||
<li><a href='/system/restart' >🔁 CanGrow restart</a></li>
|
||||
<li><a href='/system/wipe' >💣 Factory reset</a></li>
|
||||
</ul>
|
||||
)EOF";
|
||||
|
|
|
@ -565,3 +565,28 @@ void displayScreens() {
|
|||
display.display();
|
||||
|
||||
}
|
||||
|
||||
|
||||
unsigned short growState() {
|
||||
/*
|
||||
* growState()
|
||||
*
|
||||
* returns growState as short
|
||||
*
|
||||
* 1 - vegetation
|
||||
* 2 - bloom
|
||||
* 3 - harvest
|
||||
*
|
||||
*/
|
||||
unsigned short state;
|
||||
|
||||
if(DayOfGrow > (DaysVeg + DaysBloom ) ) {
|
||||
state = 3;
|
||||
} else if(DayOfGrow > DaysVeg ) {
|
||||
state = 2;
|
||||
} else {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* CanGrow_Version.h gets generated from cangrow.sh */
|
||||
|
||||
const char* CanGrowVer = "0.1-dev";
|
||||
const char* CanGrowBuild = "4ad16c9";
|
||||
const char* CanGrowBuild = "bce55a2";
|
||||
|
||||
|
|
|
@ -353,15 +353,27 @@ void WEBroot() {
|
|||
body += "'></a>\n<br>\n";
|
||||
}
|
||||
|
||||
body += "Grow started: ";
|
||||
body += "<b>Grow started:</b> ";
|
||||
body += returnStrDateFromEpoch(GrowStart);
|
||||
body += "<br>\n";
|
||||
body += "Day of Grow: ";
|
||||
body += "<b>Day of Grow:</b> ";
|
||||
body += DayOfGrow;
|
||||
body += "<br>\n";
|
||||
body += "<b>Grow status:</b> ";
|
||||
switch(growState()) {
|
||||
case 1:
|
||||
body += "🌱 vegetation<br>\n";
|
||||
break;
|
||||
case 2:
|
||||
body += "🌼 bloom<br>\n";
|
||||
break;
|
||||
case 3:
|
||||
body += "🍂 harvest<br>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
if(UsePump == true) {
|
||||
body += "Pump water level: ";
|
||||
body += "<b>Pump water level:</b> ";
|
||||
switch(getWaterlevel()) {
|
||||
case 0:
|
||||
body += "<span style='color: green;'>OK</span>";
|
||||
|
@ -375,24 +387,24 @@ void WEBroot() {
|
|||
}
|
||||
}
|
||||
body += "<br>\n";
|
||||
body += "Growlight brightness: ";
|
||||
body += "<b>Growlight brightness:</b> ";
|
||||
body += ((PinLEDPWM * 100) / 255);
|
||||
body += " %<br>\n";
|
||||
body += "<form method='post' action='/switch'>\n";
|
||||
body += "MOSFET<select id='output' name='output' >\n";
|
||||
body += "<b>MOSFET:</b> <select id='output' name='output' >\n";
|
||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||
body += "<option value='1'>LED</option>\n";
|
||||
body += "<option value='2'>FAN</option>\n";
|
||||
body += "<option value='3'>PUMP</option>\n";
|
||||
body += "</select><br>";
|
||||
|
||||
body += "On/Off: <select id='state' name='state' >\n";
|
||||
body += "<b>On/Off:</b> <select id='state' name='state' >\n";
|
||||
body += "<option disabled value='' selected hidden>---</option>\n";
|
||||
body += "<option value='1'>On</option>\n";
|
||||
body += "<option value='0'>Off</option>\n";
|
||||
body += "</select><br>\n";
|
||||
|
||||
body += "Intensity: <input type='range' id='OutputPWM' name='OutputPWM' min='1' max='255' value='255'/><br>\n";
|
||||
body += "<b>Intensity:</b> <input type='range' id='OutputPWM' name='OutputPWM' min='1' max='255' value='255'/><br>\n";
|
||||
|
||||
body += "<input type='submit' value='Save'>\n";
|
||||
body += "</form><br>\n";
|
||||
|
@ -528,6 +540,7 @@ void WEBsystemSettings() {
|
|||
}
|
||||
|
||||
body += "<h2>⚙ System settings</h2>";
|
||||
body += FPSTR(HTMLsystemSubNav);
|
||||
if(webserver.hasArg("success")) {
|
||||
body += FPSTR(HTMLsuccess);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue