+#temperature_control.hotend.max_temp 300 # Set maximum temperature - Will prevent heating above 300 by default
+#temperature_control.hotend.min_temp 0 # Set minimum temperature - Will prevent heating below 0 by default
# NOTE Lines must not exceed 132 characters
# Robot module configurations : general handling of movement G-codes and slicing into moves
default_feed_rate 4000 # Default rate ( mm/minute ) for G1/G2/G3 moves
temperature_control.hotend.set_m_code 104 #
temperature_control.hotend.set_and_wait_m_code 109 #
temperature_control.hotend.designator T #
+#temperature_control.hotend.max_temp 300 # Set maximum temperature - Will prevent heating above 300 by default
+#temperature_control.hotend.min_temp 0 # Set minimum temperature - Will prevent heating below 0 by default
#temperature_control.hotend.p_factor 13.7 # permanently set the PID values after an auto pid
#temperature_control.hotend.i_factor 0.097 #
name_checksum= name;
pool_index= index;
waiting= false;
- min_temp_violated= false;
+ temp_violated= false;
sensor= nullptr;
readonly= false;
}
void TemperatureControl::on_main_loop(void *argument)
{
- if (this->min_temp_violated) {
- THEKERNEL->streams->printf("Error: MINTEMP triggered. Check your temperature sensors!\n");
- this->min_temp_violated = false;
+ if (this->temp_violated) {
+ this->temp_violated = false;
+ THEKERNEL->streams->printf("!! Error: MINTEMP or MAXTEMP triggered. Check your temperature sensors!\n");
+ THEKERNEL->streams->printf("HALT asserted - reset or M999 required\n");
+ THEKERNEL->call_event(ON_HALT, nullptr);
}
}
this->designator = THEKERNEL->config->value(temperature_control_checksum, this->name_checksum, designator_checksum)->by_default(string("T"))->as_string();
// Max and min temperatures we are not allowed to get over (Safety)
- this->max_temp = THEKERNEL->config->value(temperature_control_checksum, this->name_checksum, max_temp_checksum)->by_default(1000)->as_number();
+ this->max_temp = THEKERNEL->config->value(temperature_control_checksum, this->name_checksum, max_temp_checksum)->by_default(300)->as_number();
this->min_temp = THEKERNEL->config->value(temperature_control_checksum, this->name_checksum, min_temp_checksum)->by_default(0)->as_number();
// Heater pin
// readonly sensors don't handle the rest
if(this->readonly) return;
- if (gcode->m == 301) {
+ if (gcode->m == 143) {
+ if (gcode->has_letter('S') && (gcode->get_value('S') == this->pool_index)) {
+ if(gcode->has_letter('P')) {
+ max_temp= gcode->get_value('P');
+
+ } else {
+ gcode->stream->printf("Nothing set NOTE Usage is M143 S0 P300 where <S> is the hotend index and <P> is the maximum temp to set\n");
+ }
+
+ }else if(gcode->get_num_args() == 0) {
+ gcode->stream->printf("Maximum temperature for %s(%d) is %f°C\n", this->designator.c_str(), this->pool_index, max_temp);
+ }
+
+ } else if (gcode->m == 301) {
if (gcode->has_letter('S') && (gcode->get_value('S') == this->pool_index)) {
if (gcode->has_letter('P'))
setPIDp( gcode->get_value('P') );
} else if (gcode->m == 500 || gcode->m == 503) { // M500 saves some volatile settings to config override file, M503 just prints the settings
gcode->stream->printf(";PID settings:\nM301 S%d P%1.4f I%1.4f D%1.4f X%1.4f Y%d\n", this->pool_index, this->p_factor, this->i_factor / this->PIDdt, this->d_factor * this->PIDdt, this->i_max, this->heater_pin.max_pwm());
+ gcode->stream->printf(";Max temperature setting:\nM143 S%d P%1.4f\n", this->pool_index, this->max_temp);
+
if(this->sensor_settings) {
// get or save any sensor specific optional values
TempSensor::sensor_options_t options;
{
float temperature = sensor->get_temperature();
if(!this->readonly && target_temperature > 2) {
- if (isinf(temperature) || temperature < min_temp) {
- this->min_temp_violated = true;
+ if (isinf(temperature) || temperature < min_temp || temperature > max_temp) {
+ this->temp_violated = true;
target_temperature = UNDEFINED;
heater_pin.set((this->o = 0));
} else {