if M552 S1 fails; send M552 S2? Is this possible with RRF3??
-
ah, my bad I see what you mean. I inserted the M409 command in as so:
G4 S10 ; dwell 5 seconds
M409 K"network.interfaces[0].actualIP"
if network.interfaces[0].actualIP = "0.0.0.0"
M552 S-1 ; turn off wifi moduleand got the feedback:
7/11/2020, 2:17:46 PM {"key":"network.interfaces[0].actualIP","flags":"","result":"192.168.0.133"}Error: in file macro line 11 column 46: meta command: cannot convert operands to same type
I appreciate your help @bearer !
-
I think I see the problem. The value network.interfaces[0].actualIP has type IPAddress, whereas "192.168.0.133" has type String. So the two cannot be compared directly.
However, if you apply the string concatenation operator to an IPAddress, it will convert it to type String. So you can use this instead:
if (network.interfaces[0].actualIP^"Q") = "0.0.0.0Q"
-
@dc42 said in if M552 S1 fails; send M552 S2? Is this possible with RRF3??:
has type IPAddress
how can we tell?
(and I presume 3.2 will result in an update of https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Types if there any other interesting developments)
-
@bearer said in if M552 S1 fails; send M552 S2? Is this possible with RRF3??:
how can we tell?
The Object Model Browser plugin for DWC 3.2 will display the types as well as the values.
-
@dc42 said in if M552 S1 fails; send M552 S2? Is this possible with RRF3??:
Browser plugin
understatement:
-
@dc42 said in if M552 S1 fails; send M552 S2? Is this possible with RRF3??:
if (network.interfaces[0].actualIP^"Q") = "0.0.0.0Q"
Hey this worked!!! I appreciate you!
I changed the parameters of the if statement from actualIP to changingMode:
So I'm now using:
if (network.interfaces[0].state^"Q") = "changingModeQ"emit predefined access point
I found that while duet is in M552 S1 mode and can't find a wifi signal, it's actually in "changing mode" As of right now I like this parameter over assuming the IP, as sometimes the IP wouldn't be "0.0.0.0"
-
Glad you have it working!
Though, is
network.interfaces[0].state
not a string type? If it's a string, the concatenation is likely unneeded. -
@bot yes you are right. The macro works without converting it to a string.
-
@bearer You were right about the daemon.g ... I tried to call the macro from the config.g, or just run it straight from the config.g but neither worked, I think you're right that M552 is delayed.
I couldn't find a lot of documentation on daemon.g out there, but I made the daemon.g file in the /sys folder and called the macro "WIFICONNECT" from it. From my understanding the daemon.g file is running constantly in the background? Will this harm anything in the long run? Right now I suspect if there is a temporary "lag" or disconnect with the wifi it will automatically emit it's own wifi signal.. which would inconvenient.
Here's my daemon.g:
G4 S30M98 P"WIFICONNECT"
Here's what I have working for the WIFICONNECT macro:
;Attempt to connect to wifi signal, if it fails, emit a wifi signal
G60if (network.interfaces[0].state) = "changingMode" ; if unable to find/connect to network, emit network access point
M552 S-1 ; turn off wifi module
G4 S3 ; dwell 3 seconds
M552 S0 ; turn wifi module to idle
G4 S3 ; dwell 3 seconds
M552 S2 ; emit predefined access point
M586 P0 S1 ; enable HTTP
M586 P1 S0 ; disable FTP
M586 P2 S0 ; disable Telnet -
@Ben, I suggest that in your script after you find that the state is "changingMode", you delay several seconds, then check it is still 'changing mode" before switching to access point mode.
-
you could make it run only once or twice by using
if state.upTime < 10 M98 P"WIFICONNECT"
in (untested) theory it will only run the macro in the first 10 seconds after powering on the board. include a G4 and you can guarantee its only ran once.