fix(emulator): better constant names

This commit is contained in:
Laureηt 2021-11-02 19:15:58 +01:00
parent 75a853df6a
commit 9270b4a09a
No known key found for this signature in database
GPG key ID: D88C6B294FD40994

View file

@ -14,7 +14,8 @@ WIDTH = 240
HEIGHT = 160 HEIGHT = 160
URI: str = "ws://127.0.0.1:6789/" URI: str = "ws://127.0.0.1:6789/"
FPS: int = 60 FPS: int = 60
HZ: int = FPS // 10 HZ: int = 10
POLLING_RATE: int = FPS // HZ
KEYMAP: dict[str, int] = { KEYMAP: dict[str, int] = {
"a": 0, "a": 0,
"b": 1, "b": 1,
@ -45,7 +46,7 @@ async def main():
await websocket.send('{"auth":"password"}') await websocket.send('{"auth":"password"}')
logging.debug(f"connected to: {websocket}") logging.debug(f"connected to: {websocket}")
while True: while True:
if not (core.frame_counter % HZ): if not (core.frame_counter % POLLING_RATE):
core.clear_keys(*KEYMAP.values()) core.clear_keys(*KEYMAP.values())
await websocket.send('{"emu":"get"}') await websocket.send('{"emu":"get"}')