diff --git a/photon-core/src/main/java/org/photonvision/common/configuration/DatabaseSchema.java b/photon-core/src/main/java/org/photonvision/common/configuration/DatabaseSchema.java index d55c3494d..ccb7e6d72 100644 --- a/photon-core/src/main/java/org/photonvision/common/configuration/DatabaseSchema.java +++ b/photon-core/src/main/java/org/photonvision/common/configuration/DatabaseSchema.java @@ -27,16 +27,19 @@ package org.photonvision.common.configuration; public final class DatabaseSchema { public static final String[] migrations = { // #1 - initial schema - "CREATE TABLE IF NOT EXISTS global (\n" - + " filename TINYTEXT PRIMARY KEY,\n" - + " contents mediumtext NOT NULL\n" - + ");" - + "CREATE TABLE IF NOT EXISTS cameras (\n" - + " unique_name TINYTEXT PRIMARY KEY,\n" - + " config_json text NOT NULL,\n" - + " drivermode_json text NOT NULL,\n" - + " pipeline_jsons mediumtext NOT NULL\n" - + ");", + // spotless:off + """ + CREATE TABLE IF NOT EXISTS global ( + filename TINYTEXT PRIMARY KEY, + contents mediumtext NOT NULL + ); + CREATE TABLE IF NOT EXISTS cameras ( + unique_name TINYTEXT PRIMARY KEY, + config_json text NOT NULL, + drivermode_json text NOT NULL, + pipeline_jsons mediumtext NOT NULL + );""", + // spotless:on // #2 - add column otherpaths_json "ALTER TABLE cameras ADD COLUMN otherpaths_json TEXT NOT NULL DEFAULT '[]';", // add future migrations here diff --git a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java index 4ca7c3077..00b04b753 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java @@ -175,65 +175,77 @@ public class PhotonCamera implements AutoCloseable { } public static void verifyDependencies() { + // spotless:off if (!WPILibVersion.Version.equals(PhotonVersion.wpilibTargetVersion)) { - String bfw = - "\n\n\n\n\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>> \n" - + ">>> You are running an incompatible version \n" - + ">>> of PhotonVision ! \n" - + ">>> \n" - + ">>> PhotonLib " - + PhotonVersion.versionString - + " is built for WPILib " - + PhotonVersion.wpilibTargetVersion - + "\n" - + ">>> but you are using WPILib " - + WPILibVersion.Version - + ">>> \n" - + ">>> This is neither tested nor supported. \n" - + ">>> You MUST update PhotonVision, \n" - + ">>> PhotonLib, or both. \n" - + ">>> Verify the output of `./gradlew dependencies` \n" - + ">>> \n" - + ">>> Your code will now crash. \n" - + ">>> We hope your day gets better. \n" - + ">>> \n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; + String bfw = """ + + + + + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s + >>> \s + >>> You are running an incompatible version \s + >>> of PhotonVision ! \s + >>> \s + >>> PhotonLib """ + + PhotonVersion.versionString + + " is built for WPILib " + + PhotonVersion.wpilibTargetVersion + + "\n" + + ">>> but you are using WPILib " + + WPILibVersion.Version + + """ + >>> \s + >>> This is neither tested nor supported. \s + >>> You MUST update PhotonVision, \s + >>> PhotonLib, or both. \s + >>> Verify the output of `./gradlew dependencies` + >>> \s + >>> Your code will now crash. \s + >>> We hope your day gets better. \s + >>> \s + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s + """; DriverStation.reportWarning(bfw, false); DriverStation.reportError(bfw, false); throw new UnsupportedOperationException(bfw); } if (!Core.VERSION.equals(PhotonVersion.opencvTargetVersion)) { - String bfw = - "\n\n\n\n\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>> \n" - + ">>> You are running an incompatible version \n" - + ">>> of PhotonVision ! \n" - + ">>> \n" - + ">>> PhotonLib " - + PhotonVersion.versionString - + " is built for OpenCV " - + PhotonVersion.opencvTargetVersion - + "\n" - + ">>> but you are using OpenCV " - + Core.VERSION - + ">>> \n" - + ">>> This is neither tested nor supported. \n" - + ">>> You MUST update PhotonVision, \n" - + ">>> PhotonLib, or both. \n" - + ">>> Verify the output of `./gradlew dependencies` \n" - + ">>> \n" - + ">>> Your code will now crash. \n" - + ">>> We hope your day gets better. \n" - + ">>> \n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; + String bfw = """ + + + + + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s + >>> \s + >>> You are running an incompatible version \s + >>> of PhotonVision ! \s + >>> \s + >>> PhotonLib """ + + PhotonVersion.versionString + + " is built for OpenCV " + + PhotonVersion.opencvTargetVersion + + "\n" + + ">>> but you are using OpenCV " + + Core.VERSION + + """ + >>> \s + >>> This is neither tested nor supported. \s + >>> You MUST update PhotonVision, \s + >>> PhotonLib, or both. \s + >>> Verify the output of `./gradlew dependencies` + >>> \s + >>> Your code will now crash. \s + >>> We hope your day gets better. \s + >>> \s + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s + """; + // spotless:on DriverStation.reportWarning(bfw, false); DriverStation.reportError(bfw, false); @@ -533,23 +545,30 @@ public class PhotonCamera implements AutoCloseable { // Error on a verified version mismatch // But stay silent otherwise - String bfw = - "\n\n\n\n\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>> \n" - + ">>> You are running an incompatible version \n" - + ">>> of PhotonVision on your coprocessor! \n" - + ">>> \n" - + ">>> This is neither tested nor supported. \n" - + ">>> You MUST update PhotonVision, \n" - + ">>> PhotonLib, or both. \n" - + ">>> \n" - + ">>> Your code will now crash. \n" - + ">>> We hope your day gets better. \n" - + ">>> \n" - + ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; + // spotless:off + String bfw = """ + + + + + + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + >>> \s + >>> You are running an incompatible version \s + >>> of PhotonVision on your coprocessor! \s + >>> \s + >>> This is neither tested nor supported. \s + >>> You MUST update PhotonVision, \s + >>> PhotonLib, or both. \s + >>> \s + >>> Your code will now crash. \s + >>> We hope your day gets better. \s + >>> \s + >>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + """; + // spotless:on DriverStation.reportWarning(bfw, false); var versionMismatchMessage =