Skip to content
George Joseph edited this page Apr 19, 2020 · 2 revisions

Derived from Element -> Panel.

A "heater" widget is a faily complex combination of buttons and input fields that allow you to control a heater.

Normal With Menu Expanded

This is a convenience widget made up of the following basic widgets:

  • The top element is a button that displays the widget label, changes color depending on the state of the heater, and has a drop-down menu (shown to the right) that allows you to control the heater.
  • The second element is a read-only button that displays the heater's current temperature and changes color depending on how far out of tolerance the temperature is.
  • The third element is an input box with a submit button that display's and allows you to set the heater's "active" temperature.
  • The fourth element is an input box with a submit button that display's and allows you to set the heater's "standby" temperature.

The display of two input boxes can be suppressed. See "show_set_fields" below.

{
	/*
	 * All attributes of Element and Panel apply here
	 */

	"id": "extr1_heater",
	"type": "heater",
	
	/* The label displays in the top button */
	"label": "Extr 1",
	
	"position": {
		"my": "left top",
		"at": "right+10 top",
		"of": "#bed_heater"
	},
	
	/* style applies to the widget as a whole */ 
	"style": { "width": "110px" },
	
	/* element_defaults apply to each of the 4 chile elements */
	"button_defaults": {
		"style": {
			"height": "2.5em"
		}
	},
	
	/*
	 * Tolerance controls the color of the second "temperature" button.
	 * The reference temperature is either the "active" or "standby" 
	 * temperature set point depending on the state of the heater.
	 *
	 * For example, if the heater is in standby and the standby set
	 * point is 55 degrees (as the image above shows),
	 * then the temperature button will be green if the temperature is within 2
	 * degrees of 55, orange if it's > 2 degrees but <= 5 degrees and red if
	 * it's more than 5 degrees away from 55.
	 */    
	"tolerance": {
		"tolerances": [
			{"limit": 2, "classes": "btn-success"},
			{"limit": 5, "classes": "btn-warning"},
			{"limit": 999, "classes": "btn-danger"}
		]
	},
	
	/*
	 * State controls the color of the top button.  
	 * Heater states for RRF 3 are:
	 * off: Off
	 * standby: Standby
	 * active: On (active)
	 * fault: Fault detected
	 * tuning: Currently in PID tuning
	 *
	 */
	"state": {
		"states": [
			{"state": "off", "classes": "btn-secondary"},
			{"state": "standby", "classes": "btn-warning"},
			{"state": "active", "classes": "btn-success"},
			{"state": "fault", "classes": "btn-danger"},
			{"state": "tuning", "classes": "btn-info"}
		],
		"field": "${status.heat.heaters[1].state}"
	},
	
	/*
	 * This actions_chooser populates menu that drops down when you clock
	 * on the top button.
	 *
	 * NOTE: There are NO default commands.  You must supply the appropriate
	 * commands for your installation.
	 */   
	"actions_chooser": [
		{"type": "gcode", "gcode": "G10 P0 S-273.15 R-273.15", "label": "Off"},
		{"type": "gcode", "gcode": "T-1", "label": "Standby"},
		{"type": "gcode", "gcode": "T0", "label": "On"},
		{"type": "gcode", "gcode": "M562 P1", "label": "Reset"},
		{"type": "gcode", "gcode": "M303 H1 P1 S${status.tools[0].active[0]}", "label": "Tune"},
	],
	
	/*
	 * These are the fields in the status object that contain the teperatures
	 */
	"temp_fields": {
		"current": "${status.heat.heaters[1].current.toFixed(1)}",
		"active": "${status.tools[0].active[0]}",
		"standby": "${status.tools[0].standby[0]}",
	},
	
	/*
	 * These are the commands needed to set the active and standby temperatures
	 * NOTE: The "value" substitution variable will be repalced with whatever
	 * the current values of the active and standby input fields are.
	 */
	"set_temp_commands": {
		"active": "G10 P0 R${value}",
		"standby": "G10 P0 S${value}"
	}
	
	/*
	 * The two input fields for setting the active and standby can be hidden
	 * if desired.  The default is to show them.
	 */
	 "show_set_fields": false
}
Clone this wiki locally