Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#13 from Kokorone/Contribution
Browse files Browse the repository at this point in the history
Optional SDIO clock, fixing printer halt for printers with PWC
  • Loading branch information
MKS-Sean authored Apr 27, 2020
2 parents 81f50c2 + 5c73170 commit dc6d39f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Marlin/src/HAL/STM32F1/sdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
#define SDIO_DATA_TIMEOUT 100U /* Read data transfer timeout */
#define SDIO_WRITE_TIMEOUT 200U /* Write data transfer timeout */

#define SDIO_CLOCK 4500000 /* 4.5 MHz */
#define SDIO_CLOCK 18000000 /* 18 MHz */
//#define SDIO_CLOCK 4500000 /* 4.5 MHz */ // Testing, use if printer is drifting position during long prints. May cause printer halt error.

// ------------------------
// Types
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ millis_t max_inactive_time, // = 0

void setup_killpin() {
#if HAS_KILL
SET_INPUT_PULLUP(KILL_PIN);
if (!KILL_PIN_INVERTING) SET_INPUT_PULLUP(KILL_PIN);
else SET_INPUT(KILL_PIN);
#endif
}

Expand Down Expand Up @@ -521,7 +522,9 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
// -------------------------------------------------------------------------------
static int killCount = 0; // make the inactivity button a bit less responsive
const int KILL_DELAY = 750;
if (!READ(KILL_PIN))
if (!READ(KILL_PIN) && !KILL_PIN_INVERTING)
killCount++;
else if (READ(KILL_PIN) && KILL_PIN_INVERTING)
killCount++;
else if (killCount > 0)
killCount--;
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,9 @@
#ifndef KILL_PIN
#define KILL_PIN -1
#endif
#ifndef KILL_PIN_INVERTING
#define KILL_PIN_INVERTING false
#endif
#ifndef SUICIDE_PIN
#define SUICIDE_PIN -1
#endif
Expand Down

0 comments on commit dc6d39f

Please sign in to comment.