const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
+
+// M240 Triggers a camera by emulating a Canon RC-1 Remote
+// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
+// #define PHOTOGRAPH_PIN 23
+
//===========================================================================
//=============================Buffers ============================
//===========================================================================
#include "motion_control.h"
#include "cardreader.h"
#include "watchdog.h"
+#include <util/delay.h>
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
// M206 - set additional homeing offset
// M220 - set speed factor override percentage S:factor in percent
+// M240 - Trigger a camera to take a photograph
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
// M400 - Finish all moves
buflen += 1;
}
}
-
+void setup_photpin()
+{
+ #ifdef PHOTOGRAPH_PIN
+ #if (PHOTOGRAPH_PIN > -1)
+ SET_OUTPUT(PHOTOGRAPH_PIN);
+ WRITE(PHOTOGRAPH_PIN, LOW);
+ #endif
+ #endif
+}
void setup()
{
MSerial.begin(BAUDRATE);
plan_init(); // Initialize planner;
st_init(); // Initialize stepper;
wd_init();
+ setup_photpin();
}
}
}
break;
+
+
#ifdef PIDTEMP
case 301: // M301
}
break;
#endif //PIDTEMP
+ case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
+ {
+ #ifdef PHOTOGRAPH_PIN
+ #if (PHOTOGRAPH_PIN > -1)
+ const uint8_t NUM_PULSES=16;
+ const float PULSE_LENGTH=0.01524;
+ for(int i=0; i < NUM_PULSES; i++) {
+ WRITE(PHOTOGRAPH_PIN, HIGH);
+ _delay_ms(PULSE_LENGTH);
+ WRITE(PHOTOGRAPH_PIN, LOW);
+ _delay_ms(PULSE_LENGTH);
+ }
+ delay(7.33);
+ for(int i=0; i < NUM_PULSES; i++) {
+ WRITE(PHOTOGRAPH_PIN, HIGH);
+ _delay_ms(PULSE_LENGTH);
+ WRITE(PHOTOGRAPH_PIN, LOW);
+ _delay_ms(PULSE_LENGTH);
+ }
+ #endif
+ #endif
+ }
+ break;
case 302: // finish all moves
{