🧹 Formats

This commit is contained in:
Rune Harlyk
2024-02-23 12:47:24 +01:00
parent 0421560603
commit 04c3603254
5 changed files with 74 additions and 74 deletions
+1 -1
View File
@@ -71,7 +71,7 @@
data[2] = toUint8($input.left.y, -1, 1); data[2] = toUint8($input.left.y, -1, 1);
data[3] = toUint8($input.right.x, -1, 1); data[3] = toUint8($input.right.x, -1, 1);
data[4] = toUint8($input.right.y, -1, 1); data[4] = toUint8($input.right.y, -1, 1);
data[5] = toUint8($input.height, 0, 100);; data[5] = toUint8($input.height, 0, 100);
data[6] = toUint8($input.speed, 0, 100); data[6] = toUint8($input.speed, 0, 100);
outControllerData.set(data); outControllerData.set(data);
+3 -3
View File
@@ -1,5 +1,5 @@
export const toUint8 = (number:number, min:number, max:number) => { export const toUint8 = (number: number, min: number, max: number) => {
number = Math.max(min, Math.min(max, number)); number = Math.max(min, Math.min(max, number));
let scaled = ((number - min) / (max - min)) * 255; let scaled = ((number - min) / (max - min)) * 255;
return Math.round(scaled) & 0xFF; return Math.round(scaled) & 0xff;
} };
+1 -1
View File
@@ -3,7 +3,7 @@ import { describe, it, expect, beforeEach, afterEach, test, vitest } from 'vites
describe('throttler', () => { describe('throttler', () => {
let throttleInstance: throttler; let throttleInstance: throttler;
let callback let callback;
beforeEach(() => { beforeEach(() => {
vitest.useFakeTimers(); vitest.useFakeTimers();