Code de-clutter
This commit is contained in:
parent
e82ecadbb3
commit
1e267dbdb6
4 changed files with 6 additions and 21 deletions
|
|
@ -5,20 +5,13 @@ from typing import Optional
|
|||
from ble.interface import BLEInterface, Advertisement
|
||||
from logger.logger import GiciskyLogger, LogCategory
|
||||
|
||||
# Default UUIDs for Gicisky tags
|
||||
BASE_SERVICE = 0xFEF0
|
||||
SERVICE_UUID = f"0000{BASE_SERVICE:04x}-0000-1000-8000-00805f9b34fb"
|
||||
CHAR_CMD_UUID = f"0000{BASE_SERVICE+1:04x}-0000-1000-8000-00805f9b34fb"
|
||||
CHAR_IMG_UUID = f"0000{BASE_SERVICE+2:04x}-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
# Constants
|
||||
CHUNK_SIZE = 240 # 480 hex chars (as seen in the JS uploader)
|
||||
MTU_WAIT = 0.03 # delay between chunks (adjustable)
|
||||
DEBUG = True
|
||||
|
||||
def log(msg):
|
||||
if DEBUG:
|
||||
print(f"[LOG] {msg}", flush=True)
|
||||
CHUNK_SIZE = 240
|
||||
MTU_WAIT = 0.03
|
||||
|
||||
class GiciskyProtocol:
|
||||
|
||||
|
|
@ -42,6 +35,7 @@ class GiciskyProtocol:
|
|||
self.logger.info("Starting image upload", LogCategory.DATA_TRANSFER)
|
||||
await self.send_command(3)
|
||||
elif hx.startswith("05"):
|
||||
# Image upload loop
|
||||
self.logger.debug(f"Handling response: {hx}, err: {hx[2:4]}, part: {hx[4:12]}", LogCategory.NOTIFICATION)
|
||||
err = hx[2:4]
|
||||
if err == "00": # continue sending chunks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue