void Config::on_console_line_received( void *argument ) {}
-// Set a value in the config cache, but not in any config source
-void Config::set_string( string setting, string value )
-{
- if(!is_config_cache_loaded()) return;
-
- ConfigValue *cv = new ConfigValue;
- cv->found = true;
- get_checksums(cv->check_sums, setting);
- cv->value = value;
-
- this->config_cache->replace_or_push_back(cv);
-
- THEKERNEL->call_event(ON_CONFIG_RELOAD);
-}
-
// Get a list of modules, used by module "pools" that look for the "enable" keyboard to find things like "moduletype.modulename.enable" as the marker of a new instance of a module
void Config::get_module_list(vector<uint16_t> *list, uint16_t family)
{
&Module::on_speed_change,
&Module::on_block_begin,
&Module::on_block_end,
- &Module::on_config_reload,
&Module::on_play,
&Module::on_pause,
&Module::on_idle,
ON_SPEED_CHANGE,
ON_BLOCK_BEGIN,
ON_BLOCK_END,
- ON_CONFIG_RELOAD,
ON_PLAY,
ON_PAUSE,
ON_IDLE,
virtual void on_speed_change(void*){};
virtual void on_block_begin(void*){};
virtual void on_block_end(void*){};
- virtual void on_config_reload(void*){};
virtual void on_play(void*){};
virtual void on_pause(void*){};
virtual void on_idle(void*){};
void Conveyor::on_module_loaded(){
register_for_event(ON_IDLE);
register_for_event(ON_MAIN_LOOP);
- register_for_event(ON_CONFIG_RELOAD);
on_config_reload(this);
}
}
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);
this->register_for_event(ON_GET_PUBLIC_DATA);
this->register_for_event(ON_SET_PUBLIC_DATA);
//Called when the module has just been loaded
void Stepper::on_module_loaded(){
- 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);
return;
}
- register_for_event(ON_CONFIG_RELOAD);
register_for_event(ON_GCODE_RECEIVED);
register_for_event(ON_GET_PUBLIC_DATA);
register_for_event(ON_SET_PUBLIC_DATA);
this->on_config_reload(this);
// 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);
{
this->switch_changed = false;
- register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_GCODE_EXECUTE);
this->register_for_event(ON_MAIN_LOOP);
this->on_config_reload(this);
// 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);
void ToolManager::on_module_loaded(){
this->on_config_reload(this);
- this->register_for_event(ON_CONFIG_RELOAD);
this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_GET_PUBLIC_DATA);
this->register_for_event(ON_SET_PUBLIC_DATA);
// load settings
this->on_config_reload(this);
// register event-handlers
- register_for_event(ON_CONFIG_RELOAD);
register_for_event(ON_GCODE_RECEIVED);
register_for_event(ON_IDLE);
return;
}
- register_for_event(ON_CONFIG_RELOAD);
-
//register_for_event(ON_PLAY);
//TODO: these two events happen in interrupt context and it's extremely important they don't last long. This should be done by checking the size of the queue once a second or something
//register_for_event(ON_BLOCK_BEGIN);
get_checksums(cs, key);
stream->printf( "checksum of %s = %02X %02X %02X\n", key.c_str(), cs[0], cs[1], cs[2]);
- } else if(source == "") {
- THEKERNEL->config->config_cache_load();
- THEKERNEL->call_event(ON_CONFIG_RELOAD);
- stream->printf( "Reloaded settings\r\n" );
- THEKERNEL->config->config_cache_clear();
-
- } else if(file_exists(source)) {
- FileConfigSource fcs(source, "userfile");
- THEKERNEL->config->config_cache_load(false);
- fcs.transfer_values_to_cache(THEKERNEL->config->config_cache);
- THEKERNEL->call_event(ON_CONFIG_RELOAD);
- stream->printf( "Loaded settings from %s\r\n", source.c_str() );
- THEKERNEL->config->config_cache_clear();
} else {
- uint16_t source_checksum = get_checksum(source);
- for(unsigned int i = 0; i < THEKERNEL->config->config_sources.size(); i++) {
- if( THEKERNEL->config->config_sources[i]->is_named(source_checksum) ) {
- THEKERNEL->config->config_cache_load(false);
- THEKERNEL->config->config_sources[i]->transfer_values_to_cache(THEKERNEL->config->config_cache);
- THEKERNEL->call_event(ON_CONFIG_RELOAD);
- stream->printf( "Loaded settings from %s\r\n", source.c_str() );
- THEKERNEL->config->config_cache_clear();
- break;
- }
- }
+ stream->printf( "unsupported option\n" );
}
}