smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

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 
00017 #define microseconds_per_step_pulse_checksum 42333
00018 #define extruder_module_enable_checksum      6183
00019 #define extruder_steps_per_mm_checksum       58088
00020 #define default_feed_rate_checksum           53183
00021 #define acceleration_checksum                60356
00022 
00023 #define OFF 0
00024 #define SOLO 1
00025 #define FOLLOW 2
00026 
00027 class Extruder : public Module{
00028     public:
00029         Extruder();
00030         virtual void on_module_loaded();
00031         virtual void on_config_reload(void* argument);
00032         virtual void on_gcode_execute(void* argument);
00033         virtual void on_block_begin(void* argument);
00034         virtual void on_block_end(void* argument);
00035         virtual void on_play(void* argument);
00036         virtual void on_pause(void* argument);
00037         void set_speed(int steps_per_second);
00038         uint32_t acceleration_tick(uint32_t dummy);
00039         uint32_t stepping_tick(uint32_t dummy);
00040         uint32_t reset_step_pin(uint32_t dummy);
00041 
00042         Pin*            step_pin;                     // Step pin for the stepper driver
00043         Pin*            dir_pin;                      // Dir pin for the stepper driver
00044         Pin*            en_pin;
00045 
00046         double          start_position;               // Start point ( in steps ) for the current move
00047         double          target_position;              // End point ( in steps ) for the current move
00048         double          current_position;             // Current point ( in steps ) for the current move, incremented every time a step is outputed
00049         Block*          current_block;                // Current block we are stepping, same as Stepper's one
00050         int             microseconds_per_step_pulse;  // Pulse duration for step pulses
00051         double          steps_per_millimeter;         // Steps to travel one millimeter
00052         double          feed_rate;                    //
00053         double          acceleration;                 //
00054 
00055         int             counter_increment;
00056         int             step_counter;
00057 
00058         bool            solo_mode;
00059         double          travel_ratio;
00060         double          travel_distance;
00061         bool            absolute_mode;
00062 
00063         int             direction;
00064 
00065         bool            debug;
00066         int debug_count;
00067 
00068         char mode;
00069         bool acceleration_lock;
00070 
00071         bool paused;
00072 };
00073 
00074 #endif