Merge remote-tracking branch 'upstream/edge' into feature/soft-endstops
[clinton/Smoothieware.git] / src / modules / tools / switch / Switch.cpp
index c80f187..2ce227b 100644 (file)
@@ -400,15 +400,18 @@ uint32_t Switch::pinpoll_tick(uint32_t dummy)
             // if switch is a toggle switch
             if( this->input_pin_behavior == toggle_checksum ) {
                 this->flip();
-                // else default is momentary
             } else {
-                this->flip();
+                // else default is momentary
+                this->switch_state = this->input_pin_state;
+                this->switch_changed = true;
             }
-            // else if button released
+
         } else {
-            // if switch is momentary
+            // else if button released
             if( this->input_pin_behavior == momentary_checksum ) {
-                this->flip();
+                // if switch is momentary
+                this->switch_state = this->input_pin_state;
+                this->switch_changed = true;
             }
         }
     }