Strange type conversion error RRF3.5.0b4
-
I'm not sure if this is specific to RRF3.5.0b4 as I've only just noticed it.
Duet 2 WiFi 2WiFi 3.5.0-beta.4
Duet WiFi Server n/a 2.1beta3
Duet Web Control DWC 3.5.0-beta.4When I was having problems with WiFi related SPI errors on my Duet2 WiFi (now fixed), I decided to add a section of code to daemon.g to monitor the status of the WiFi module, restart it if necessary and log the disconnect.
I had thought that it was all working as planned, but as my printer is in the shed and I'm rarely in front of it when I do a restart, I noticed an error appear on the PanelDue that never shows up in DWC, because the WiFi has yet to connect.
The error is as follows
Line 157 is in daemon.g and is the first line after the "else"
global NetworkRestartTime = (state.time + 60)
; check if wifi is connected if (network.interfaces[0].actualIP="0.0.0.0") || (network.interfaces[0].actualIP=null) || (network.interfaces[0].state!="active") if exists(global.NetworkRestartTime) if global.NetworkRestartTime > state.time if fileexists("0:/sys/print_log.txt") echo >>"0:/sys/print_log.txt" "WiFi disconnected: Restart attempted at : " ^ state.time M929 P"0:/sys/print_log.txt" S3 M122 M552 S-1 ; disable wifi G4 S2 M552 S1 ; enable wifi M929 S0; stop logging set global.NetworkRestartTime = (state.time + 60) else global NetworkRestartTime = (state.time + 60) if fileexists("0:/sys/print_log.txt") echo >>"0:/sys/print_log.txt" "WiFi disconnected: WiFi module restart schedued for " ^ global.NetworkRestartTime
The strange part is that if I send that line on the console, it works fine.
And also if I delay running the code until after the wifi connects, it also works fine.
So this works with no errorsif (network.interfaces[0].actualIP="0.0.0.0") || (network.interfaces[0].actualIP=null) || (network.interfaces[0].state!="active") if state.upTime < 60 break if exists(global.NetworkRestartTime) if global.NetworkRestartTime > state.time if fileexists("0:/sys/print_log.txt") echo >>"0:/sys/print_log.txt" "WiFi disconnected: Restart attempted at : " ^ state.time M929 P"0:/sys/print_log.txt" S3 M122 M552 S-1 ; disable wifi G4 S2 M552 S1 ; enable wifi M929 S0; stop logging set global.NetworkRestartTime = (state.time + 60) else global NetworkRestartTime = (state.time + 60) if fileexists("0:/sys/print_log.txt") echo >>"0:/sys/print_log.txt" "WiFi disconnected: WiFi module restart schedued for " ^ global.NetworkRestartTime
-
@OwenD I think the issue is that RRF doesn't know the time until DWC connects and passes the time to the Duet. I suggest you add a check that state.time isn't null before using it.
-
@dc42 said in Strange type conversion error RRF3.5.0b4:
@OwenD I think the issue is that RRF doesn't know the time until DWC connects and passes the time to the Duet. I suggest you add a check that state.time isn't null before using it.
Nailed it!
I'll use state.upTime instead. -
-