Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"You must have an IQ of at least half a million." -- Popeye


computers / comp.sys.raspberry-pi / Pi PICO W resilience.

SubjectAuthor
o Pi PICO W resilience.The Natural Philosopher

1
Pi PICO W resilience.

<uscjls$13fau$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=9383&group=comp.sys.raspberry-pi#9383

  copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.sys.raspberry-pi
Subject: Pi PICO W resilience.
Date: Thu, 7 Mar 2024 14:40:59 +0000
Organization: A little, after lunch
Lines: 51
Message-ID: <uscjls$13fau$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 7 Mar 2024 14:41:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0f155774072c295fe15a01af9b7dcafb";
logging-data="1162590"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bcCXJPbenxBvRnL8zdOkrfnnlW8/8vB8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Mig9vhZrqSmNDqy1zSk7QfHrSz4=
Content-Language: en-GB
 by: The Natural Philosop - Thu, 7 Mar 2024 14:40 UTC

I am passing this along so it might be somwhere searchable if anyone has
the same problem,

Basically my PICO Ws were not reconnecting to the Wifi after loss of
Wifi access point.

This, however seems to work

int main()
{
int ret;
struct tcp_pcb *connection;
char buf[2048];
stdio_init_all();
initialise_adc();
if (cyw43_arch_init_with_country(CYW43_COUNTRY_UK))
{
printf("Wi-Fi init failed");
return -1;
}
cyw43_arch_enable_sta_mode();
set_hostname(hostname);
sleep_ms(20);
printf("THERMOMETER FOR %s\n",hostname);
while (TRUE)
{
// *check wifi is up and connect/reconnect as necessary*..
while((cyw43_tcpip_link_status(&cyw43_state,CYW43_ITF_STA)) !=
CYW43_LINK_UP)
cyw43_arch_wifi_connect_timeout_ms(ssid, password,
CYW43_AUTH_WPA2_AES_PSK, 20000);
// do your stuff here...
sleep_ms(6000);
// rinse and repeat..
}
}

The key issue is that
cyw43_tcpip_link_status(&cyw43_state,CYW43_ITF_STA); will not return
CYW43_LINK_UP until *everything* is sorted out including DHCP assignment
of an IP address...

Fingers crossed this is now reasonably bullet proof.

--
New Socialism consists essentially in being seen to have your heart in
the right place whilst your head is in the clouds and your hand is in
someone else's pocket.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor