Ensure laser TTL isn't switched off until last block of a G2/G3
[clinton/Smoothieware.git] / src / modules / tools / laser / Laser.h
CommitLineData
de91760a 1/*
4cff3ded
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.
de91760a 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
4cff3ded
AW
6*/
7
8#ifndef LASER_MODULE_H
9#define LASER_MODULE_H
10
4cff3ded 11#include "libs/Module.h"
4cff3ded 12
1f19c40d
JM
13namespace mbed {
14 class PwmOut;
15}
4287ba0c 16class Pin;
f5598f5b 17
4cff3ded
AW
18class Laser : public Module{
19 public:
e605a0d6 20 Laser();
eeef2894 21 virtual ~Laser() {};
4cff3ded 22 void on_module_loaded();
a2cd92c0
AW
23 void on_block_end(void* argument);
24 void on_block_begin(void* argument);
4cff3ded
AW
25 void on_gcode_execute(void* argument);
26 void on_speed_change(void* argument);
f95c9fce 27 void on_halt(void* argument);
4cff3ded 28
1f19c40d
JM
29 private:
30 void set_proportional_power();
4287ba0c
FM
31 mbed::PwmOut *pwm_pin; // PWM output to regulate the laser power
32 Pin *ttl_pin; // TTL output to fire laser
86fa0b93 33 struct {
4287ba0c
FM
34 bool laser_on:1; // Laser status
35 bool pwm_inverting:1; // stores whether the PWM period should be inverted
36 bool ttl_used:1; // stores whether we have a TTL output
37 bool ttl_inverting:1; // stores whether the TTL output should be inverted
86fa0b93 38 };
6e986d7e
BC
39 float laser_maximum_power; // maximum allowed laser power to be output on the pwm pin
40 float laser_minimum_power; // value used to tickle the laser on moves. Also minimum value for auto-scaling
024545c5 41 float laser_power; // current laser power
4cff3ded
AW
42};
43
2f37949e 44#endif