Skip to content

Commit

Permalink
Init tare pin once
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and tharts committed Jan 6, 2021
1 parent 34198f6 commit 37265e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
#include "feature/runout.h"
#endif

#if HAS_Z_SERVO_PROBE
#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE)
#include "module/probe.h"
#endif

Expand Down Expand Up @@ -1119,6 +1119,10 @@ void setup() {
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#endif

#if ENABLED(PROBE_TARE)
SETUP_RUN(probe.tare_init());
#endif

#if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
SETUP_RUN(card.mount()); // Mount media with settings before first_load
#endif
Expand Down
14 changes: 12 additions & 2 deletions Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,16 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
}

#if ENABLED(PROBE_TARE)

/**
* @brief Init the tare pin
*
* @details Init tare pin to ON state for a strain gauge, otherwise OFF
*/
void Probe::tare_init() {
OUT_WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
}

/**
* @brief Tare the Z probe
*
Expand All @@ -526,9 +536,9 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
#endif

SERIAL_ECHOLNPGM("Taring probe");
OUT_WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
delay(PROBE_TARE_TIME);
OUT_WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
delay(PROBE_TARE_DELAY);

endstops.hit_on_purpose();
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/module/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class Probe {
#endif

#if ENABLED(PROBE_TARE)
static void tare_init();
static bool tare();
#endif

Expand Down

0 comments on commit 37265e2

Please sign in to comment.