From b8aebffe4efad9d65f14dd21f903a9e008257728 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 10 Apr 2024 09:38:51 +0200 Subject: update cctv backend code --- ui/index.html | 33 +++++++++++++++++++-------------- ui/js/api.js | 12 +++++++----- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/ui/index.html b/ui/index.html index ac379f7..2af3cd2 100644 --- a/ui/index.html +++ b/ui/index.html @@ -38,20 +38,6 @@ -
  • - CCTV -
    - - - - - - - - - -
    -
  • Slagboom
    @@ -90,12 +76,31 @@
    +
    + CCTV Presets +
    + Huidige preset: ?? +
    +
    + + + + + + + + + +
    +
    +
    WebSocket Demo
    +
    diff --git a/ui/js/api.js b/ui/js/api.js index d8c527b..647cbd6 100644 --- a/ui/js/api.js +++ b/ui/js/api.js @@ -27,7 +27,9 @@ const api = { }, matrix: state => document.getElementById("matrixValue").value = state, photocell: on => setPolkaDot(document.getElementById("photocellValue"), on), - cctv: on => setPolkaDot(document.getElementById("cctvValue"), on), + cctv: preset => { + document.getElementById("cctvPresetValue").innerText = preset; + }, carSpeed: speed => { for (let i = 0; i < 4; i++) document.getElementById(`zone${i+1}SpeedValue`).innerText = speed[i]; @@ -96,9 +98,9 @@ const api = { api.update.photocell(on); }, cctv: el => { - var on = el.value == "true"; - send({ type: 'cctv', on }); - api.update.cctv(on); + var preset = el.value; + send({ type: 'cctv', preset }); + api.update.cctv(preset); }, sos: el => { var statusSOS = el.value == "true"; @@ -117,7 +119,7 @@ const api = { lights: msg => api.update.lights(msg.value), matrix: msg => api.update.matrix(msg.state), photocell: msg => api.update.photocell(msg.on), - cctv: msg => api.update.cctv(msg.on), + cctv: msg => api.update.cctv(msg.preset), autoPerZone: msg => api.update.carCount(msg.autos), sosBericht: msg => api.update.notifications(msg), lfvReady: msg => api.update.lfvReady(msg), -- cgit v1.2.3