[PhotonLib C++] Fix SetVersionCheckEnabled to actually disable version checking (#1323)

* change verifyversion to use member variable

* Revert "change verifyversion to use member variable"

This reverts commit 4439839c8f.

* Removed inline specifier for versioncheck variable

---------

Co-authored-by: Drew Williams <DrewW@iARx.com>
This commit is contained in:
Drew Williams
2024-05-19 20:36:44 -04:00
committed by GitHub
parent 9e58f5ed02
commit 74a051d721
2 changed files with 10 additions and 5 deletions

View File

@@ -60,6 +60,11 @@ namespace photon {
constexpr const units::second_t VERSION_CHECK_INTERVAL = 5_s;
static const std::vector<std::string_view> PHOTON_PREFIX = {"/photonvision/"};
bool PhotonCamera::VERSION_CHECK_ENABLED = true;
void PhotonCamera::SetVersionCheckEnabled(bool enabled) {
VERSION_CHECK_ENABLED = enabled;
}
PhotonCamera::PhotonCamera(nt::NetworkTableInstance instance,
const std::string_view cameraName)
@@ -189,7 +194,9 @@ std::optional<cv::Mat> PhotonCamera::GetDistCoeffs() {
}
void PhotonCamera::VerifyVersion() {
if (!PhotonCamera::VERSION_CHECK_ENABLED) return;
if (!PhotonCamera::VERSION_CHECK_ENABLED) {
return;
}
if ((frc::Timer::GetFPGATimestamp() - lastVersionCheckTime) <
VERSION_CHECK_INTERVAL)