#include "TemperatureControlPool.h"
#include "libs/Pin.h"
#include "libs/Median.h"
+#include "modules/robot/Conveyor.h"
#include "MRI_Hooks.h"
if (this->min_temp_violated) {
kernel->streams->printf("MINTEMP triggered on P%d.%d! check your thermistors!\n", this->thermistor_pin.port_number, this->thermistor_pin.pin);
this->min_temp_violated = false;
- }
+ }
}
// Get configuration from the config file
this->get_m_code = this->kernel->config->value(temperature_control_checksum, this->name_checksum, get_m_code_checksum)->by_default(105)->as_number();
this->readings_per_second = this->kernel->config->value(temperature_control_checksum, this->name_checksum, readings_per_second_checksum)->by_default(20)->as_number();
- this->max_pwm = this->kernel->config->value(temperature_control_checksum, this->name_checksum, max_pwm_checksum)->by_default(255)->as_number();
-
this->designator = this->kernel->config->value(temperature_control_checksum, this->name_checksum, designator_checksum)->by_default(string("T"))->as_string();
// Values are here : http://reprap.org/wiki/Thermistor
// Heater pin
this->heater_pin.from_string( this->kernel->config->value(temperature_control_checksum, this->name_checksum, heater_pin_checksum)->required()->as_string())->as_output();
+ this->heater_pin.max_pwm( this->kernel->config->value(temperature_control_checksum, this->name_checksum, max_pwm_checksum)->by_default(255)->as_number() );
this->heater_pin.set(0);
set_low_on_debug(heater_pin.port_number, heater_pin.pin);
this->last_reading = 0.0;
}
-void TemperatureControl::on_gcode_received(void* argument)
-{
+void TemperatureControl::on_gcode_received(void* argument){
Gcode* gcode = static_cast<Gcode*>(argument);
if (gcode->has_m)
{
this->pool->PIDtuner->begin(this, target, gcode->stream);
}
}
+
+ // Attach gcodes to the last block for on_gcode_execute
+ if( ( gcode->m == this->set_m_code || gcode->m == this->set_and_wait_m_code ) && gcode->has_letter('S') ){
+ if( this->kernel->conveyor->queue.size() == 0 ){
+ this->kernel->call_event(ON_GCODE_EXECUTE, gcode );
+ }else{
+ Block* block = this->kernel->conveyor->queue.get_ref( this->kernel->conveyor->queue.size() - 1 );
+ block->append_gcode(gcode);
+ gcode->queued++;
+ }
+ }
}
}
this->o = 0;
}
- if( this->o > this->max_pwm ){ this->o = max_pwm; }
-
this->heater_pin.pwm(o);
}