Razni popravki, FW izboljsave (sam naprej, prepreci naenkrat)

sbc
Jure Podgorše 2023-06-06 05:19:51 +02:00
parent 966a5f9f85
commit c3f55bd9ff
4 changed files with 80 additions and 30 deletions

View File

@ -7,7 +7,8 @@ After=network.target
User=g1smo User=g1smo
RemainAfterExit=yes RemainAfterExit=yes
EnvironmentFile=/etc/default/galbot 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 RestartSec=5
Restart=always Restart=always

View File

@ -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() def ugasni_levo()
tasmota.set_power(0, false) tasmota.set_power(0, false)
end end
@ -6,18 +17,34 @@ def ugasni_desno()
tasmota.set_power(1, false) tasmota.set_power(1, false)
end end
def posodobi_zadnji(cas)
zadnji = tasmota.millis() + cas
kar_naprej()
end
# payload = kako dolgo naj bo vklopljen, v milisekundah # payload = kako dolgo naj bo vklopljen, v milisekundah
def pojdi_levo(cmd, idx, payload, payload_json) def pojdi_levo(cmd, idx, payload, payload_json)
print("payload!") if zadnji > tasmota.millis() + cakaj end
print(payload)
tasmota.set_power(0, true) 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 end
# payload = kako dolgo naj bo vklopljen, v milisekundah # payload = kako dolgo naj bo vklopljen, v milisekundah
def pojdi_desno(cmd, idx, payload, payload_json) def pojdi_desno(cmd, idx, payload, payload_json)
if zadnji > tasmota.millis() + cakaj end
tasmota.set_power(1, true) 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 end
def ugasni_vse() def ugasni_vse()
@ -27,9 +54,27 @@ end
# payload = kako dolgo naj bo vklopljen, v milisekundah # payload = kako dolgo naj bo vklopljen, v milisekundah
def pojdi_ravno(cmd, idx, payload, payload_json) def pojdi_ravno(cmd, idx, payload, payload_json)
if zadnji > tasmota.millis() + cakaj end
tasmota.set_power(0, true) tasmota.set_power(0, true)
tasmota.set_power(1, 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 end
tasmota.add_cmd('PojdiLevo', pojdi_levo) tasmota.add_cmd('PojdiLevo', pojdi_levo)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -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) // Initialize the library (all console debuggers enabled)
Janus.init({debug: "all", callback: function() { Janus.init({debug: "all", callback: function() {
// Make sure the browser supports WebRTC // 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"); Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now");
if (on) { if (on) {
// Gumbi levo in desno // Gumbi levo in desno
gLevo.addEventListener('click', function () { gLevo.addEventListener('click', gremoLevo);
console.log('GREMO LEVO!'); gDesno.addEventListener('click', gremoDesno);
window.peljiLevo(); gRavno.addEventListener('click', gremoRavno);
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);
});
} else { } else {
gLevo.removeEventListener('click'); gLevo.removeEventListener('click', gremoLevo);
gDesno.removeEventListener('click'); gDesno.removeEventListener('click', gremoDesno);
gRavno.removeEventListener('click'); gRavno.removeEventListener('click', gremoRavno);
} }
}, },
slowLink: function(uplink, lost, mid) { slowLink: function(uplink, lost, mid) {