#include "modules/tools/switch/SwitchPool.h"
#include "modules/tools/temperatureswitch/TemperatureSwitch.h"
#include "modules/tools/drillingcycles/Drillingcycles.h"
+#include "FilamentDetector.h"
#include "modules/robot/Conveyor.h"
#include "modules/utils/simpleshell/SimpleShell.h"
#ifndef NO_TOOLS_DRILLINGCYCLES
kernel->add_module( new Drillingcycles() );
#endif
+ #ifndef NO_TOOLS_FILAMENTDETECTOR
+ kernel->add_module( new FilamentDetector() );
+ #endif
// Create and initialize USB stuff
u.init();
endif
# add any modules that you do not want included in the build
-export EXCLUDED_MODULES = tools/touchprobe
+EXCLUDE_MODULES = tools/touchprobe
# e.g for a CNC machine
#export EXCLUDED_MODULES = tools/touchprobe tools/laser tools/temperaturecontrol tools/extruder
+ifneq "$(INCLUDE_MODULE)" ""
+export EXCLUDED_MODULES = $(filter-out $(INCLUDE_MODULE),$(EXCLUDE_MODULES))
+else
+export EXCLUDED_MODULES = $(EXCLUDE_MODULES)
+endif
+
+
# set to not compile in any network support
#export NONETWORK = 1
return;
}
- // load settings
+ // encoder pin has to be interrupt enabled pin like 0.26, 0.27, 0.28
Pin dummy_pin;
dummy_pin.from_string( THEKERNEL->config->value(filament_detector_checksum, encoder_pin_checksum)->by_default("nc" )->as_string());
this->encoder_pin= dummy_pin.interrupt_pin();
return;
}
+ // set interrupt on rising edge
this->encoder_pin->rise(this, &FilamentDetector::on_pin_rise);
NVIC_SetPriority(EINT3_IRQn, 16); // set to low priority
THEKERNEL->slow_ticker->attach( 100, this, &FilamentDetector::button_tick);
}
+ // how many seconds between checks, must be long enough for several pulses to be detected, but not too long
seconds_per_check= THEKERNEL->config->value(filament_detector_checksum, seconds_per_check_checksum)->by_default(2)->as_number();
+
+ // the number of pulses per mm of filament moving through the detector, can be fractional
pulses_per_mm= THEKERNEL->config->value(filament_detector_checksum, pulses_per_mm_checksum)->by_default(1)->as_number();
// register event-handlers