# M1 — Wi-Fi Service, Wi-Fi Tools, IRC **Status:** done on 2026-10-03, tagged `v0.2.0`. ## Outcome The "Done when" items below work on the device, against irc.libera.chat over TLS, with the following changes. - **Changed:** - **Wi-Fi Tools is built from ordinary scans only:** networks nearby, channel occupancy and a signal tracker. Monitoring-mode views and captures are deferred (revised Q42). The Monitoring mode stays in the Wi-Fi Service and the IRC pause logic, unused for now. - **The frame buffer is 8-bit colour** (Q46), applied as soon as IRC on TLS measured a 51 KB low. - **Not done, carried over:** - **Wi-Fi scan logs** (a CSV of the access points each scan sees) can be recorded from Wi-Fi Tools; monitoring-mode captures remain deferred. - **IRC has no input history** (up-arrow recall). Each Buffer keeps only 50 lines in RAM; the full history is in the Logs. - **Measured on the device:** - With Wi-Fi and IRC on TLS: about 92 KB free heap, about 77–81 KB at the lowest. The floor was 40 KB. - 44% of the app flash used. - 231 host tests. **Goal:** the device joins your Wi-Fi by itself, syncs its clock, keeps an IRC session alive in the background, and gives passive Wi-Fi diagnostics with full-frame captures. ## Decisions (design round 2026-10-02) | # | Decision | |---|---| | Q40 | Up to 8 **Saved Networks**, joined strongest-first. Added from a scan or as a hidden network. Open networks are allowed; enterprise (802.1X) is not. | | Q41 / Q48 | The Wi-Fi Service stays **Connected** whenever enabled and a Saved Network is in range. Settings has a Wi-Fi On/Off switch. **Monitoring** happens only while Wi-Fi Tools is open; the device reconnects on exit. | | Q42 | *Revised 2026-10-02:* Wi-Fi Tools is built from ordinary scans only (access points, channel occupancy, signal tracker). Monitoring-mode views and captures are deferred, to be revisited later. | | Q43 | The signal tracker clicks faster as the signal gets stronger. On by default, mutable. | | Q44 | IRC shows one Buffer at a time; Tab cycles Buffers. Commands: `/join /part /msg /me /nick /topic /names /quit /raw`. Logs go to `/irc///YYYY-MM-DD.log`. | | Q45 | TLS verifies server certificates against the bundled certificate authorities. Per server, a self-signed certificate can be pinned on first use. | | Q46 | If RAM is short: switch the frame buffer to 8-bit colour. Keep the AtomS3 Wi-Fi co-processor in mind. | | Q47 | Passwords are stored in NVS without flash encryption (revisit before any public release). | | IRC | The **IRC Service** stays connected in the background once the App has started it, until `/quit` or disconnect. It does not start at boot. | | Q49 | Opening a Monitoring view while IRC is connected asks first. IRC then pauses, and reconnects and rejoins afterwards; its Buffers show the gap. | | Q50 | Reconnects after drops wait 5 s, 10 s, 30 s … up to 5 min. | | Q51 | Mentions and private messages raise Notifications. Other traffic only counts as unread (Status Bar shows the total). | | M0 | The **Storage Clean-up** screen lands here, once IRC Logs and Captures exist. | ## Done when - Wi-Fi joins the strongest Saved Network at boot. The Status Bar shows Wi-Fi state, and the clock is set over NTP. - Settings → Wi-Fi: On/Off, scan and add a network (with password), add a hidden network, forget a network. - The IRC App configures one server (host, port, TLS, nick, SASL or NickServ, auto-join IRC channels). It connects and keeps running after you leave the App. Mentions notify. - IRC reconnects after Wi-Fi loss or a server drop, and rejoins its IRC channels. Logs are written to the SD card (and stop past 90% usage). - Wi-Fi Tools: access-point list, channel occupancy with the quietest of channels 1/6/11, and a signal tracker that clicks faster as the signal gets stronger. None of it interrupts the connection or IRC. - Settings → Storage → Clean-up deletes IRC Logs, probe Logs and Wi-Fi Captures older than a chosen age, with a preview of the space freed. - Free heap stays above about 40 KB with Wi-Fi, TLS-connected IRC and the UI running. ## Work breakdown (proposed order) 1. **Memory baseline:** measure the heap with Wi-Fi Connected plus one TLS connection. Switch the frame buffer to 8-bit if the margin is too thin. 2. **Wi-Fi Service:** - Saved Networks in NVS. - Choosing the network (host-tested). - The Off / Connecting / Connected / Monitoring state machine (host-tested). - NTP → Clock. - Status Bar indicator. - Settings → Wi-Fi pages. 3. **Log writing:** a Log writer that respects the Storage rules, daily files, and the Storage Clean-up screen (selection logic host-tested). 4. **IRC Service** (host-tested core): - message parser and serializer; - registration, SASL PLAIN and NickServ; - PING/PONG; - Buffers with unread counts and Mention detection; - reconnect backoff, and pause/resume around Monitoring. Then the TLS transport with the certificate bundle. 5. **IRC App:** Buffer view, input line, command parser (host-tested), server settings page. 6. **Wi-Fi Tools App:** access-point list, channel occupancy and signal tracker from scans (occupancy and tracker logic host-tested). Monitoring mode is deferred.