Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ExtruderMaker.cpp Source File

ExtruderMaker.cpp

00001 /*
00002       This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
00003       Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
00004       Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00005       You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
00006 */
00007 
00008 #include "libs/Module.h"
00009 #include "libs/Kernel.h"
00010 #include <math.h>
00011 using namespace std;
00012 #include <vector>
00013 #include "ExtruderMaker.h"
00014 #include "Extruder.h"
00015 
00016 ExtruderMaker::ExtruderMaker(){}
00017 
00018 void ExtruderMaker::on_module_loaded(){
00019 
00020     // If there is a "single" extruder configured ( old config syntax from when there was only one extruder module, no pool/maker
00021     if( THEKERNEL->config->value( extruder_module_enable_checksum )->by_default(false)->as_bool() == true ){
00022    
00023         // Make a new extruder module
00024         Extruder* extruder = new Extruder(0); 
00025 
00026         // Signal the extruder it will have to read config as an alone extruder
00027         extruder->single_config = true; 
00028   
00029         // Add the module to the kernel
00030         THEKERNEL->add_module( extruder ); 
00031   
00032         // Add the module to the ToolsManager
00033         THEKERNEL->toolsmanager->add_tool( extruder );        
00034 
00035     }
00036 
00037     // Get every "declared" extruder module ( new, multiextruder syntax )
00038     vector<uint16_t> modules;
00039     THEKERNEL->config->get_module_list( &modules, extruder_checksum );
00040     
00041     // For every extruder found 
00042     for( unsigned int i = 0; i < modules.size(); i++ ){
00043 
00044         // If module is enabled
00045         if( THEKERNEL->config->value(extruder_checksum, modules[i], enable_checksum )->as_bool() == true ){
00046        
00047             // Make a new extruder module
00048             Extruder* extruder = new Extruder(modules[i]); 
00049 
00050             // Add the module to the kernel
00051             THEKERNEL->add_module( extruder ); 
00052       
00053             // Add the module to the ToolsManager
00054             THEKERNEL->toolsmanager->add_tool( extruder );        
00055 
00056         }
00057 
00058     }
00059 
00060 }
00061 
00062 
00063 
00064 
00065