Explorar el Código

Clean Endstops::event_handler

Scott Lahteine hace 5 años
padre
commit
c5713b5e98
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3
    2
      Marlin/src/module/endstops.cpp

+ 3
- 2
Marlin/src/module/endstops.cpp Ver fichero

@@ -340,7 +340,9 @@ void Endstops::resync() {
340 340
 
341 341
 void Endstops::event_handler() {
342 342
   static uint8_t prev_hit_state; // = 0
343
-  if (hit_state && hit_state != prev_hit_state) {
343
+  if (hit_state == prev_hit_state) return;
344
+  prev_hit_state = hit_state;
345
+  if (hit_state) {
344 346
     #if HAS_SPI_LCD
345 347
       char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' ';
346 348
       #define _SET_STOP_CHAR(A,C) (chr## A = C)
@@ -385,7 +387,6 @@ void Endstops::event_handler() {
385 387
       }
386 388
     #endif
387 389
   }
388
-  prev_hit_state = hit_state;
389 390
 }
390 391
 
391 392
 static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {

Loading…
Cancelar
Guardar