forgot StreamOutput
[clinton/Smoothieware.git] / src / modules / tools / extruder / Extruder.h
CommitLineData
cd011f58
AW
1/*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 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.
4 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.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6*/
7
8
9
4cff3ded
AW
10#ifndef EXTURDER_MODULE_H
11#define EXTRUDER_MODULE_H
12
4cff3ded
AW
13#include "libs/Module.h"
14#include "libs/Kernel.h"
15#include "modules/robot/Block.h"
16
17#define microseconds_per_step_pulse_ckeckusm 42333
436a2cd1 18#define extruder_module_enable_checksum 6183
dd3b416b
AW
19#define steps_per_millimeter_checksum 58088
20#define default_feed_rate_checksum 53183
21#define acceleration_checksum 60356
22
ded56b35
AW
23#define OFF 0
24#define SOLO 1
25#define FOLLOW 2
4cff3ded
AW
26
27class Extruder : public Module{
28 public:
0eb11a06 29 Extruder(PinName stppin, PinName dirpin);
4cff3ded 30 void on_module_loaded();
da24d6ae 31 void on_config_reload(void* argument);
436a2cd1 32 void on_gcode_execute(void* argument);
4cff3ded
AW
33 void on_block_begin(void* argument);
34 void on_block_end(void* argument);
81b547a1
AW
35 void on_play(void* argument);
36 void on_pause(void* argument);
ded56b35 37 void set_speed(int steps_per_second);
4cff3ded
AW
38 void acceleration_tick();
39 void stepping_tick();
3b1e82d2 40 void reset_step_pin();
4cff3ded
AW
41
42 DigitalOut step_pin; // Step pin for the stepper driver
0eb11a06 43 DigitalOut dir_pin; // Dir pin for the stepper driver
e2b4a32b
AW
44 double start_position; // Start point ( in steps ) for the current move
45 double target_position; // End point ( in steps ) for the current move
46 double current_position; // Current point ( in steps ) for the current move, incremented every time a step is outputed
4cff3ded
AW
47 Block* current_block; // Current block we are stepping, same as Stepper's one
48 int microseconds_per_step_pulse; // Pulse duration for step pulses
dd3b416b
AW
49 double steps_per_millimeter; // Steps to travel one millimeter
50 double feed_rate; //
51 double acceleration; //
4cff3ded 52
3b1e82d2
AW
53 int counter_increment;
54 int step_counter;
ded56b35 55
436a2cd1
AW
56 bool solo_mode;
57 double travel_ratio;
58 double travel_distance;
59 bool absolute_mode;
0eb11a06
AW
60
61 int direction;
ecc402eb
AW
62
63 bool debug;
64 int debug_count;
ded56b35
AW
65
66 char mode;
67 bool acceleration_lock;
81b547a1
AW
68
69 bool paused;
4cff3ded
AW
70};
71
72#endif