Update and fix CHDK

This commit is contained in:
Scott Lahteine
2018-11-05 01:08:40 -06:00
parent fed84f2961
commit 498dfa291e
63 changed files with 548 additions and 137 deletions

View File

@ -22,20 +22,24 @@
#include "../../../inc/MarlinConfig.h"
#if defined(CHDK) || HAS_PHOTOGRAPH
#if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH
#include "../../gcode.h"
bool chdk_active; // = false
millis_t chdk_timeout;
/**
* M240: Trigger a camera by emulating a Canon RC-1
* See http://www.doc-diy.net/photo/rc-1_hacked/
*/
void GcodeSuite::M240() {
#ifdef CHDK
OUT_WRITE(CHDK, HIGH);
chdkHigh = millis();
chdkActive = true;
#if PIN_EXISTS(CHDK)
OUT_WRITE(CHDK_PIN, HIGH);
chdk_timeout = millis() + CHDK_DELAY;
chdk_active = true;
#elif HAS_PHOTOGRAPH
@ -58,4 +62,4 @@ void GcodeSuite::M240() {
#endif
}
#endif // CHDK || HAS_PHOTOGRAPH
#endif // CHDK_PIN || HAS_PHOTOGRAPH

View File

@ -522,7 +522,7 @@ void GcodeSuite::process_parsed_command(
case 304: M304(); break; // M304: Set bed PID parameters
#endif
#if defined(CHDK) || HAS_PHOTOGRAPH
#if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH
case 240: M240(); break; // M240: Trigger a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
#endif

View File

@ -171,7 +171,7 @@
* M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
* M221 - Set Flow Percentage: "M221 S<percent>"
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>"
* M240 - Trigger a camera to take a photograph. (Requires CHDK or PHOTOGRAPH_PIN)
* M240 - Trigger a camera to take a photograph. (Requires CHDK_PIN or PHOTOGRAPH_PIN)
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
* M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
@ -631,7 +631,7 @@ private:
static void M221();
static void M226();
#if defined(CHDK) || HAS_PHOTOGRAPH
#if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH
static void M240();
#endif