remove on_config_reload event
authorJim Morris <morris@wolfman.com>
Tue, 17 Jun 2014 08:24:15 +0000 (01:24 -0700)
committerJim Morris <morris@wolfman.com>
Tue, 17 Jun 2014 08:24:15 +0000 (01:24 -0700)
15 files changed:
src/libs/Config.cpp
src/libs/Module.cpp
src/libs/Module.h
src/modules/robot/Conveyor.cpp
src/modules/robot/Planner.cpp
src/modules/robot/Robot.cpp
src/modules/robot/Stepper.cpp
src/modules/tools/endstops/Endstops.cpp
src/modules/tools/extruder/Extruder.cpp
src/modules/tools/switch/Switch.cpp
src/modules/tools/temperaturecontrol/TemperatureControl.cpp
src/modules/tools/toolmanager/ToolManager.cpp
src/modules/tools/zprobe/ZProbe.cpp
src/modules/utils/PlayLed/PlayLed.cpp
src/modules/utils/configurator/Configurator.cpp

index d1df1fa..b4e11b7 100644 (file)
@@ -52,21 +52,6 @@ void Config::on_module_loaded() {}
 
 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)
 {
index 89ea65f..0878712 100644 (file)
@@ -21,7 +21,6 @@ const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = {
     &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,
index 7080c0d..8997b83 100644 (file)
@@ -17,7 +17,6 @@ enum _EVENT_ENUM {
     ON_SPEED_CHANGE,
     ON_BLOCK_BEGIN,
     ON_BLOCK_END,
-    ON_CONFIG_RELOAD,
     ON_PLAY,
     ON_PAUSE,
     ON_IDLE,
@@ -51,7 +50,6 @@ public:
     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*){};
index 9ec7561..d1f3ce7 100644 (file)
@@ -60,7 +60,6 @@ Conveyor::Conveyor(){
 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);
 }
index 30cbce6..059de15 100644 (file)
@@ -41,7 +41,6 @@ Planner::Planner(){
 }
 
 void Planner::on_module_loaded(){
-    register_for_event(ON_CONFIG_RELOAD);
     this->on_config_reload(this);
 }
 
index 0ac9704..ba88c1d 100644 (file)
@@ -129,7 +129,6 @@ Robot::Robot()
 //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);
index f82b803..6a4b6a1 100644 (file)
@@ -42,7 +42,6 @@ Stepper::Stepper(){
 
 //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);
index 47b2838..a24930b 100644 (file)
@@ -113,7 +113,6 @@ void Endstops::on_module_loaded()
         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);
index 6ba48e0..5dcfdd7 100644 (file)
@@ -85,7 +85,6 @@ void Extruder::on_module_loaded()
     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);
index 6ceff1c..ad277db 100644 (file)
@@ -49,7 +49,6 @@ void Switch::on_module_loaded()
 {
     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);
index aecc8b0..8c66c3f 100644 (file)
@@ -84,7 +84,6 @@ void TemperatureControl::on_module_loaded()
     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);
index 56385e0..bc5a022 100644 (file)
@@ -38,7 +38,6 @@ ToolManager::ToolManager(){
 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);
index c8f848a..4638f99 100644 (file)
@@ -63,7 +63,6 @@ void ZProbe::on_module_loaded()
     // 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);
 
index 0772624..96c647f 100644 (file)
@@ -29,8 +29,6 @@ void PlayLed::on_module_loaded()
         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);
index 861d250..0a29473 100644 (file)
@@ -171,32 +171,9 @@ void Configurator::config_load_command( string parameters, StreamOutput *stream
         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" );
     }
 }