fix bad implementation of global variables and version check, which prevented python version checks from working (#1050)

This commit is contained in:
Chris Gerth
2023-12-17 07:27:41 -06:00
committed by GitHub
parent 82b82fe2f6
commit f7f304ca7a

View File

@@ -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()