mirror of
https://github.com/kevinveenbirkenbach/physical-interface.git
synced 2024-11-14 14:21:04 +01:00
Implemented last recieved ir type
This commit is contained in:
parent
d67ecb4bf9
commit
cb3644b514
@ -19,7 +19,7 @@ return
|
|||||||
"<h3>Remote Plug Controller<i class=\"fas fa-plug\"></i></h3>"
|
"<h3>Remote Plug Controller<i class=\"fas fa-plug\"></i></h3>"
|
||||||
"<form method=\"get\" >"
|
"<form method=\"get\" >"
|
||||||
"<div class=\"form-group\">"
|
"<div class=\"form-group\">"
|
||||||
"<label for=\""+ parameter_plug_id +"\">Plug-ID:</label>"
|
"<label for=\""+ parameter_plug_id +"\">"+ parameter_plug_id +":</label>"
|
||||||
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_plug_id +"\" name=\""+ parameter_plug_id +"\">"
|
"<input type=\"number\" class= \"form-control\" id=\""+ parameter_plug_id +"\" name=\""+ parameter_plug_id +"\">"
|
||||||
"</div>"
|
"</div>"
|
||||||
"<div class=\"form-group\">"
|
"<div class=\"form-group\">"
|
||||||
|
@ -38,6 +38,9 @@ const char* parameter_ir_bits="ir_bits";
|
|||||||
|
|
||||||
// Define variables
|
// Define variables
|
||||||
decode_results results;
|
decode_results results;
|
||||||
|
decode_type_t last_recieved_ir_type;
|
||||||
|
int last_recieved_ir_data;
|
||||||
|
int last_recieved_ir_bits;
|
||||||
|
|
||||||
// Setup classes
|
// Setup classes
|
||||||
ESP8266WebServer server ( 80 );
|
ESP8266WebServer server ( 80 );
|
||||||
@ -80,6 +83,9 @@ String getDecodeType(decode_type_t decode_type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dump(decode_results *results) {
|
void dump(decode_results *results) {
|
||||||
|
last_recieved_ir_type = results->decode_type;
|
||||||
|
last_recieved_ir_data = results->value;
|
||||||
|
last_recieved_ir_bits = results->bits;
|
||||||
uint16_t count = results->rawlen;
|
uint16_t count = results->rawlen;
|
||||||
Serial.print(getDecodeType(results->decode_type));
|
Serial.print(getDecodeType(results->decode_type));
|
||||||
serialPrintUint64(results->value, 16);
|
serialPrintUint64(results->value, 16);
|
||||||
@ -154,8 +160,12 @@ String getJsonPir(void){
|
|||||||
return "{\"motion\":\""+String(digitalRead(pin_pir))+"\"}";
|
return "{\"motion\":\""+String(digitalRead(pin_pir))+"\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getJsonIr(void){
|
||||||
|
return "{\"last_recieved\":{\"bits\":\""+String(last_recieved_ir_bits)+"\",\"type\":\""+String(last_recieved_ir_type)+"\",\"data\":\""+String(last_recieved_ir_data)+"\"}}";
|
||||||
|
}
|
||||||
|
|
||||||
String getJson(void){
|
String getJson(void){
|
||||||
return "{\"DHT\":"+String(getJsonDht())+",\"PIR\":"+String(getJsonPir())+"}";
|
return "{\"DHT\":"+String(getJsonDht())+",\"PIR\":"+String(getJsonPir())+",\"IR\":"+String(getJsonIr())+"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "homepage_template.h"
|
#include "homepage_template.h"
|
||||||
@ -187,10 +197,8 @@ void setup(void)
|
|||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
Serial.print("Connected to :");
|
Serial.println("Connected to :" + String(ssid));
|
||||||
Serial.println(ssid);
|
Serial.println("IP address: " + WiFi.localIP());
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
server.onNotFound(handleRequest);
|
server.onNotFound(handleRequest);
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("HTTP server started.");
|
Serial.println("HTTP server started.");
|
||||||
|
Loading…
Reference in New Issue
Block a user