Skip to content

Commit

Permalink
Merge pull request #30 from BarbourSmith/set-threshold-for-calibration
Browse files Browse the repository at this point in the history
Allows the user to set the acceptable calibration fitness to proceede
  • Loading branch information
BarbourSmith authored May 22, 2024
2 parents e3faa1c + f91f7ef commit 097827b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 3 additions & 2 deletions www/js/calculatesCalibrationStuff.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var tlZ = 100
var trZ = 56
var blZ = 34
var brZ = 78
var acceptableCalibrationThreshold = 0.5

//Establish initial guesses for the corners
var initialGuess = {
Expand Down Expand Up @@ -545,7 +546,7 @@ function findMaxFitness(measurements) {
else{
var messagesBox = document.getElementById('messages')

if(1/bestGuess.fitness < 0.5){
if(1/bestGuess.fitness < acceptableCalibrationThreshold){
messagesBox.value += '\nWARNING FITNESS TOO LOW. DO NOT USE THESE CALIBRATION VALUES!';
}

Expand All @@ -562,7 +563,7 @@ function findMaxFitness(measurements) {
messagesBox.scrollTop
messagesBox.scrollTop = messagesBox.scrollHeight;

if(1/bestGuess.fitness > 0.5){
if(1/bestGuess.fitness > acceptableCalibrationThreshold){
sendCommand('$/Maslow_tlX=' + bestGuess.tl.x.toFixed(1));
sendCommand('$/Maslow_tlY=' + bestGuess.tl.y.toFixed(1));
sendCommand('$/Maslow_trX=' + bestGuess.tr.x.toFixed(1));
Expand Down
19 changes: 18 additions & 1 deletion www/js/tablet.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,25 @@ function tabletShowMessage(msg, collecting) {
initialGuess.br.x = parseFloat(msg.substring(13, msg.length))
return;
}
if (msg.startsWith('$/Maslow_tlZ=')) {
tlZ = parseFloat(msg.substring(13, msg.length))
return;
}
if (msg.startsWith('$/Maslow_trZ=')) {
trZ = parseFloat(msg.substring(13, msg.length))
return;
}
if (msg.startsWith('$/Maslow_blZ=')) {
blZ = parseFloat(msg.substring(13, msg.length))
return;
}
if (msg.startsWith('$/Maslow_brZ=')) {
brZ = parseFloat(msg.substring(13, msg.length))
return;
}
if (msg.startsWith('$/Maslow_Acceptable_Calibration_Threshold')) {

acceptableCalibrationThreshold = parseFloat(msg.substring(42, msg.length))
return;
}
if (msg.startsWith('error:')) {
let parts = msg.split(":");
Expand Down

0 comments on commit 097827b

Please sign in to comment.