Browse Source

added m240 photography support. default off

Bernhard 12 years ago
parent
commit
212515148e
2 changed files with 42 additions and 1 deletions
  1. 5
    0
      Marlin/Configuration.h
  2. 37
    1
      Marlin/Marlin.pde

+ 5
- 0
Marlin/Configuration.h View File

363
 
363
 
364
 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
364
 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
365
 
365
 
366
+
367
+// M240  Triggers a camera by emulating a Canon RC-1 Remote
368
+// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
369
+// #define PHOTOGRAPH_PIN     23
370
+
366
 //===========================================================================
371
 //===========================================================================
367
 //=============================Buffers           ============================
372
 //=============================Buffers           ============================
368
 //===========================================================================
373
 //===========================================================================

+ 37
- 1
Marlin/Marlin.pde View File

41
 #include "motion_control.h"
41
 #include "motion_control.h"
42
 #include "cardreader.h"
42
 #include "cardreader.h"
43
 #include "watchdog.h"
43
 #include "watchdog.h"
44
+#include <util/delay.h>
44
 
45
 
45
 
46
 
46
 
47
 
109
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
110
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
110
 // M206 - set additional homeing offset
111
 // M206 - set additional homeing offset
111
 // M220 - set speed factor override percentage S:factor in percent
112
 // M220 - set speed factor override percentage S:factor in percent
113
+// M240 - Trigger a camera to take a photograph
112
 // M301 - Set PID parameters P I and D
114
 // M301 - Set PID parameters P I and D
113
 // M302 - Allow cold extrudes
115
 // M302 - Allow cold extrudes
114
 // M400 - Finish all moves
116
 // M400 - Finish all moves
227
     buflen += 1;
229
     buflen += 1;
228
   }
230
   }
229
 }
231
 }
230
-
232
+void setup_photpin()
233
+{
234
+  #ifdef PHOTOGRAPH_PIN
235
+    #if (PHOTOGRAPH_PIN > -1)
236
+    SET_OUTPUT(PHOTOGRAPH_PIN);
237
+    WRITE(PHOTOGRAPH_PIN, LOW);
238
+    #endif
239
+  #endif 
240
+}
231
 void setup()
241
 void setup()
232
 { 
242
 { 
233
   MSerial.begin(BAUDRATE);
243
   MSerial.begin(BAUDRATE);
255
   plan_init();  // Initialize planner;
265
   plan_init();  // Initialize planner;
256
   st_init();    // Initialize stepper;
266
   st_init();    // Initialize stepper;
257
   wd_init();
267
   wd_init();
268
+  setup_photpin();
258
 }
269
 }
259
 
270
 
260
 
271
 
1064
       }
1075
       }
1065
     }
1076
     }
1066
     break;
1077
     break;
1078
+    
1079
+    
1067
 
1080
 
1068
     #ifdef PIDTEMP
1081
     #ifdef PIDTEMP
1069
     case 301: // M301
1082
     case 301: // M301
1089
       }
1102
       }
1090
       break;
1103
       break;
1091
     #endif //PIDTEMP
1104
     #endif //PIDTEMP
1105
+    case 240: // M240  Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
1106
+     {
1107
+      #ifdef PHOTOGRAPH_PIN
1108
+        #if (PHOTOGRAPH_PIN > -1)
1109
+        const uint8_t NUM_PULSES=16;
1110
+        const float PULSE_LENGTH=0.01524;
1111
+        for(int i=0; i < NUM_PULSES; i++) {
1112
+          WRITE(PHOTOGRAPH_PIN, HIGH);
1113
+          _delay_ms(PULSE_LENGTH);
1114
+          WRITE(PHOTOGRAPH_PIN, LOW);
1115
+          _delay_ms(PULSE_LENGTH);
1116
+        }
1117
+        delay(7.33);
1118
+        for(int i=0; i < NUM_PULSES; i++) {
1119
+          WRITE(PHOTOGRAPH_PIN, HIGH);
1120
+          _delay_ms(PULSE_LENGTH);
1121
+          WRITE(PHOTOGRAPH_PIN, LOW);
1122
+          _delay_ms(PULSE_LENGTH);
1123
+        }
1124
+        #endif
1125
+      #endif
1126
+     }
1127
+    break;
1092
       
1128
       
1093
     case 302: // finish all moves
1129
     case 302: // finish all moves
1094
     {
1130
     {

Loading…
Cancel
Save