Adjust calibration process
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
21448cbd4b
commit
445e59c539
2 changed files with 23 additions and 4 deletions
|
@ -5,7 +5,7 @@ class Constants {
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
*/
|
*/
|
||||||
static get CLOCK_TIME() {
|
static get CLOCK_TIME() {
|
||||||
return 500;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +17,15 @@ class Constants {
|
||||||
return [1, 1, 1, 0, 0, 0, 1, 1, 1];
|
return [1, 1, 1, 0, 0, 0, 1, 1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The signal used in calibration mode.
|
||||||
|
*
|
||||||
|
* @type {Number[]}
|
||||||
|
*/
|
||||||
|
static get CALIBRATION_SIGNAL() {
|
||||||
|
return [1, 1, 0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of workers that should be started.
|
* The number of workers that should be started.
|
||||||
*
|
*
|
||||||
|
|
|
@ -67,13 +67,23 @@ function stopWorkers() {
|
||||||
/**
|
/**
|
||||||
* Starts the calibration process by simply starting all web workers.
|
* Starts the calibration process by simply starting all web workers.
|
||||||
*/
|
*/
|
||||||
function startCalibration() {
|
async function startCalibration() {
|
||||||
Utility.setMessage("Calibration currently ongoing.");
|
Utility.setMessage("Calibration currently ongoing.");
|
||||||
|
|
||||||
startCalibrationButton.classList.add(Constants.HIDE_CLASS);
|
startCalibrationButton.classList.add(Constants.HIDE_CLASS);
|
||||||
stopCalibrationButton.classList.remove(Constants.HIDE_CLASS);
|
stopCalibrationButton.classList.remove(Constants.HIDE_CLASS);
|
||||||
|
|
||||||
startWorkers();
|
isTransmitting = true;
|
||||||
|
while (isTransmitting) {
|
||||||
|
for (let i = 0; i < Constants.CALIBRATION_SIGNAL.length; i++) {
|
||||||
|
if (!isTransmitting) {
|
||||||
|
stopWorkers();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await transmitBit(Constants.CALIBRATION_SIGNAL[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +95,7 @@ function stopCalibration() {
|
||||||
stopCalibrationButton.classList.add(Constants.HIDE_CLASS);
|
stopCalibrationButton.classList.add(Constants.HIDE_CLASS);
|
||||||
startCalibrationButton.classList.remove(Constants.HIDE_CLASS);
|
startCalibrationButton.classList.remove(Constants.HIDE_CLASS);
|
||||||
|
|
||||||
stopWorkers();
|
isTransmitting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in a new issue