modify makefile so excluded modules can be included on the command line
authorJim Morris <morris@wolfman.com>
Sat, 28 Feb 2015 10:30:04 +0000 (02:30 -0800)
committerJim Morris <morris@wolfman.com>
Sat, 28 Feb 2015 10:30:04 +0000 (02:30 -0800)
src/main.cpp
src/makefile
src/modules/tools/filamentdetector/FilamentDetector.cpp

index cc8cae3..656772a 100644 (file)
@@ -17,6 +17,7 @@
 #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"
@@ -188,6 +189,9 @@ void init() {
     #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();
index c838bf6..047b097 100644 (file)
@@ -59,10 +59,17 @@ DEFINES += -DSTEPTICKER_DEBUG_PIN=$(STEPTICKER_DEBUG_PIN)
 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
 
index 71fa65d..6f2363f 100644 (file)
@@ -50,7 +50,7 @@ void FilamentDetector::on_module_loaded()
         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();
@@ -60,6 +60,7 @@ void FilamentDetector::on_module_loaded()
         return;
     }
 
+    // set interrupt on rising edge
     this->encoder_pin->rise(this, &FilamentDetector::on_pin_rise);
     NVIC_SetPriority(EINT3_IRQn, 16); // set to low priority
 
@@ -70,7 +71,10 @@ void FilamentDetector::on_module_loaded()
         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