Merge pull request #966 from wolfmanjm/upstreamedge
[clinton/Smoothieware.git] / src / modules / tools / extruder / Extruder.h
CommitLineData
ca037905 1/*
cd011f58
AW
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.
ca037905 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
cd011f58
AW
6*/
7
8
9
13ad7234 10#pragma once
4cff3ded 11
17c89e4d 12#include "Tool.h"
61134a65
JM
13#include "Pin.h"
14
de2ee57c
JM
15#include <tuple>
16
61134a65 17class StepperMotor;
4cff3ded 18
17c89e4d
JM
19// NOTE Tool is also a module, no need for multiple inheritance here
20class Extruder : public Tool {
4cff3ded 21 public:
13ad7234 22 Extruder(uint16_t config_identifier);
3494f3d0 23 virtual ~Extruder();
17c89e4d 24
8519d744 25 void on_module_loaded();
8519d744 26 void on_gcode_received(void*);
29e809e0
JM
27
28 void select();
29 void deselect();
41269f21 30 float get_e_scale(void) const { return volumetric_multiplier * extruder_multiplier; }
4cff3ded 31
17c89e4d 32 private:
29e809e0 33 void config_load();
d87968be 34 void on_get_public_data(void* argument);
d467fcad 35 void on_set_public_data(void* argument);
fe484657 36 float check_max_speeds(float target, float isecs);
55783268
JM
37 void save_position();
38 void restore_position();
540c8365 39
13ad7234 40 StepperMotor *stepper_motor;
8a3ae3d0 41
ed68c716
JM
42 float extruder_multiplier; // flow rate 1.0 == 100%
43 float filament_diameter; // filament diameter
d467fcad 44 float volumetric_multiplier;
928467c0 45 float max_volumetric_rate; // used for calculating volumetric rate in mm³/sec
4cff3ded 46
ec6fde0b 47 // for firmware retract
ed68c716 48 float retract_length; // firmware retract length
d467fcad
JM
49 float retract_feedrate;
50 float retract_recover_feedrate;
51 float retract_recover_length;
52 float retract_zlift_length;
53 float retract_zlift_feedrate;
ec6fde0b 54
de2ee57c
JM
55 // for saving and restoring extruder position
56 std::tuple<float, float, int32_t> saved_position;
57
8a3ae3d0 58 struct {
13ad7234 59 uint8_t motor_id:8;
ec6fde0b 60 bool retracted:1;
78af0407 61 bool cancel_zlift_restore:1; // hack to stop a G11 zlift restore from overring an absolute Z setting
29e809e0 62 bool selected:1;
de2ee57c 63 bool saved_selected:1;
d43bc398 64 bool g92e0_detected:1;
8a3ae3d0 65 };
4cff3ded 66};