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

    Bad command: endif

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    3
    3
    80
    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.
    • Macgyverundefined
      Macgyver
      last edited by

      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?

      jay_s_ukundefined droftartsundefined 2 Replies Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @Macgyver
        last edited by

        @Macgyver there's no endif in RRF.
        You just have to have the code indented correctly. No indent means the if has finished

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        1 Reply Last reply Reply Quote 0
        • droftartsundefined
          droftarts administrators @Macgyver
          last edited by

          @Macgyver see https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#conditional-construct

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA