void Kernel::add_module(Module* module){
module->kernel = this;
module->on_module_loaded();
- module->register_for_event(ON_CONFIG_RELOAD);
}
void Kernel::register_for_event(_EVENT_ENUM id_event, Module* module){
}
void Planner::on_module_loaded(){
+ register_for_event(ON_CONFIG_RELOAD);
this->on_config_reload(this);
}
//Called when the module has just been loaded
void Robot::on_module_loaded() {
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_RECEIVED);
// Configuration
//Called when the module has just been loaded
void Stepper::on_module_loaded(){
stepper = this;
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_BLOCK_BEGIN);
this->register_for_event(ON_BLOCK_END);
this->register_for_event(ON_GCODE_EXECUTE);
}
void Endstops::on_module_loaded() {
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_RECEIVED);
// Take StepperMotor objects from Robot and keep them here
this->en_pin->set(1);
// We work on the same Block as Stepper, so we need to know when it gets a new one and drops one
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_BLOCK_BEGIN);
this->register_for_event(ON_BLOCK_END);
this->register_for_event(ON_GCODE_RECEIVED);
}
void Switch::on_module_loaded(){
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_EXECUTE);
// Settings
this->acceleration_factor = 10;
// Register for events
+ register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_EXECUTE);
this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_MAIN_LOOP);