summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/kvmd/__init__.py5
-rw-r--r--kvmd/kvmd/streamer.py10
-rw-r--r--os/platforms/v1/kvmd.yaml2
3 files changed, 12 insertions, 5 deletions
diff --git a/kvmd/kvmd/__init__.py b/kvmd/kvmd/__init__.py
index 3633c479..7dfa1349 100644
--- a/kvmd/kvmd/__init__.py
+++ b/kvmd/kvmd/__init__.py
@@ -41,9 +41,10 @@ def main() -> None:
)
streamer = Streamer(
- cap_power=int(config["streamer"]["pinout"]["cap"]),
- conv_power=int(config["streamer"]["pinout"]["conv"]),
+ cap_power=int(config["streamer"]["pinout"].get("cap", -1)),
+ conv_power=int(config["streamer"]["pinout"].get("conv", -1)),
sync_delay=float(config["streamer"]["sync_delay"]),
+ init_delay=float(config["streamer"]["init_delay"]),
width=int(config["streamer"]["size"]["width"]),
height=int(config["streamer"]["size"]["height"]),
cmd=list(map(str, config["streamer"]["cmd"])),
diff --git a/kvmd/kvmd/streamer.py b/kvmd/kvmd/streamer.py
index 089d79e1..f77b5f9d 100644
--- a/kvmd/kvmd/streamer.py
+++ b/kvmd/kvmd/streamer.py
@@ -17,6 +17,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
cap_power: int,
conv_power: int,
sync_delay: float,
+ init_delay: float,
width: int,
height: int,
cmd: List[str],
@@ -25,9 +26,10 @@ class Streamer: # pylint: disable=too-many-instance-attributes
assert cmd, cmd
- self.__cap_power = gpio.set_output(cap_power)
+ self.__cap_power = (gpio.set_output(cap_power) if cap_power > 0 else cap_power)
self.__conv_power = (gpio.set_output(conv_power) if conv_power > 0 else conv_power)
self.__sync_delay = sync_delay
+ self.__init_delay = init_delay
self.__width = width
self.__height = height
self.__cmd = [part.format(width=width, height=height) for part in cmd]
@@ -68,12 +70,14 @@ class Streamer: # pylint: disable=too-many-instance-attributes
async def __set_hw_enabled(self, enabled: bool) -> None:
# XXX: This sequence is very important to enable converter and cap board
- gpio.write(self.__cap_power, enabled)
+ if self.__cap_power > 0:
+ gpio.write(self.__cap_power, enabled)
if self.__conv_power > 0:
if enabled:
await asyncio.sleep(self.__sync_delay)
gpio.write(self.__conv_power, enabled)
- await asyncio.sleep(self.__sync_delay)
+ if enabled:
+ await asyncio.sleep(self.__init_delay)
async def __process(self) -> None:
logger = get_logger(0)
diff --git a/os/platforms/v1/kvmd.yaml b/os/platforms/v1/kvmd.yaml
index fcebb3b0..3f2e8751 100644
--- a/os/platforms/v1/kvmd.yaml
+++ b/os/platforms/v1/kvmd.yaml
@@ -34,7 +34,9 @@ kvmd:
pinout:
cap: 21
conv: 25
+
sync_delay: 1.0
+ init_delay: 1.0
shutdown_delay: 10.0
size: