if with calculation for color



  • 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


Log in to reply