summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-09 15:24:15 +0300
committerDevaev Maxim <[email protected]>2020-09-09 15:24:15 +0300
commit2d44539484c56c6300a582ea026728442d9bc618 (patch)
treebd1ec5d61e313969583bb69f65b0e74ee03dd1c3
parent1901af17c394ac5cd74eff78d976c7af4a9dc80e (diff)
prefer sync api
-rw-r--r--kvmd/apps/kvmd/ugpio.py2
-rw-r--r--testenv/v2-hdmi-rpi4.override.yaml3
-rw-r--r--web/share/js/kvm/gpio.js7
3 files changed, 8 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py
index cc394c95..e2cd2116 100644
--- a/kvmd/apps/kvmd/ugpio.py
+++ b/kvmd/apps/kvmd/ugpio.py
@@ -135,7 +135,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
return {
"switch": self.__switch,
"pulse": {
- "delay": self.__pulse_delay,
+ "delay": min(max(self.__pulse_delay, self.__min_pulse_delay), self.__max_pulse_delay),
"min_delay": (self.__min_pulse_delay if self.__pulse_delay else 0),
"max_delay": (self.__max_pulse_delay if self.__pulse_delay else 0),
},
diff --git a/testenv/v2-hdmi-rpi4.override.yaml b/testenv/v2-hdmi-rpi4.override.yaml
index f6450355..20d1f746 100644
--- a/testenv/v2-hdmi-rpi4.override.yaml
+++ b/testenv/v2-hdmi-rpi4.override.yaml
@@ -73,6 +73,9 @@ kvmd:
mode: output
initial: null
driver: relay
+ pulse:
+ delay: 2
+ max_delay: 5
view:
table:
diff --git a/web/share/js/kvm/gpio.js b/web/share/js/kvm/gpio.js
index cbbe219b..4044e458 100644
--- a/web/share/js/kvm/gpio.js
+++ b/web/share/js/kvm/gpio.js
@@ -99,7 +99,8 @@ export function Gpio() {
tools.setOnClick($(`gpio-switch-${channel}`), () => __switchChannel(channel));
}
for (let channel of buttons) {
- tools.setOnClick($(`gpio-button-${channel}`), () => __pulseChannel(channel));
+ let wait = (model.scheme.outputs[channel].pulse.delay <= 1);
+ tools.setOnClick($(`gpio-button-${channel}`), () => __pulseChannel(channel, wait));
}
self.setState(__state);
@@ -149,8 +150,8 @@ export function Gpio() {
__sendPost(`/api/gpio/switch?channel=${channel}&state=${to}`);
};
- var __pulseChannel = function(channel) {
- __sendPost(`/api/gpio/pulse?channel=${channel}`);
+ var __pulseChannel = function(channel, wait) {
+ __sendPost(`/api/gpio/pulse?channel=${channel}&wait=${wait ? "1" : "0"}`);
};
var __sendPost = function(url) {