Temperature controlled LED display
-
@rushmere3d
The problem was that you did not have any tools selected and I was using the selected tool to determine which heater to monitor in the while loop.This revised file will work with no tool selected.
; set_LED_while_heating.g ; Parameters can be passed for Tool number and target temp ; S = target temperature ; T = Tool number ; D = delay between checks ; example in Prusa slicer start code ; #### ; M568 P[current_extruder] R{"{heat.coldExtrudeTemperature+5}"} S[first_layer_temperature_0] A2 ; M98 P"set_LED_while_heating.gcode" S[first_layer_temperature_0] T[current_extruder] D3 ; M116 ; ### var toolNumber = 0 var thisTool = 0 if exists(param.T) set var.toolNumber = param.T var targetTemp = 120 if exists(param.S) set var.targetTemp = param.S var delay = 3 if exists(param.D) set var.delay = param.D ;echo "Tool number is ", var.toolNumber if var.toolNumber != -1 var heaterNumber = tools[var.toolNumber].heaters[0] while heat.heaters[var.heaterNumber].current < var.targetTemp M98 P"0:/macros/conditional_g_code_macros/set_led_by_temp.gcode" G4 S{var.delay} else while iterations < #tools set var.thisTool = iterations ;echo "Testing heat.heaters[tools[" , var.thisTool, "].heaters[0]]" if (heat.heaters[{tools[var.thisTool].heaters[0]}].state="standby") while (heat.heaters[{tools[var.thisTool].heaters[0]}].current) < (heat.heaters[{tools[var.thisTool].heaters[0]}].standby) M98 P"0:/macros/conditional_g_code_macros/set_led_by_temp.gcode" G4 S{var.delay} if (heat.heaters[tools[var.thisTool].heaters[0]].state="active") ;echo "active" while (heat.heaters[tools[var.thisTool].heaters[0]].current) < (heat.heaters[tools[var.thisTool].heaters[0]].active) M98 P"0:/macros/conditional_g_code_macros/set_led_by_temp.gcode" G4 S{var.delay} ; done heating, so set to white M150 R255 U255 B255 W255 P255 F0 ; set pixels
-
-
-
@nightowl said in Temperature controlled LED display:
I'm going to learn from this to control a series of neopixel LEDs to change colour depending on the spindle speed for my CNC machine, and also have 3-colour LEDs to show my machine in Safe (Green: switched on but not in use/file not loaded), Pause (Orange) and Red (Running a project).
Any thoughts on this, please?
I was thinking of buying this 1m length (of 144LEDs/m) and cutting it to length, but isn't the current rating (20A) a bit high?
Thanks
-
-
@nightowl the current consumption is up to 60mA per LED, times 144 for a 1m length is 8.64A maximum. So you will need a separate 5V PSU for them, but a 10A one will do.
-
-
I strongly advise to not put any M98 inside daemon.g as it can disrupt the main DDARRing and cause stutter in the movement. What I usually do is copy the macro inside the daemon.g and even then some commands might disrupt the movement, at least not the whole macro will cause problems. Maybe we can queue the commands in a different G-Code queue with RRF3.5 to avoid all of this.
-
@Hugsy said in Temperature controlled LED display:
I strongly advise to not put any M98 inside daemon.g as it can disrupt the main DDARRing and cause stutter in the movement. What I usually do is copy the macro inside the daemon.g and even then some commands might disrupt the movement, at least not the whole macro will cause problems. Maybe we can queue the commands in a different G-Code queue with RRF3.5 to avoid all of this.
The main issue with doing too much in daemon.g is contention for the SD card. Using M98 causes it to open the macro file, which involve several SD card accesses.
Also there should be a delay command inside the while loop in daemon.g so that there are periods of time when daemon.g id not competing for resources. This delay should normally be at least 1 second, but more is better if you don't need daemon.g to react faster to changes.