Browse Source

Init tare pin once

Scott Lahteine 4 years ago
parent
commit
45996fd20a
3 changed files with 18 additions and 3 deletions
  1. 5
    1
      Marlin/src/MarlinCore.cpp
  2. 12
    2
      Marlin/src/module/probe.cpp
  3. 1
    0
      Marlin/src/module/probe.h

+ 5
- 1
Marlin/src/MarlinCore.cpp View File

@@ -193,7 +193,7 @@
193 193
   #include "feature/runout.h"
194 194
 #endif
195 195
 
196
-#if HAS_Z_SERVO_PROBE
196
+#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE)
197 197
   #include "module/probe.h"
198 198
 #endif
199 199
 
@@ -1119,6 +1119,10 @@ void setup() {
1119 1119
     SETUP_RUN(ui.reset_status());     // Load welcome message early. (Retained if no errors exist.)
1120 1120
   #endif
1121 1121
 
1122
+  #if ENABLED(PROBE_TARE)
1123
+    SETUP_RUN(probe.tare_init());
1124
+  #endif
1125
+
1122 1126
   #if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
1123 1127
     SETUP_RUN(card.mount());          // Mount media with settings before first_load
1124 1128
   #endif

+ 12
- 2
Marlin/src/module/probe.cpp View File

@@ -510,6 +510,16 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
510 510
 }
511 511
 
512 512
 #if ENABLED(PROBE_TARE)
513
+
514
+  /**
515
+   * @brief Init the tare pin
516
+   *
517
+   * @details Init tare pin to ON state for a strain gauge, otherwise OFF
518
+   */
519
+  void Probe::tare_init() {
520
+    OUT_WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
521
+  }
522
+
513 523
   /**
514 524
    * @brief Tare the Z probe
515 525
    *
@@ -526,9 +536,9 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
526 536
     #endif
527 537
 
528 538
     SERIAL_ECHOLNPGM("Taring probe");
529
-    OUT_WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
539
+    WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
530 540
     delay(PROBE_TARE_TIME);
531
-    OUT_WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
541
+    WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
532 542
     delay(PROBE_TARE_DELAY);
533 543
 
534 544
     endstops.hit_on_purpose();

+ 1
- 0
Marlin/src/module/probe.h View File

@@ -211,6 +211,7 @@ public:
211 211
   #endif
212 212
 
213 213
   #if ENABLED(PROBE_TARE)
214
+    static void tare_init();
214 215
     static bool tare();
215 216
   #endif
216 217
 

Loading…
Cancel
Save