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

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

510
 }
510
 }
511
 
511
 
512
 #if ENABLED(PROBE_TARE)
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
    * @brief Tare the Z probe
524
    * @brief Tare the Z probe
515
    *
525
    *
526
     #endif
536
     #endif
527
 
537
 
528
     SERIAL_ECHOLNPGM("Taring probe");
538
     SERIAL_ECHOLNPGM("Taring probe");
529
-    OUT_WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
539
+    WRITE(PROBE_TARE_PIN, PROBE_TARE_STATE);
530
     delay(PROBE_TARE_TIME);
540
     delay(PROBE_TARE_TIME);
531
-    OUT_WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
541
+    WRITE(PROBE_TARE_PIN, !PROBE_TARE_STATE);
532
     delay(PROBE_TARE_DELAY);
542
     delay(PROBE_TARE_DELAY);
533
 
543
 
534
     endstops.hit_on_purpose();
544
     endstops.hit_on_purpose();

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

211
   #endif
211
   #endif
212
 
212
 
213
   #if ENABLED(PROBE_TARE)
213
   #if ENABLED(PROBE_TARE)
214
+    static void tare_init();
214
     static bool tare();
215
     static bool tare();
215
   #endif
216
   #endif
216
 
217
 

Loading…
Cancel
Save