From a8226b95b201f88d90fde8e7500deb4733df7327 Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <dos@dosowisko.net>
Date: Thu, 23 Nov 2023 23:20:15 +0100
Subject: [PATCH] py,st3m: Pressable: Fix "flickering" of .down property with
 repeat enabled

.down property was returning True only if the pressable was in DOWN state.
This leads to glitches, as because of key repeat it also goes through
REPEATED state while the pressable is being held, going against the
documented behavior. Fix this by considering both DOWN and REPEATED
states when evaluating the property.
---
 python_payload/st3m/input.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python_payload/st3m/input.py b/python_payload/st3m/input.py
index af3723a8ea..138e3f98f9 100644
--- a/python_payload/st3m/input.py
+++ b/python_payload/st3m/input.py
@@ -252,7 +252,7 @@ class Pressable:
         """
         True if the button is held down, after first being pressed.
         """
-        return self.state == self.DOWN
+        return self.state in (self.DOWN, self.REPEATED)
 
     @property
     def up(self) -> bool:
-- 
GitLab