fix(net): unblock AsyncTCP during device registration, max TX power, roaming diagnostics
Three independent improvements to the WiFi/webserver stability: 1. /api/register called registerDevice() directly inside the AsyncWebServer body handler. That function does a blocking HTTPClient POST with a 5s timeout, freezing the AsyncTCP task and tearing down every in-flight HTTP and WebSocket connection. It now goes through the existing apiQueue / filamanApiTask machinery: the endpoint answers 202 immediately (or 503 if the queue is full, which would otherwise leave the UI waiting forever) and the outcome is pushed to the browser as a "registerResult" WebSocket message. setup.html waits for that message instead of the HTTP response. 2. TX power raised from 17dBm to the 19.5dBm maximum. The reduced setting was a compromise against heat, but at marginal signal levels it invites AP-side auth/assoc kicks (reason=2/4/9/202). 3. Disconnect/GOT_IP logging now includes BSSID, RSSI and channel, so a device bouncing between two APs (mesh/repeater with separate DHCP scopes) can be told apart from webserver-induced drops. Both build environments verified.
This commit is contained in:
1 parent
337d7f8983
commit
80825c6cfc
6 files changed
+87
-15
No files matched your search
+17
-3
@@ -182,9 +182,10 @@
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
statusMessage.textContent = 'Registration successful!';
|
||||
statusMessage.style.color = 'var(--success-text)';
|
||||
setTimeout(() => location.reload(), 2000);
|
||||
// 202 Accepted: Registrierung wurde nur eingereiht. Das
|
||||
// tatsaechliche Ergebnis kommt per WebSocket ('registerResult').
|
||||
statusMessage.textContent = 'Registering device...';
|
||||
statusMessage.style.color = 'var(--text-muted)';
|
||||
} else {
|
||||
statusMessage.textContent = 'Registration failed. Please check your code and URL.';
|
||||
statusMessage.style.color = 'var(--error-text)';
|
||||
@@ -208,6 +209,19 @@
|
||||
dot.className = data.filaman_connected ? 'status-dot online' : 'status-dot offline';
|
||||
document.getElementById('ramStatus').textContent = data.freeHeap + ' KB free';
|
||||
}
|
||||
else if (data.type === 'registerResult') {
|
||||
// Die Registrierung laeuft asynchron im API-Task; /api/register
|
||||
// antwortet sofort mit 202, das Ergebnis kommt hier an.
|
||||
const statusMessage = document.getElementById('statusMessage');
|
||||
if (data.success) {
|
||||
statusMessage.textContent = 'Registration successful!';
|
||||
statusMessage.style.color = 'var(--success-text)';
|
||||
setTimeout(() => location.reload(), 2000);
|
||||
} else {
|
||||
statusMessage.textContent = 'Registration failed. Please check your code and URL.';
|
||||
statusMessage.style.color = 'var(--error-text)';
|
||||
}
|
||||
}
|
||||
};
|
||||
ws.onclose = () => setTimeout(connectWebSocket, 2000);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user