PM updates, still need Battery to show up on periph screen and calibration/recalib stuff to work, but it should tomorrow

This commit is contained in:
2026-03-18 01:51:55 -05:00
parent ea0326394f
commit 80a2884077
8 changed files with 197 additions and 35 deletions

View File

@@ -233,7 +233,7 @@ class _DeviceSetupState extends State<DeviceSetup> {
bool ent = isEnterprise(network);
bool open = isOpen(network);
Map<String, String> creds = await showDialog(
Map<String, String>? creds = await showDialog(
context: context,
builder: (dialogContext) {
return StatefulBuilder(
@@ -309,6 +309,7 @@ class _DeviceSetupState extends State<DeviceSetup> {
}
);
if (creds == null) return;
if (creds["password"] == null && !open) return;
if (creds["uname"] == null && ent) return;
await transmitWiFiDetails(network["ssid"], network["auth"], creds);

View File

@@ -145,6 +145,35 @@ class _PeripheralScreenState extends State<PeripheralScreen> {
));
});
// Server emits this when the device reports its own calibration state.
// When calibrated=false, reset all calibration UI state so the
// pre-calibration screen is shown and the user can tap Calibrate.
socket?.on("calib_status_changed", (data) {
if (data is Map<String, dynamic>) {
if (data['periphID'] == widget.peripheralId) {
if (!mounted) return;
if (data['calibrated'] == false) {
setState(() {
calibrated = false;
calibrating = false;
calibrationStage = 0;
});
}
}
}
});
socket?.on("device_pos_report", (data) {
if (data is Map<String, dynamic>) {
if (data['periphID'] == widget.peripheralId) {
if (!mounted) return;
setState(() {
_blindPosition = (data['pos'] as int).toDouble();
});
}
}
});
socket?.on("calib", (periphData) {
if (periphData is Map<String, dynamic>) {
if (periphData['periphID'] == widget.peripheralId) {