Skip to content

Commit

Permalink
Refactor auto_mode property setter to use set_auto_mode()
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lundberg committed Jul 4, 2019
1 parent b05dc96 commit 9574911
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions simple_pid/PID.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,7 @@ def auto_mode(self):
@auto_mode.setter
def auto_mode(self, enabled):
"""Enable or disable the PID controller"""
if enabled and not self._auto_mode:
# switching from manual mode to auto, reset
self._last_output = None
self._last_input = None
self._last_time = _current_time()
self._proportional = 0
self._integral = _clamp(0, self.output_limits)

self._auto_mode = enabled
self.set_auto_mode(enabled)

def set_auto_mode(self, enabled, last_output=None):
"""
Expand Down

0 comments on commit 9574911

Please sign in to comment.