Skip to content

Commit a805030

Browse files
committed
fixes keypad driver, a better way
1 parent 0202aa0 commit a805030

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

api_drivers/py_api_drivers/frozen/indev/keypad_framework.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,13 @@ def _read(self, drv, data): # NOQA
5353
key = self._get_key()
5454

5555
if key is None: # ignore no key
56-
if self._current_state != lv.INDEV_STATE.RELEASED: # NOQA
57-
self._current_state = lv.INDEV_STATE.RELEASED # NOQA
58-
59-
data.key = self._last_key
60-
data.state = self._current_state
61-
return
62-
63-
state, key = key
64-
self._last_key = key
65-
self._current_state = state
56+
state = self.RELEASED
57+
key = self._last_key
58+
else:
59+
state, key = key
6660

67-
data.key = self._last_key
68-
data.state = self._current_state
61+
data.key = self._last_key = key
62+
data.state = self._current_state = state
6963

7064
def get_type(self):
7165
return self._indev_drv.get_type() # NOQA

0 commit comments

Comments
 (0)