From f7f304ca7a95f3db01e11d321a77ac333cde0d71 Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Sun, 17 Dec 2023 07:27:41 -0600 Subject: [PATCH] fix bad implementation of global variables and version check, which prevented python version checks from working (#1050) --- photon-lib/py/photonlibpy/photonCamera.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/photon-lib/py/photonlibpy/photonCamera.py b/photon-lib/py/photonlibpy/photonCamera.py index 0d474a243..fd3e0c866 100644 --- a/photon-lib/py/photonlibpy/photonCamera.py +++ b/photon-lib/py/photonlibpy/photonCamera.py @@ -19,6 +19,7 @@ _VERSION_CHECK_ENABLED = True def setVersionCheckEnabled(enabled: bool): + global _VERSION_CHECK_ENABLED _VERSION_CHECK_ENABLED = enabled @@ -131,12 +132,16 @@ class PhotonCamera: return (now - self.prevHeartbeatChangeTime) < 0.5 def _versionCheck(self) -> None: + global lastVersionTimeCheck + if not _VERSION_CHECK_ENABLED: return if (Timer.getFPGATimestamp() - lastVersionTimeCheck) < 5.0: return + lastVersionTimeCheck = Timer.getFPGATimestamp() + if not self.heartbeatEntry.exists(): cameraNames = ( self.cameraTable.getInstance().getTable(self._tableName).getSubTables()