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

Touchprobe.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 #ifndef TOUCHPROBE_H_
00009 #define TOUCHPROBE_H_
00010 
00011 #include "libs/Module.h"
00012 #include "libs/SDFAT.h"
00013 #include "modules/robot/Conveyor.h"
00014 #include "libs/Kernel.h"
00015 #include "modules/communication/utils/Gcode.h"
00016 #include "libs/StepperMotor.h"
00017 #include "libs/Pin.h"
00018 
00019 #define touchprobe_enable_checksum           CHECKSUM("touchprobe_enable")
00020 #define touchprobe_log_enable_checksum       CHECKSUM("touchprobe_log_enable")
00021 #define touchprobe_logfile_name_checksum     CHECKSUM("touchprobe_logfile_name")
00022 #define touchprobe_log_rotate_mcode_checksum CHECKSUM("touchprobe_log_rotate_mcode")
00023 #define touchprobe_pin_checksum              CHECKSUM("touchprobe_pin")
00024 #define touchprobe_debounce_count_checksum   CHECKSUM("touchprobe_debounce_count")
00025 
00026 
00027 class Touchprobe: public Module {
00028     private:
00029         void wait_for_touch(int distance[]);
00030         void flush_log();
00031 
00032         FILE*          logfile;
00033         string         filename;
00034         StepperMotor*  steppers[3];
00035         Pin            pin;
00036         unsigned int   debounce_count;
00037 
00038     public:
00039         void on_module_loaded();
00040         void on_config_reload(void* argument);
00041         void on_gcode_received(void* argument);
00042         void on_idle(void* argument);
00043 
00044         float         probe_rate;
00045         unsigned int   mcode;
00046         bool           enabled;
00047         bool           should_log;
00048 };
00049 
00050 #endif /* TOUCHPROBE_H_ */