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

    if with calculation for color

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    3
    205
    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.
    • happyundefined
      happy
      last edited by

      Hello,

      I am trying to get LED lights changing with the status of the print.
      I setup my deamon.g as follow:

      ; deamon.g
      ; adapting lights to print progress
      
      if job.layer == null
       ; No job started - initial start of machine 
       M42 P0 S0 ; Red 
       M42 P1 S0 ; Green 
       M42 P2 S0.1 ; Bleu 
       M42 P3 S0.1 ; White
      else 
       if heat.heaters[0].active > 0
        if heat.heaters[1].active > 0
         if job.layer != 0
          ;if job.timesLeft.file < 100
          if {job.filePosition / job.file.size} >= 0.95
           ;end of print
           M42 P0 S0 ; Red 
           M42 P1 S1 ; Green 
           M42 P2 S0 ; Bleu 
           M42 P3 S0.1 ; White
          else
           ;middle of print
           M42 P0 S1 ; Red 
           M42 P1 S0 ; Green 
           M42 P2 S0 ; Bleu 
           M42 P3 S1 ; White    
         else
          ; bed and head heating
          M42 P0 S0.5 ; Red 
          M42 P1 S0 ; Green 
          M42 P2 S0 ; Bleu 
          M42 P3 S0 ; White 
        else
         ; bed heating
         M42 P0 S0.1 ; Red 
         M42 P1 S0 ; Green 
         M42 P2 S0 ; Bleu 
         M42 P3 S0 ; White 
       else
        ; 
        M42 P0 S0 ; Red 
        M42 P1 S0 ; Green 
        M42 P2 S1 ; Bleu 
        M42 P3 S0 ; White
      

      My problem is that "if {job.filePosition / job.file.size} >= 0.95" doesn't want to work and throws a console error:

      Error: in file macro line 15 column 41: meta command: expected numeric operand

      I am note quite sure what is wrong.
      Could someone help?

      Thank you

      oc_geekundefined 1 Reply Last reply Reply Quote 0
      • oc_geekundefined
        oc_geek @happy
        last edited by

        @happy i was just trying to do the same and get the same error as yours.

        Have you sorted this out ?
        I wonder which type is "job.file.size" as i expected it the be numerical...

        dc42undefined 1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @oc_geek
          last edited by

          @oc_geek I replied to your other thread.

          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

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