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 Extruder.h Source File

Extruder.h

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 
00009 
00010 #ifndef EXTURDER_MODULE_H
00011 #define EXTRUDER_MODULE_H
00012 
00013 #include "libs/Module.h"
00014 #include "libs/Kernel.h"
00015 #include "modules/robot/Block.h"
00016 #include "modules/tools/toolsmanager/Tool.h"
00017 
00018 #define OFF 0
00019 #define SOLO 1
00020 #define FOLLOW 2
00021 
00022 class Extruder : public Module, public Tool {
00023     public:
00024         Extruder(uint16_t config_identifier);
00025         void     on_module_loaded();
00026         void     on_config_reload(void* argument);
00027         void     on_gcode_received(void*);
00028         void     on_gcode_execute(void* argument);
00029         void     on_block_begin(void* argument);
00030         void     on_block_end(void* argument);
00031         void     on_play(void* argument);
00032         void     on_pause(void* argument);
00033         void     on_speed_change(void* argument);
00034         uint32_t acceleration_tick(uint32_t dummy);
00035         uint32_t stepper_motor_finished_move(uint32_t dummy);
00036         Block*   append_empty_block();
00037 
00038         Pin             step_pin;                     // Step pin for the stepper driver
00039         Pin             dir_pin;                      // Dir pin for the stepper driver
00040         Pin             en_pin;
00041 
00042         float          target_position;              // End point ( in mm ) for the current move
00043         float          current_position;             // Current point ( in mm ) for the current move, incremented every time a move is executed
00044         float          unstepped_distance;           // overflow buffer for requested moves that are less than 1 step
00045         Block*          current_block;                // Current block we are stepping, same as Stepper's one
00046         float          steps_per_millimeter;         // Steps to travel one millimeter
00047         float          feed_rate;                    //
00048         float          acceleration;                 //
00049         float          max_speed;
00050 
00051         float          travel_ratio;
00052         float          travel_distance;
00053         bool            absolute_mode;                // absolute/relative coordinate mode switch
00054 
00055         char mode;                                    // extruder motion mode,  OFF, SOLO, or FOLLOW
00056 
00057         bool paused;
00058         bool single_config;
00059 
00060         uint16_t identifier;
00061 
00062         StepperMotor* stepper_motor;
00063 
00064 };
00065 
00066 #endif