diff --git a/systemd/tunel-janus.service b/systemd/tunel-janus.service index 33cfa0d..01d9f80 100644 --- a/systemd/tunel-janus.service +++ b/systemd/tunel-janus.service @@ -7,7 +7,8 @@ After=network.target User=g1smo RemainAfterExit=yes EnvironmentFile=/etc/default/galbot -ExecStart=/usr/bin/ssh -nNT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 8188:localhost:8188 ${REMOTEUSER}@${REMOTEHOST} +#ExecStart=/usr/bin/ssh -nNT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 8188:localhost:8188 ${REMOTEUSER}@${REMOTEHOST} +ExecStart=/usr/bin/ssh -nNT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 8088:localhost:8088 ${REMOTEUSER}@${REMOTEHOST} RestartSec=5 Restart=always diff --git a/tasmota/autoexec.be b/tasmota/autoexec.be index 77c0116..b649c89 100644 --- a/tasmota/autoexec.be +++ b/tasmota/autoexec.be @@ -1,3 +1,14 @@ +# Kompenzacija propelerjev +kompenzacija = 0.5 + +# Kako dolgo cakam med ukazi (ms)? +cakaj = 3000 + +# Kako pogosto grem kar ravno (ms)? +kar_naprej_cas = 10000 + +zadnji = 0 + def ugasni_levo() tasmota.set_power(0, false) end @@ -6,18 +17,34 @@ def ugasni_desno() tasmota.set_power(1, false) end +def posodobi_zadnji(cas) + zadnji = tasmota.millis() + cas + kar_naprej() +end + # payload = kako dolgo naj bo vklopljen, v milisekundah def pojdi_levo(cmd, idx, payload, payload_json) - print("payload!") - print(payload) + if zadnji > tasmota.millis() + cakaj end + tasmota.set_power(0, true) - tasmota.set_timer(int(payload), ugasni_levo) + + var cas = int(int(payload) * kompenzacija) + tasmota.set_timer(cas, ugasni_levo) + + posodobi_zadnji(cas) + kar_naprej() end # payload = kako dolgo naj bo vklopljen, v milisekundah def pojdi_desno(cmd, idx, payload, payload_json) + if zadnji > tasmota.millis() + cakaj end + tasmota.set_power(1, true) - tasmota.set_timer(int(payload), ugasni_desno) + + var cas = int(payload) + tasmota.set_timer(cas, ugasni_desno) + + posodobi_zadnji(cas) end def ugasni_vse() @@ -27,9 +54,27 @@ end # payload = kako dolgo naj bo vklopljen, v milisekundah def pojdi_ravno(cmd, idx, payload, payload_json) + if zadnji > tasmota.millis() + cakaj end + tasmota.set_power(0, true) tasmota.set_power(1, true) - tasmota.set_timer(int(payload), ugasni_vse) + + #tasmota.set_timer(int(payload), ugasni_vse) + # Kompenziramo razliko v motorjih + var cas = int(payload) + tasmota.set_timer(int(cas * kompenzacija), ugasni_levo) + tasmota.set_timer(cas, ugasni_desno) + + posodobi_zadnji(cas) +end + +def auto_naprej() + pojdi_ravno(nil, nil, 1000) + tasmota.set_timer(kar_naprej_cas, auto_naprej, "auto_naprej") +end + +def kar_naprej() + tasmota.set_timer(kar_naprej_cas, auto_naprej, "auto_naprej") end tasmota.add_cmd('PojdiLevo', pojdi_levo) diff --git a/www/favicon.ico b/www/favicon.ico index ccbf5bf..73fb976 100644 Binary files a/www/favicon.ico and b/www/favicon.ico differ diff --git a/www/js/streaming.js b/www/js/streaming.js index 9bc5092..0c8f428 100644 --- a/www/js/streaming.js +++ b/www/js/streaming.js @@ -44,6 +44,28 @@ window.addEventListener('DOMContentLoaded', function () { }); } + + function gremoLevo() { + console.log('GREMO LEVO!'); + window.peljiLevo(); + onemogociGumbe(); + omogociGumbe(DOLZINA + PAVZA); + } + function gremoRavno() { + console.log('GREMO RAVNO!'); + window.peljiRavno(); + + onemogociGumbe(); + omogociGumbe(DOLZINA + PAVZA); + } + function gremoDesno() { + console.log('GREMO DESNO!'); + window.peljiDesno(); + + onemogociGumbe(); + omogociGumbe(DOLZINA + PAVZA); + } + // Initialize the library (all console debuggers enabled) Janus.init({debug: "all", callback: function() { // Make sure the browser supports WebRTC @@ -92,31 +114,13 @@ window.addEventListener('DOMContentLoaded', function () { Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now"); if (on) { // Gumbi levo in desno - gLevo.addEventListener('click', function () { - console.log('GREMO LEVO!'); - window.peljiLevo(); - - onemogociGumbe(); - omogociGumbe(DOLZINA + PAVZA); - }); - gDesno.addEventListener('click', function () { - console.log('GREMO DESNO!'); - window.peljiDesno(); - - onemogociGumbe(); - omogociGumbe(DOLZINA + PAVZA); - }); - gRavno.addEventListener('click', function () { - console.log('GREMO RAVNO!'); - window.peljiRavno(); - - onemogociGumbe(); - omogociGumbe(DOLZINA + PAVZA); - }); + gLevo.addEventListener('click', gremoLevo); + gDesno.addEventListener('click', gremoDesno); + gRavno.addEventListener('click', gremoRavno); } else { - gLevo.removeEventListener('click'); - gDesno.removeEventListener('click'); - gRavno.removeEventListener('click'); + gLevo.removeEventListener('click', gremoLevo); + gDesno.removeEventListener('click', gremoDesno); + gRavno.removeEventListener('click', gremoRavno); } }, slowLink: function(uplink, lost, mid) {