Skip to content

Commit

Permalink
fix bad implementation of global variables and version check, which p…
Browse files Browse the repository at this point in the history
…revented python version checks from working (#1050)
  • Loading branch information
gerth2 authored Dec 17, 2023
1 parent 82b82fe commit f7f304c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions photon-lib/py/photonlibpy/photonCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class VisionLEDMode(Enum):


def setVersionCheckEnabled(enabled: bool):
global _VERSION_CHECK_ENABLED
_VERSION_CHECK_ENABLED = enabled


Expand Down Expand Up @@ -131,12 +132,16 @@ def isConnected(self) -> bool:
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()
Expand Down

0 comments on commit f7f304c

Please sign in to comment.