From ea00c34231d7845986af894e3bee4facebbc57d0 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Mon, 28 Apr 2025 22:43:18 +1000 Subject: [PATCH 1/2] move variable resettting to periodics --- magicbot/magicrobot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/magicbot/magicrobot.py b/magicbot/magicrobot.py index 85d1dd7..8188efd 100644 --- a/magicbot/magicrobot.py +++ b/magicbot/magicrobot.py @@ -729,6 +729,9 @@ def _do_periodics(self) -> None: self.onException() else: setter(value) + + for reset_dict, component in self._reset_components: + component.__dict__.update(reset_dict) watchdog.addEpoch("@magicbot.feedback") @@ -748,6 +751,3 @@ def _enabled_periodic(self) -> None: watchdog.addEpoch(name) self._do_periodics() - - for reset_dict, component in self._reset_components: - component.__dict__.update(reset_dict) From d15cd426ee036da65fa1eab3d846e65545a3dd95 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Mon, 28 Apr 2025 23:06:58 +1000 Subject: [PATCH 2/2] move reset after robot periodic --- magicbot/magicrobot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/magicbot/magicrobot.py b/magicbot/magicrobot.py index 8188efd..d0c1bf1 100644 --- a/magicbot/magicrobot.py +++ b/magicbot/magicrobot.py @@ -729,9 +729,6 @@ def _do_periodics(self) -> None: self.onException() else: setter(value) - - for reset_dict, component in self._reset_components: - component.__dict__.update(reset_dict) watchdog.addEpoch("@magicbot.feedback") @@ -739,6 +736,9 @@ def _do_periodics(self) -> None: periodic() watchdog.addEpoch(name) + for reset_dict, component in self._reset_components: + component.__dict__.update(reset_dict) + def _enabled_periodic(self) -> None: """Run components and all periodic methods.""" watchdog = self.watchdog