Temperature controlled LED display
-
Hey, had a go at using this today and It's not quite working. Below in my start gcode for single T3 printing, bare in mind on the toolchanger homing and ABL need to be done before a tool is picked up. What's happening is it basically get's to the point where the temp has been set and heating begins but even once at temp it just sits and does nothing but cycle through checking the tools/heaters.
I have both macros in the macro folder for ref.
M104 T-1 M140 S[first_layer_bed_temperature] ;M568 P0 A2 R[standby_temperature_delta] S[first_layer_temperature] ; set active and standby temps ;M568 P1 A2 R[standby_temperature_delta] S[first_layer_temperature] ; set active and standby temps ;M568 P2 A2 R[standby_temperature_delta] S[first_layer_temperature] ; set active and standby temps M568 P3 A2 R[standby_temperature_delta] S[first_layer_temperature] ; set active and standby temps M98 P"/macros/set_led_while_heating.g" S[first_layer_temperature] T[current_extruder] D3 G28 ; G29 ; enable mesh M116
-
@rushmere3d
I'll have a look, but probably not before the weekend -
@owend No problem, no rush.
Shall I try the set_led_by_temp as a daemon.g? rather than being called from a macro.
Thanks for your help.
-
@rushmere3d
You could call it in daemon.g
Perhaps set up a global variable so that you can only call it when you've set that variable to true.
So in your slicer haveset global.WarmUp = true
// set all temps etc
// do homing
Set global.WarmUp = falseThen in daemon.g
If global.Warmup= true
M98 P"path-to-macro.g" -
@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.