Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Strange type conversion error RRF3.5.0b4

    Scheduled Pinned Locked Moved Solved
    Beta Firmware
    2
    3
    160
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • OwenDundefined
      OwenD
      last edited by

      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.4

      When 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
      IMG_6702.jpg

      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 errors

      if (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
      
      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @OwenD
        last edited by

        @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.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        OwenDundefined 1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD @dc42
          last edited by

          @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.

          1 Reply Last reply Reply Quote 1
          • OwenDundefined OwenD marked this topic as a question
          • OwenDundefined OwenD has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA