@@ -21,3 +21,47 @@ pub fn print_help_footer() {
2121 eprintln ! ( " bundle: couchlink bundle" ) ;
2222 eprintln ! ( " report: {}" , issue_url( ) ) ;
2323}
24+
25+ pub fn no_pico_wifi_help ( timeout_seconds : u64 ) -> String {
26+ format ! (
27+ "No Pico replied on Wi-Fi within {timeout_seconds} s.\n \
28+ This is a Pico/network discovery problem, not a controller problem.\n \
29+ Try this in order:\n \
30+ 1. Confirm the Pico is powered and not sitting in BOOTSEL. If it appears as setup-mode USB, use `couchlink configure-wifi` first.\n \
31+ 2. Run `couchlink test discover --all` to retry discovery.\n \
32+ 3. If the router, SSID, or password changed, run `couchlink configure-wifi`.\n \
33+ 4. If configure-wifi cannot find setup mode, use the BOOTSEL-button credential wipe from the wiki, then run configure-wifi again.\n \
34+ 5. Run `couchlink doctor`; check Windows Firewall, router client isolation, and whether the PC and Pico are on the same LAN.\n \
35+ 6. Run `couchlink bundle` and send the zip if it still fails."
36+ )
37+ }
38+
39+ pub fn print_no_pico_wifi_help ( timeout_seconds : u64 ) {
40+ println ! ( "{}" , no_pico_wifi_help( timeout_seconds) ) ;
41+ }
42+
43+ pub fn no_pico_wifi_short_hint ( ) -> & ' static str {
44+ "Confirm the Pico is powered, not in BOOTSEL, and on the same LAN, then run `couchlink test discover --all`. If Wi-Fi changed or the Pico is in setup-mode USB, run `couchlink configure-wifi`. If it still fails, run `couchlink doctor` and `couchlink bundle`."
45+ }
46+
47+ #[ cfg( test) ]
48+ mod tests {
49+ use super :: { no_pico_wifi_help, no_pico_wifi_short_hint} ;
50+
51+ #[ test]
52+ fn no_pico_wifi_help_points_to_recovery_commands ( ) {
53+ let help = no_pico_wifi_help ( 5 ) ;
54+ assert ! ( help. contains( "No Pico replied on Wi-Fi within 5 s." ) ) ;
55+ assert ! ( help. contains( "not a controller problem" ) ) ;
56+ assert ! ( help. contains( "couchlink configure-wifi" ) ) ;
57+ assert ! ( help. contains( "couchlink doctor" ) ) ;
58+ assert ! ( help. contains( "couchlink bundle" ) ) ;
59+ }
60+
61+ #[ test]
62+ fn no_pico_wifi_short_hint_is_actionable ( ) {
63+ let hint = no_pico_wifi_short_hint ( ) ;
64+ assert ! ( hint. contains( "same LAN" ) ) ;
65+ assert ! ( hint. contains( "couchlink test discover --all" ) ) ;
66+ }
67+ }
0 commit comments