Optimized template

This commit is contained in:
Kevin Veen-Birkenbach 2020-05-11 14:37:53 +02:00
parent cb3644b514
commit 022ebabe67
3 changed files with 41 additions and 61 deletions

View File

@ -24,6 +24,7 @@ The following links can be helpful for maintaining this code and understanding t
##### Transistor
- https://www.elektronik-kompendium.de/sites/bau/0201291.htm
- https://components101.com/transistors/s8050-transistor-pinout-equivalent-datasheet
- https://cdn-reichelt.de/documents/datenblatt/A100/PN2222A-FSC.pdf
##### IR-Reciever
- https://www.elecrow.com/download/Infrared%20receiver%20vs1838b.pdf

View File

@ -1,5 +1,6 @@
String homepage_template(void){
return
String homepage = "";
homepage = homepage +
"<!DOCTYPE html>"
"<html>"
"<head>"
@ -16,38 +17,14 @@ return
"<h1>"+String(titel)+"</h1>"
"<p>An REST-API Arduino microcontroller, which allows you to interact with hardware and the physical environment.</p>"
"<h2>Controller <i class=\"fas fa-cogs\"></i></h2>"
"<h3>Remote Plug Controller<i class=\"fas fa-plug\"></i></h3>"
"<form method=\"get\" >"
"<form method=\"get\" >";
for(const char* parameter : parameter_list)
homepage = homepage +
"<div class=\"form-group\">"
"<label for=\""+ parameter_plug_id +"\">"+ parameter_plug_id +":</label>"
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_plug_id +"\" name=\""+ parameter_plug_id +"\">"
"</div>"
"<div class=\"form-group\">"
"<label class=\"checkbox-inline\" for=\"on\">"
"<input type=\"radio\" id=\"on\" name=\""+ parameter_plug_status +"\" value=\"1\">"
"<i class=\"fas fa-toggle-on\"></i> on"
"</label>"
"<label class=\"checkbox-inline\" for=\"off\">"
"<input type=\"radio\" id=\"off\" name=\""+ parameter_plug_status +"\" value=\"0\">"
"<i class=\"fas fa-toggle-off\"></i> off"
"</label>"
"</div>"
"<input type=\"submit\" class=\"btn btn-secondary\">"
"</form>"
"<h3>Infared Controller <i class=\"fas fa-plug\"></i></h3>"
"<form method=\"get\" >"
"<div class=\"form-group\">"
"<label for=\""+ parameter_ir_type +"\">"+ parameter_ir_type +":</label>"
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_ir_type +"\" name=\""+ parameter_ir_type +"\">"
"</div>"
"<div class=\"form-group\">"
"<label for=\""+ parameter_ir_data +"\">"+ parameter_ir_data +":</label>"
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_ir_data +"\" name=\""+ parameter_ir_data +"\">"
"</div>"
"<div class=\"form-group\">"
"<label for=\""+ parameter_ir_bits +"\">"+ parameter_ir_bits +":</label>"
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_ir_bits +"\" name=\""+ parameter_ir_bits +"\">"
"</div>"
"<label for=\""+ parameter +"\">"+ parameter +":</label>"
"<input type=\"number\" class= \"form-control\" id=\""+ parameter +"\" value=\"" + server.arg(parameter) +"\" name=\""+ parameter +"\">"
"</div>";
homepage = homepage +
"<input type=\"submit\" class=\"btn btn-secondary\">"
"</form>"
"<h2>Data <i class=\"fas fa-database\"></i></h2>"
@ -60,4 +37,5 @@ return
"</div>"
"<body>"
"<html>";
return homepage;
}

View File

@ -35,6 +35,7 @@ const char* parameter_plug_status="plug_status";
const char* parameter_ir_type="ir_type";
const char* parameter_ir_data="ir_data";
const char* parameter_ir_bits="ir_bits";
const char* parameter_list[]={parameter_plug_id,parameter_plug_status,parameter_ir_type,parameter_ir_data,parameter_ir_bits};
// Define variables
decode_results results;
@ -125,7 +126,7 @@ void setRitterSwitch(int unit, int state)
}
void setIrColor(decode_type_t type,int data, int bits) {
// irsend.send(type, data, bits);
irsend.send(type, data, bits);
Serial.print("The code \"" + String(data) + "\" with \"" + String(bits) + "\" was send in format \"" + getDecodeType(type) + "\".");
}