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

@ -191,9 +191,9 @@ volatile bool wait_for_heatup = true;
millis_t max_inactive_time, // = 0
stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
#ifdef CHDK
millis_t chdkHigh; // = 0;
bool chdkActive; // = false;
#if PIN_EXISTS(CHDK)
extern bool chdk_active;
extern millis_t chdk_timeout;
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
@ -323,7 +323,7 @@ void disable_all_steppers() {
* - Keep the command buffer full
* - Check for maximum inactive time between commands
* - Check for maximum inactive time between stepper commands
* - Check if pin CHDK needs to go LOW
* - Check if CHDK_PIN needs to go LOW
* - Check for KILL button held down
* - Check for HOME button held down
* - Check if cooling fan needs to be switched on
@ -374,10 +374,10 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
}
}
#ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH
if (chdkActive && ELAPSED(ms, chdkHigh + CHDK_DELAY)) {
chdkActive = false;
WRITE(CHDK, LOW);
#if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH)
if (chdk_active && ELAPSED(ms, chdk_timeout)) {
chdk_active = false;
WRITE(CHDK_PIN, LOW);
}
#endif