This commit is contained in:
2026-01-27 21:46:12 -06:00
parent 31dede537c
commit 796c7ca40b
4 changed files with 65 additions and 22 deletions

View File

@@ -240,8 +240,29 @@ class RealSerialStream:
start_cmd = {"cmd": "start"}
self._send_json(start_cmd)
self.state = ConnectionState.STREAMING
self.state = ConnectionState.STREAMING
print(f"[SERIAL] Started streaming")
def start_predict(self) -> None:
"""
@brief Start on-device prediction (Edge Inference).
Sends 'start_predict' command. Device enters PREDICTING state.
Stream receives JSON telemetry instead of raw CSV.
"""
if self.state != ConnectionState.CONNECTED:
raise RuntimeError(
f"Cannot start prediction from state {self.state.name}. "
"Must call connect() first."
)
self.serial.reset_input_buffer()
cmd = {"cmd": "start_predict"}
self._send_json(cmd)
self.state = ConnectionState.STREAMING # Treat as streaming for readline purposes
print(f"[SERIAL] Started prediction mode")
def stop(self) -> None:
"""
@brief Stop streaming EMG data.