problemas de sincronismo

parent f65e7b16
Showing with 16 additions and 2 deletions
...@@ -71,6 +71,16 @@ socket.on('actualizarEstado', function(data) { ...@@ -71,6 +71,16 @@ socket.on('actualizarEstado', function(data) {
}); });
socket.on('bloquearBotones', function(data) {
document.getElementById('abrir').disabled = true;
document.getElementById('cerrar').disabled = true;
});
socket.on('desbloquearBotones', function(data) {
document.getElementById('abrir').disabled = false;
document.getElementById('cerrar').disabled = false;
});
/* /*
Lee los parametros GET si existen para abrir o cerrar directamente, sin boton Lee los parametros GET si existen para abrir o cerrar directamente, sin boton
*/ */
......
...@@ -63,7 +63,7 @@ setInterval(function () { ...@@ -63,7 +63,7 @@ setInterval(function () {
// Abrir puerta // Abrir puerta
function abrirPuerta(){ function abrirPuerta(){
socket.broadcast.emit("bloquearBotones", Number(estadoPuerta));
RED.pwmWrite(0); RED.pwmWrite(0);
GREEN.pwmWrite(255); GREEN.pwmWrite(255);
...@@ -80,11 +80,13 @@ function abrirPuerta(){ ...@@ -80,11 +80,13 @@ function abrirPuerta(){
} }
}, 100); }, 100);
socket.broadcast.emit("desbloquearBotones", Number(estadoPuerta));
} }
// Cerrar puerta // Cerrar puerta
function cerrarPuerta(){ function cerrarPuerta(){
socket.broadcast.emit("bloquearBotones", Number(estadoPuerta));
GREEN.pwmWrite(0); GREEN.pwmWrite(0);
RED.pwmWrite(255); RED.pwmWrite(255);
...@@ -106,6 +108,8 @@ function cerrarPuerta(){ ...@@ -106,6 +108,8 @@ function cerrarPuerta(){
} }
}, 100); }, 100);
socket.broadcast.emit("desbloquearBotones", Number(estadoPuerta));
} }
// Clean LEDs // Clean LEDs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment