Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. Macgyver
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 61
    • Best 12
    • Controversial 0
    • Groups 0

    Macgyver

    @Macgyver

    17
    Reputation
    2
    Profile views
    61
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Macgyver Unfollow Follow

    Best posts made by Macgyver

    • Macro for setting up your network

      Good Day all

      Here is a little side project I was working on, Thanks to @dc42 for letting me know about the S7 switch I completely missed in the documentation.

      It does force the users to be aware that DUET will connect to the 2.4Ghz network reliability, It prompts only for required information as needed. I have done a little testing on it here in my environment and it works well for me. Hopefully others can find it useful.

      Not sure why its not showing properly in the preview however everything between Start and end macro is required.

      ---- Start Macro
      
      ;WIFI_CONFIG macro v1.1
      ;
      ; Author: Dr Jay (3D Emergency Room)
      ; Created: December 16, 2023
      ; Last Updated: December 16, 2023
      ;
      ; This macro helps configure WiFi settings on Duet boards
      ; Supports both Client and Access Point modes
      ;
      ; IMPORTANT WIFI REQUIREMENTS:
      ; - ONLY 2.4GHz networks are supported
      ; - 5GHz networks will NOT work
      ; - Dual-band networks must be split into separate 2.4GHz and 5GHz networks
      ;
      ; How to identify a 2.4GHz network:
      ; 1. Check your router settings - look for separate network names for 2.4GHz and 5GHz
      ; 2. Network names often end with "-2.4G" or "-2G" to distinguish them
      ; 3. 2.4GHz networks typically show lower but more stable signal strength
      ; 4. If using a dual-band router, ensure you've separated the bands with different SSIDs
      
      ; Initialize variables
      var ssid = ""
      var password = ""
      var ip = ""
      var gateway = ""
      var subnet = ""
      var mode = 0
      var dhcp_mode = true                                  ; Track if using DHCP
      
      ; Choose wireless mode
      M291 P"Choose WiFi mode" R"Mode Selection" S4 K{"Client","Access Point"}
      set global.result = input
      set var.mode = global.result
      
      if var.mode == 0
          ; CLIENT MODE
          M291 P"WiFi Client Setup" R"Welcome" S3
          
          ; WARNING about 2.4GHz requirement
          M291 P"WARNING: Your network MUST be 2.4GHz. 5GHz and dual-band networks will NOT work!" R"Network Requirement" S3
          M291 P"Common 2.4GHz names end with: -2.4G, -2G, _2.4GHz" R"Network Identification" S3
          M291 P"For dual-band routers: Split bands into separate networks" R"Router Setup" S3
          M291 P"Recommended: Use WPA2-PSK security and channels 1, 6, or 11" R"Network Settings" S3
          M291 P"Make sure you are connecting to a 2.4GHz network. Continue?" R"Confirm" S4 K{"Yes","No"}
          set global.result = input
          if global.result == 1
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          
          ; Prompt for SSID
          M291 P"Enter WiFi network name (SSID)" R"Network Name" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.ssid = global.result
          
          ; Prompt for password
          M291 P"Enter WiFi password" R"Network Password" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.password = global.result
          
          ; Ask about custom IP
          M291 P"Use custom IP configuration?" R"IP Config" S4 K{"No (DHCP)","Yes"}
          set global.result = input
          if global.result == 1
              set var.dhcp_mode = false
              ; Get IP address
              M291 P"Enter IP address (e.g. 192.168.1.100)" R"IP Address" S7
              set global.result = input
              if global.result == ""
                  M291 P"Using DHCP" R"Info" S3
                  set var.dhcp_mode = true
              else
                  set var.ip = global.result
                  
                  ; Get gateway
                  M291 P"Enter gateway address (e.g. 192.168.1.1)" R"Gateway" S7
                  set global.result = input
                  set var.gateway = global.result
                  
                  ; Get subnet mask
                  M291 P"Enter subnet mask (e.g. 255.255.255.0)" R"Subnet" S7
                  set global.result = input
                  set var.subnet = global.result
          
          ; Configure WiFi
          M291 P"Configuring WiFi..." R"Please Wait" S3
          M552 S0                                           ; Disable network
          G4 P1000                                          ; Wait 1 second
          
          M587 S{var.ssid} P{var.password}                 ; Configure WiFi
          
          ; Set custom IP if provided
          if !var.dhcp_mode
              M552 P{var.ip}                               ; Set IP address
              M553 P{var.subnet}                           ; Set subnet mask
              M554 P{var.gateway}                          ; Set gateway
          
          G4 P2000                                          ; Wait 2 seconds
          M552 S1                                           ; Enable network
      else
          ; ACCESS POINT MODE
          M291 P"WiFi Access Point Setup" R"Welcome" S3
          
          ; Prompt for AP name
          M291 P"Enter Access Point name" R"AP Name" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.ssid = global.result
          
          ; Prompt for AP password (minimum 8 characters)
          M291 P"Enter AP password (min 8 chars)" R"AP Password" S7
          set global.result = input
          if global.result == "" || strlen(global.result) < 8
              M291 P"Invalid password - minimum 8 characters" R"Error" S3
              M99
          set var.password = global.result
          
          ; Configure Access Point
          M291 P"Creating Access Point..." R"Please Wait" S3
          M552 S0                                           ; Disable network
          G4 P1000                                          ; Wait 1 second
          
          M589 S{var.ssid} P{var.password}                 ; Configure Access Point
          
          G4 P2000                                          ; Wait 2 seconds
          M552 S1                                           ; Enable network
      
      ; Report network status
      M552                                                  ; Report current network status
      
      ; Final message
      if var.mode == 0
          M291 P"WiFi client setup complete. Check connection status above." R"Complete" S3
      else
          M291 P"Access Point created. SSID: " ^ {var.ssid} R"Complete" S3
      
      ; Clear sensitive data
      set var.ssid = ""
      set var.password = ""
      set var.ip = ""
      set var.gateway = ""
      set var.subnet = ""
      
      ; Recommend power cycle
      M291 P"Please power cycle your printer to ensure network settings are properly applied" R"Power Cycle" S3
      
      
      --- End macro
      
      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • RE: Duet Wifi/Duex5 bed compensation

      Jay_s_uk hit it right on the head, I was missing the M671.

      Here is the config with the 671 configured, It's a long one but it works.

      ; generated by RepRapFirmware Configuration Tool v3.3.0 on Tue Aug 10 2021 15:48:47 GMT-0400 (Eastern Daylight Time)

      ; General preferences
      M575 P1 S1 B57600 ; enable support for PanelDue
      G90 ; send absolute coordinates...
      M83 ; ...but relative extruder moves

      ; Network
      M552 S1 ; enable network
      M586 P0 S1 ; enable HTTP
      M586 P1 S0 ; disable FTP
      M586 P2 S0 ; disable Telnet

      ; Drives
      M569 P0 S1 ; physical drive 0 goes forward (Y)
      M569 P1 S0 ; physical drive 1 goes backward (Y)
      M569 P2 S0 ; physical drive 2 goes backward (X)
      M569 P3 S1 ; physical drive 3 goes forward (E0)
      M569 P4 S1 ; Physical Drive 4 goes forward (E1)

      ; Z axis motors are plugged into the Duex contoller numbers 5-8
      M569 P5 S1 ; Physical Drive 5 goes forward (Z-LR)
      M569 P6 S1 ; Physical Drive 6 goes forward (Z-LF)
      M569 P7 S1 ; Physical Drive 7 goes forward (Z-LF)
      M569 P8 S1 ; Physical Drive 8 goes forward (Z-LF)

      M584 X2 Y0:1 Z5:6:7:8 E3:4 ; set drive mapping

      ;Z axis leadscrew locations
      M671 X-70.0:-70.0:570.0:570.0 Y40.0:520.0:520.0:40.0 S5 ; Z leadscrews are at (-70,40)LR #5, (-70,520)LF #6, (570,520)RF #7 and (570,40)RR #8 , 5mm max correction

      M350 X16 Y16 Z16 E16:16 I1 ; configure microstepping with interpolation
      M92 X160.00 Y80.00 Z400.00 E695.00:695.00 ; set steps per mm
      M566 X900.00 Y900.00 Z60.00 E120.00:120.00 ; set maximum instantaneous speed changes (mm/min)
      M203 X6000.00 Y6000.00 Z500.00 E1200.00:1200.00 ; set maximum speeds (mm/min)
      M201 X500.00 Y500.00 Z20.00 E250.00:250.00 ; set accelerations (mm/s^2)
      M906 X800 Y800 Z800 E450:450 I30 ; set motor currents (mA) and motor idle factor in per cent
      M84 S180 ; Set idle timeout

      ; Axis Limits
      M208 X0 Y0 Z0 S1 ; set axis minima
      M208 X500 Y500 Z500 S0 ; set axis maxima

      ; Endstops
      M574 X1 S1 P"xstop" ; configure active-high endstop for low end on X via pin xstop
      M574 Y1 S1 P"ystop+zstop" ; configure active-high duel endstops for low end on Y via pins (ystop(L))(zstop(R)
      ;M574 Y2 S1 P"zstop" ; configure active-high endstop for low end on Y(R) via pin zstop
      M574 Z1 S1 ; configure Z-probe endstop for low end on Z

      ; Z-Probe
      M950 S0 C"duex.pwm5" ; create servo pin 0 for BLTouch
      M558 P9 C"^zprobe.in" H5 F120 T6000 ; set Z probe type to bltouch and the dive height + speeds
      ;M558 H30 ;*** Remove this line after delta calibration has been done and new delta parameters have been saved
      G31 P500 X5 Y0 Z2.3 ; set Z probe trigger value, offset and trigger height
      M557 X15:485 Y15:485 S47 ; define mesh grid

      posted in General Discussion
      Macgyverundefined
      Macgyver
    • RE: Yet another BLtouch problem

      So after much trying to figure out what's going on with this machine, turns out had a weak spot in one of the ground lines in my BLtouch, It would work sometimes and randomly just not trigger. Ran 5 new lines all from the BLtouch through the drag chain to the mainboard (about 17 ft) and now its working 100% predictability.

      Just going to post my configuration here in case others want something to ref that is working. All this is done on RRF 3

      Config .g file

      ; Configuration file for Duet WiFi (firmware version 3)
      ; executed by the firmware on start-up
      ;
      ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Mar 02 2021 18:05:15 GMT-0500 (Eastern Standard Time)

      ; Endstops
      M574 X1 S1 P"!xstop" ; configure active-high endstop for low end on X via pin !xstop
      M574 Y1 S1 P"!ystop" ; configure active-high endstop for low end on Y via pin !ystop

      ; Z-Probe
      M950 S0 C"exp.8" ; Assign GPIO port 0 to Heater3/Pin8 on exp conn, Servo Mode
      M558 P9 C"^zprobe.in" H5 F120 T6000 ; set Z probe type to 9 BL Touch and the dive height + speeds
      G31 P500 X0 Y0 Z6.3 ; set Z probe trigger value, offset and trigger height
      M557 X15:585 Y15:585 S28.5 ; define mesh grid


      ; deployprobe.g
      ; called to deploy a physical Z probe
      M280 P0 S10


      ; homeall.g
      ; called to home all axes
      ;
      ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Mar 02 2021 18:05:15 GMT-0500 (Eastern Standard Time)
      G91 ; relative positioning
      G1 H2 Z5 F6000 ; lift Z relative to current position
      G1 H1 X-605 Y-605 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
      G1 H2 X5 Y5 F6000 ; go back a few mm
      G1 H1 X-605 Y-605 F360 ; move slowly to X and Y axis endstops once more (second pass)
      G30
      G90 ; absolute positioning
      G92 Z0 ; set Z position to axis minimum (you may want to adjust this)


      ; homez.g
      ; called to home the Z axis
      ;
      ; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Mar 02 2021 18:05:15 GMT-0500 (Eastern Standard Time)
      G91 ; relative positioning
      G1 H2 Z5 F6000 ; lift Z relative to current position
      G30
      G92 Z0 ; set Z position to axis minimum (you may want to adjust this)

      posted in Firmware installation
      Macgyverundefined
      Macgyver
    • RE: Duet 2 Wifi will not automatically connect to WAP

      HI @jay_s_uk , thanks for the reply

      After installing just the Wifi update, Came up with the same scrolling error and then a message connected to the access point, IP address 255.255.255.255,

      That was weird because that is a broadcast address. Anyway did the S0 and S1 again and it connected properly. Error is basically still happening.

      I updated the DWC as a separate step to help anyone else troubleshoot,

      First time I power cycled the printer, Came up perfectly, Connected properly and gave me the proper IP address.
      Power cycled it again and back to the same error message.
      However, If I just do nothing Eventually it does come online itself. Sometimes takes 2 mins to connect and give me the IP.

      So I started thinking maybe there may be some other networks in the configuration that is toying with it. I ran the procedure listed in this Post
      https://forum.duet3d.com/topic/9888/how-to-erase-remembered-networks/4

      basically the M588 S"*"
      I set up my network again from scratch with the M587 and now after 10 power cycles, It seems to be working ok.

      If I was to guess what may be going on as you apply firmware versions it may be adding "default" or "beta" networks that it has to scan and see that they are not there before it will move on to the next one. That is strictly my guess but the version of the DWC definitely had the biggest effect.

      For me, I just like to try and understand the source of the error but for anyone else troubleshooting this error take @jay_s_uk 's advice and ensure your firmware versions match.

      posted in General Discussion
      Macgyverundefined
      Macgyver
    • RE: Duet 2 with Duex 5, cannot get BLtouch to function

      @phaedrux

      that's awesome, thank you for the info,

      I appreciate the time 2 you both.

      posted in Duet Hardware and wiring
      Macgyverundefined
      Macgyver
    • RE: Trouble with a if statement decision tree using M291 K

      @jay_s_uk well darn it, bad when you so used to working in another language

      Thank you for that catch, rework time

      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • RE: Yet another BLtouch problem

      Hi Guys

      Sorry for going AWOL on this, unfortunately got Covid but finally back in the office and back on this machine.

      Going to work through it and update it shortly.

      posted in Firmware installation
      Macgyverundefined
      Macgyver
    • RE: Duet 2 with Duex 5, cannot get BLtouch to function

      Hi Guys

      Sorry, I missed the update, Yes all is working now. thanks again for your help.

      Up to the last tests I was doing it was a coding issue, as it turns out somewhere along the line the BLtouch sensor went bad. I wrote a script to probe 10 times and report the divination. the number was never the same, or even close for that point. turned out the touch was bad.

      posted in Duet Hardware and wiring
      Macgyverundefined
      Macgyver
    • RE: Macro for setting up your network

      @Phaedrux thank you for the assist,

      I am working on a couple of things so you may see more coming in the future if they have a cool factor I am aiming for

      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • RE: Yet another BLtouch problem

      Actually a good point, I missed that,

      Not sure where that one came from

      posted in Firmware installation
      Macgyverundefined
      Macgyver

    Latest posts made by Macgyver

    • Detailed ref on X/Y offsets BLtouch and IDEX tool head

      Good Day all

      I have been working alot on a IDEX calibration tool and I think I have been looking at it too long and starting to confuse myself. Could someone have a look at my explanation and ensure I am seeing this correctly

      Primary print head, - BLtouch probe is physically located Y- and X positive (in front and to the right) of the nozzle
      BLtouch offset - config.g - G31 P500 X5 Y-15 (measured with calipers)

      This makes my Probe offset so if the probe itself is X positive from the nozzle this makes the positive because the point we are always to ref to is the primary nozzle. Everything is ref from this center point.
      Following this if the BLtouch is Y negative from the nozzle this would make the Y offset negative

      Question below:

      Now that being said, This printer has 2 different style print heads on each of the IDEX heads. The secondary print head is physically slightly X negative (secondary to the left of the primary but mounted to the Y gantry. This makes the Y tool offset negative correct?

      My thinking is: what is the physical direction of the secondary nozzle based on the location of the primary nozzle. (what direction to you need to travel in the X direction to locate the secondary nozzle) this direction is negative. is this statement correct?

      Can some explain to me in the same kind of terms, what are the 2 points we are measuring to find the U offset?

      posted in Documentation
      Macgyverundefined
      Macgyver
    • Bad command: endif

      Running 3.5.4 firmware on my printer, Trying to do a macro for a calibration tool

      Here is the problem section of code

      ; Check if we got a trigger by checking if we moved down significantly
      var trigger_detected = move.axes[2].machinePosition < (var.safe_nozzle_height - 0.5) ; Check if we moved down significantly
      echo >>"0:/sys/IDEX_Z_offset.log" {state.time}, "Checking trigger detection: ", var.trigger_detected

      ; If no trigger was detected, abort
      if !var.trigger_detected
      echo >>"0:/sys/IDEX_Z_offset.log" {state.time}, "ERROR: No touch detected - aborting"
      M291 S2 R"Error" P"No touch detected after moving 9mm. Check the calibration tool and try again."
      M99 ; Exit macro if no trigger
      else
      echo >>"0:/sys/IDEX_Z_offset.log" {state.time}, "Touch detected successfully"
      endif

      Keep getting the error message - Error: Bad command: endif, It looks right to me but its late and I gotta be missing something. Can someone do a sanity check for me or have I run across something I cannot do?

      posted in Tuning and tweaking
      Macgyverundefined
      Macgyver
    • RE: IDEX print heads, T1 colliding with T0 at start of print

      Hi @droftarts

      Thank you for the reply, I have the BLtouch on the T0 toolhead, its why I activate it first using the T0 in the Start Gcode.

      The second toolhead T1 (non-Bltouch) is being called by the slicer. as that is how I have assigned it in my slice.

      If I create a small object (purge line) and print it first the collision does not occure.

      could you take a guess at a work around where I can leave the front tool head not in use to print with the rear one only?

      I am willing to test theorys, just not sure what else to try.

      posted in Tuning and tweaking
      Macgyverundefined
      Macgyver
    • RE: SBC may be overloaded

      There is an additional logger you can use to gather more information.

      https://docs.duet3d.com/User_manual/Troubleshooting/Logging

      Here is the basic layout of the command.

      M929: Start/stop event logging to SD card
      When event logging is enabled, important events such as power up, start/finish printing and (if possible) power down will be logged to the SD card. Each log entry is a single line of text, starting with the date and time if available, or the elapsed time since power up if not. If the log file already exists, new log entries will be appended to the existing file.

      Parameters
      P"filename" The name of the file to log to. Only used if the S1 parameter is present. A default filename will be used if this parameter is missing.
      Sn S1 = start logging, S0 = stop logging (RRF <= 3.2.0)
      Sn S0 = stop logging, S1 = log level WARN, S2 = log level INFO, S3 = log level DEBUG (RRF >= 3.2.0)
      Examples

      M929 P"eventlog.txt" S1 ; start logging warnings to file eventlog.txt
      M929 S0 ; stop logging

      Only use it when you need it as it does really beat up on your SD card or I/O access

      posted in General Discussion
      Macgyverundefined
      Macgyver
    • IDEX print heads, T1 colliding with T0 at start of print

      Good Day all

      I have something puzzling going on. My printer is setup with an IDEX config, Both print heads mounted on the Y axis gantry, T0 Homes to the front (Ymin, Xmin), T1 Homes to the back (Ymax, Xmin).

      I have both my print heads setup differently, .8 in the front and .4 in the back. Primarily I print non-detailed items with the front print head and more detailed from the back. I rarely use both print heads in the same print.

      When I start a print with the T1 just before the printing starts T1 comes all the way forward and collides with T0 and skips steps before starting the print. From what I can tell before printing T0 attempts to move to U0 like its trying to hit the endstop but it just came out of the endstop in the back.

      Start Gcode is very basic
      G28
      G32
      G29 S1
      T0

      The G28 and G32 complete successfully so I am assuming its something out of the G29 or there is a movement call in a G file somewhere calling for The U axis to move to 0 before starting to print.

      Am I going down the right path on this or am I missing something?

      posted in Tuning and tweaking
      Macgyverundefined
      Macgyver
    • RE: Macro for setting up your network

      @Phaedrux thank you for the assist,

      I am working on a couple of things so you may see more coming in the future if they have a cool factor I am aiming for

      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • Macro for setting up your network

      Good Day all

      Here is a little side project I was working on, Thanks to @dc42 for letting me know about the S7 switch I completely missed in the documentation.

      It does force the users to be aware that DUET will connect to the 2.4Ghz network reliability, It prompts only for required information as needed. I have done a little testing on it here in my environment and it works well for me. Hopefully others can find it useful.

      Not sure why its not showing properly in the preview however everything between Start and end macro is required.

      ---- Start Macro
      
      ;WIFI_CONFIG macro v1.1
      ;
      ; Author: Dr Jay (3D Emergency Room)
      ; Created: December 16, 2023
      ; Last Updated: December 16, 2023
      ;
      ; This macro helps configure WiFi settings on Duet boards
      ; Supports both Client and Access Point modes
      ;
      ; IMPORTANT WIFI REQUIREMENTS:
      ; - ONLY 2.4GHz networks are supported
      ; - 5GHz networks will NOT work
      ; - Dual-band networks must be split into separate 2.4GHz and 5GHz networks
      ;
      ; How to identify a 2.4GHz network:
      ; 1. Check your router settings - look for separate network names for 2.4GHz and 5GHz
      ; 2. Network names often end with "-2.4G" or "-2G" to distinguish them
      ; 3. 2.4GHz networks typically show lower but more stable signal strength
      ; 4. If using a dual-band router, ensure you've separated the bands with different SSIDs
      
      ; Initialize variables
      var ssid = ""
      var password = ""
      var ip = ""
      var gateway = ""
      var subnet = ""
      var mode = 0
      var dhcp_mode = true                                  ; Track if using DHCP
      
      ; Choose wireless mode
      M291 P"Choose WiFi mode" R"Mode Selection" S4 K{"Client","Access Point"}
      set global.result = input
      set var.mode = global.result
      
      if var.mode == 0
          ; CLIENT MODE
          M291 P"WiFi Client Setup" R"Welcome" S3
          
          ; WARNING about 2.4GHz requirement
          M291 P"WARNING: Your network MUST be 2.4GHz. 5GHz and dual-band networks will NOT work!" R"Network Requirement" S3
          M291 P"Common 2.4GHz names end with: -2.4G, -2G, _2.4GHz" R"Network Identification" S3
          M291 P"For dual-band routers: Split bands into separate networks" R"Router Setup" S3
          M291 P"Recommended: Use WPA2-PSK security and channels 1, 6, or 11" R"Network Settings" S3
          M291 P"Make sure you are connecting to a 2.4GHz network. Continue?" R"Confirm" S4 K{"Yes","No"}
          set global.result = input
          if global.result == 1
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          
          ; Prompt for SSID
          M291 P"Enter WiFi network name (SSID)" R"Network Name" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.ssid = global.result
          
          ; Prompt for password
          M291 P"Enter WiFi password" R"Network Password" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.password = global.result
          
          ; Ask about custom IP
          M291 P"Use custom IP configuration?" R"IP Config" S4 K{"No (DHCP)","Yes"}
          set global.result = input
          if global.result == 1
              set var.dhcp_mode = false
              ; Get IP address
              M291 P"Enter IP address (e.g. 192.168.1.100)" R"IP Address" S7
              set global.result = input
              if global.result == ""
                  M291 P"Using DHCP" R"Info" S3
                  set var.dhcp_mode = true
              else
                  set var.ip = global.result
                  
                  ; Get gateway
                  M291 P"Enter gateway address (e.g. 192.168.1.1)" R"Gateway" S7
                  set global.result = input
                  set var.gateway = global.result
                  
                  ; Get subnet mask
                  M291 P"Enter subnet mask (e.g. 255.255.255.0)" R"Subnet" S7
                  set global.result = input
                  set var.subnet = global.result
          
          ; Configure WiFi
          M291 P"Configuring WiFi..." R"Please Wait" S3
          M552 S0                                           ; Disable network
          G4 P1000                                          ; Wait 1 second
          
          M587 S{var.ssid} P{var.password}                 ; Configure WiFi
          
          ; Set custom IP if provided
          if !var.dhcp_mode
              M552 P{var.ip}                               ; Set IP address
              M553 P{var.subnet}                           ; Set subnet mask
              M554 P{var.gateway}                          ; Set gateway
          
          G4 P2000                                          ; Wait 2 seconds
          M552 S1                                           ; Enable network
      else
          ; ACCESS POINT MODE
          M291 P"WiFi Access Point Setup" R"Welcome" S3
          
          ; Prompt for AP name
          M291 P"Enter Access Point name" R"AP Name" S7
          set global.result = input
          if global.result == ""
              M291 P"Setup cancelled" R"Cancelled" S3
              M99
          set var.ssid = global.result
          
          ; Prompt for AP password (minimum 8 characters)
          M291 P"Enter AP password (min 8 chars)" R"AP Password" S7
          set global.result = input
          if global.result == "" || strlen(global.result) < 8
              M291 P"Invalid password - minimum 8 characters" R"Error" S3
              M99
          set var.password = global.result
          
          ; Configure Access Point
          M291 P"Creating Access Point..." R"Please Wait" S3
          M552 S0                                           ; Disable network
          G4 P1000                                          ; Wait 1 second
          
          M589 S{var.ssid} P{var.password}                 ; Configure Access Point
          
          G4 P2000                                          ; Wait 2 seconds
          M552 S1                                           ; Enable network
      
      ; Report network status
      M552                                                  ; Report current network status
      
      ; Final message
      if var.mode == 0
          M291 P"WiFi client setup complete. Check connection status above." R"Complete" S3
      else
          M291 P"Access Point created. SSID: " ^ {var.ssid} R"Complete" S3
      
      ; Clear sensitive data
      set var.ssid = ""
      set var.password = ""
      set var.ip = ""
      set var.gateway = ""
      set var.subnet = ""
      
      ; Recommend power cycle
      M291 P"Please power cycle your printer to ensure network settings are properly applied" R"Power Cycle" S3
      
      
      --- End macro
      
      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • RE: Trouble with a if statement decision tree using M291 K

      ok, I am going to rework this using your suggestions,

      Side Question but related, It does not appear that the M291 allows for user input except selecting options that are coded into the macro.

      Is there a command to allow user free text input using the onscreen keyboard? Think about something like

      What is your network name? Then allowing a user to type in the name of the network they want to connect to?
      Essentially trying to sudo prompt for an input to the M587 command?

      If you like I can break this question out to a separate thread for others to search on.

      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • RE: Trouble with a if statement decision tree using M291 K

      @jay_s_uk well darn it, bad when you so used to working in another language

      Thank you for that catch, rework time

      posted in Gcode meta commands
      Macgyverundefined
      Macgyver
    • Trouble with a if statement decision tree using M291 K

      I think I am describing this properly.

      On my IDEX printer I have 4 head options, I am creating a macro for Calibrating X,Y and Z offset. for both heads. The purpose of this macro is to verify a setup is compatiable and assign correct BLtouch offsets based on print head used (BLtouch location is different on a couple of the print heads)

      In the start of the macro I am asking to choose which print heads are installed. (As not all are compatiable with each other due to nozzle depth below the gantry.

      I have 4 Head options they are: GHR, GS, GHF, and GUF.

      First issue is in line # 6, I was going to attempt to use this variable as an input to my K switch on my M291 command. I am not sure if this one is possible but I commented it out for now and added the string directly onto the K switch while I figure out the second problem.

      I am having issues starting at line 50, l am trying to get the macro to decide if the print heads are compatiable with each other. I have the values of the heads added as a 2 digit number and stored in var.head_configuration, so I can compare. If the number starts or ends with a 1 the other number must be a 1, If the number in the variable starts or ends with a 3 the other number must also be 3. All other combonations are valid. Is there an easier way to do this or am I going down the wrong path? Suggestions welcome

      here is the setup for my macro

      ; Calibration Setup Macro
      
      ;*** VARIABLES ***
      var primary_head = -1 ; Variable to store primary head selection
      var secondary_head = -1 ; Variable to store secondary head selection
      ; var head_names = ["GS", "GHF", "GUF", "GHR"]; ; Names of the heads
      var head_configuration = -1; ; Variable to store the head configuration
      var Temp_var = -1; Variable to be used for math
      echo >"0:/sys/IAC_Setup_log.txt" {state.time}, "Setup Start Time stamp"
      
      
      ;*** WARNING BEFORE HEAD SELECTION ***
      M291 S3 R"Important" P"** Ensure the correct print heads are installed before proceeding! **"
      M291 S3 R"WARNING:" P"** Ensure calibration tool is NOT on the bed at this time. **"
      
      ;*** NOTICE ABOUT HEAD CHANGES ***
      M291 S3 R"NOTICE" P"** If you change print heads, you must rerun this setup macro before attempting IDEX calibration again! **"
      
      ;*** HOMING COMMANDS ***
      G28 ; Home all axes
      G1 Y10 F4000 ; Move Y axis +10mm
      G1 Y-10 F4000 ; Return Y axis to home
      G1 Y10 F4000 ; Move Y axis +10mm
      G1 Y-10 F4000 ; Return Y axis to home
      
      ;*** USER PROMPT FOR HEAD SELECTION ***
      M291 R"Please choose print head installed in front position" P"Choose from list" K{"GS", "GHF", "GUF", "GHR"} S4
      set var.primary_head = input("Enter your choice (1-4): ")
      echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Selected Primary Head:", var.primary_head
      
      ;*** HOMING FOR SECONDARY HEAD SELECTION ***
      G1 U658.6 F4000 ; Move U axis -10mm
      G1 U668.6 F4000 ; Return U axis to home
      G1 U658.6 F4000 ; Move U axis -10mm
      G1 U668.6 F4000 ; Return U axis to home
      
      M291 R"Please choose print head installed in rear position" P"Choose from list" K{"GS", "GHF", "GUF", "GHR"} S4
      set var.secondary_head = input("Enter your choice (1-4): ")
      echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Selected Secondary Head:", var.secondary_head
      
      ;*** LOG HEAD SELECTION ***
      echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Selected Primary Head:", var.primary_head
      echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Selected Secondary Head:", var.secondary_head
      
      ;*** VERIFY COMPATIBILITY ***
      set var.Temp_var = var.primary_head       ; placing head identifier in temp variable
      set var.primary_head = (var.Temp_var*10)      ; Changing decimal location of result
      set var.head_configuration = (var.primary_head + var.secondary_head)
      echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Variable Head Configuration:", var.head_configuration
      
      if (var.primary_head != var.secondary_head) ; Ensure primary and secondary are different
          ; Check compatibility based on the specified rules
          if ((var.primary_head == 4 && var.secondary_head == 4) ||  ; Both GHR
              (var.primary_head == 2 && var.secondary_head == 2) ||  ; Both GHF
              ((var.primary_head == 1 || var.primary_head == 3) && (var.secondary_head == 1 || var.secondary_head == 3))) ; GS and GUF combinations 
              ; Both heads are compatible and different
              set var.head_configuration = "Primary: " + var.head_names[var.primary_head - 1] + ", Secondary: " + var.head_names[var.secondary_head - 1]
              echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Head Configuration - "{var.head_configuration}"
              M291 S3 R"Configuration Confirmed" P"Primary: {head_names[var.primary_head - 1]}, Secondary: {head_names[var.secondary_head - 1]}"
          else
              echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Error: Incompatible heads selected."
              M291 S3 R"Error" P"Sorry, these heads are incompatible together in an IDEX configuration."
              ; M112 ; Emergency stop to avoid potential issues
          endif
      else
          echo >>"0:/sys/IAC_Setup_log.txt" {state.time}, "Error: Primary and Secondary heads are not compatiable."
          M291 S3 R"Error" P"Primary and Secondary heads are not compatiable. Please try again."
          ; M112 ; Emergency stop to avoid potential issues
      endif
      
      posted in Gcode meta commands
      Macgyverundefined
      Macgyver