diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..6ff3f8d48f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,37 @@ +# Set default behavior to automatically normalize line endings (LF on check-in). +* text=auto + +# Force batch scripts to always use CRLF line endings so that if a repo is accessed +# in Windows via a file share from Linux, the scripts will work. +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf +*.{ics,[iI][cC][sS]} text eol=crlf + +# Force bash scripts to always use LF line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work. +*.sh text eol=lf + +# Ensure Spotless does not try to use CRLF line endings on Windows in the local repo. +*.gradle text eol=lf +*.java text eol=lf +*.json text eol=lf +*.md text eol=lf +*.xml text eol=lf +*.h text eol=lf +*.hpp text eol=lf +*.inc text eol=lf +*.inl text eol=lf +*.cpp text eol=lf + +# Frontend Files +*.js text eol=lf +*.vue text eol=lf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.so binary +*.dll binary +*.webp binary diff --git a/.gitignore b/.gitignore index 4c59f92df6..ca5a93289b 100644 --- a/.gitignore +++ b/.gitignore @@ -145,6 +145,7 @@ build/spotlessJava build/* build photon-lib/src/main/java/org/photonvision/PhotonVersion.java +photon-lib/bin/main/images/* /photonlib-java-examples/bin/ photon-lib/src/generate/native/include/PhotonVersion.h .gitattributes diff --git a/.styleguide b/.styleguide index 5b6275ca1f..13ce2512df 100644 --- a/.styleguide +++ b/.styleguide @@ -17,6 +17,7 @@ modifiableFileExclude { \.so$ \.dll$ \.webp$ + gradlew } includeProject { diff --git a/photon-client/src/App.vue b/photon-client/src/App.vue index 164253f09f..053635c21d 100644 --- a/photon-client/src/App.vue +++ b/photon-client/src/App.vue @@ -345,7 +345,7 @@ export default { this.previouslySelectedIndices = null; }, switchToSettingsTab() { - this.axios.post('http://' + this.$address + '/api/sendMetrics', {}) + this.axios.post('http://' + this.$address + '/api/utils/publishMetrics') } } }; diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 01ca0f6f1e..ba3affa574 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -1,5 +1,13 @@ @@ -489,11 +490,11 @@ export default { filteredVideomodeIndex: 0, settingsValid: true, unfilteredStreamDivisors: [1, 2, 4], - uploadSnackData: { + snackbar: { color: "success", text: "", }, - uploadSnack: false, + snack: false, } }, computed: { @@ -711,43 +712,34 @@ export default { }; this.axios - .post("http://" + this.$address + "/api/calibration/import", data, { + .post("http://" + this.$address + "/api/calibration/importFromCalibDB", data, { headers: { "Content-Type": "text/plain" }, }) - .then(() => { - this.uploadSnackData = { - color: "success", - text: - "Calibration imported successfully!", - }; - this.uploadSnack = true; + .then((response) => { + this.snackbar = { + color: response.status === 200 ? "success" : "error", + text: response.data.text || response.data + } + this.snack = true; }) .catch((err) => { - if (err.response) { - this.uploadSnackData = { - color: "error", - text: - "Error while uploading calibration file! Could not process provided file.", - }; - } else if (err.request) { - this.uploadSnackData = { + if (err.request) { + this.snackbar = { color: "error", - text: - "Error while uploading calibration file! No respond to upload attempt.", + text: "Error while uploading calibration file! The backend didn't respond to the upload attempt.", }; } else { - this.uploadSnackData = { + this.snackbar = { color: "error", text: "Error while uploading calibration file!", }; } - this.uploadSnack = true; + this.snack = true; }); - }) }, closeDialog() { - this.snack = false; + this.calibrationDialog = false; this.calibrationInProgress = false; this.calibrationFailed = false; }, @@ -841,15 +833,33 @@ export default { doc.save(`calibrationTarget-${config.type}.pdf`) }, sendCameraSettings() { - this.axios.post("http://" + this.$address + "/api/settings/camera", { - "settings": this.cameraSettings, - "index": this.$store.state.currentCameraIndex - }).then(response => { - if (response.status === 200) { - this.$store.state.saveBar = true; + this.axios.post("http://" + this.$address + "/api/settings/camera", {"settings": this.cameraSettings, "index": this.$store.state.currentCameraIndex}) + .then(response => { + this.snackbar = { + color: "success", + text: response.data.text || response.data + } + this.snack = true; + }) + .catch(error => { + if(error.response) { + this.snackbar = { + color: "error", + text: error.response.data.text || error.response.data } - } - ) + } else if(error.request) { + this.snackbar = { + color: "error", + text: "Error while trying to process the request! The backend didn't respond.", + }; + } else { + this.snackbar = { + color: "error", + text: "An error occurred while trying to process the request.", + }; + } + this.snack = true; + }) }, isCalibrated(resolution) { return this.$store.getters.currentCameraSettings.calibrations @@ -876,16 +886,13 @@ export default { sendCalibrationFinish() { console.log("finishing calibration for index " + this.$store.getters.currentCameraIndex); - this.snack = true; + this.calibrationDialog = true; this.calibrationInProgress = true; - this.axios.post("http://" + this.$address + "/api/settings/endCalibration", {idx: this.$store.getters.currentCameraIndex}) - .then((response) => { - if (response.status === 200) { - this.calibrationInProgress = false; - } else { - this.calibrationFailed = true; - } + this.axios.post("http://" + this.$address + "/api/calibration/end", {index: this.$store.getters.currentCameraIndex}) + .then(() => { + // End calibration will always return a 200 code on success + this.calibrationInProgress = false; } ).catch(() => { this.calibrationFailed = true; diff --git a/photon-client/src/views/LogsView.vue b/photon-client/src/views/LogsView.vue index fbb9c86d53..ca05a334b2 100644 --- a/photon-client/src/views/LogsView.vue +++ b/photon-client/src/views/LogsView.vue @@ -23,7 +23,7 @@ diff --git a/photon-client/src/views/PipelineViews/OutputTab.vue b/photon-client/src/views/PipelineViews/OutputTab.vue index 66906ccc2b..7866b832b9 100644 --- a/photon-client/src/views/PipelineViews/OutputTab.vue +++ b/photon-client/src/views/PipelineViews/OutputTab.vue @@ -43,7 +43,7 @@ /> diff --git a/photon-client/src/views/SettingsViews/DeviceControl.vue b/photon-client/src/views/SettingsViews/DeviceControl.vue index fa7c384eae..28948e740a 100644 --- a/photon-client/src/views/SettingsViews/DeviceControl.vue +++ b/photon-client/src/views/SettingsViews/DeviceControl.vue @@ -54,7 +54,7 @@ > mdi-import @@ -62,7 +62,6 @@ Import Settings - - - {{ snackbar.text }} - - - + + Import Settings + + Upload and apply previously saved or exported PhotonVision settings to this device + + + + + + + + + + mdi-import + + Import Settings + + + + + + @@ -156,18 +196,28 @@ +