Fixed max patterns. fixed disabling devices, fixed start on device without vibrating actuator,

This commit is contained in:
Eugene Serb 2022-06-18 12:08:13 +03:00
parent 1d30321468
commit e30da21dc4

View File

@ -38,7 +38,7 @@ const __PATTERNS = [
icon: '🙃', icon: '🙃',
pattern: [ pattern: [
{ {
startDelay: 0, startDelay: 100,
duration: 100, duration: 100,
weakMagnitude: 1.0, weakMagnitude: 1.0,
strongMagnitude: 1.0, strongMagnitude: 1.0,
@ -78,7 +78,7 @@ const __PATTERNS = [
icon: '😊', icon: '😊',
pattern: [ pattern: [
{ {
startDelay: 0, startDelay: 100,
duration: 250, duration: 250,
weakMagnitude: 1.0, weakMagnitude: 1.0,
strongMagnitude: 1.0, strongMagnitude: 1.0,
@ -118,7 +118,7 @@ const __PATTERNS = [
icon: '🤪', icon: '🤪',
pattern: [ pattern: [
{ {
startDelay: 0, startDelay: 100,
duration: 500, duration: 500,
weakMagnitude: 1.0, weakMagnitude: 1.0,
strongMagnitude: 1.0, strongMagnitude: 1.0,
@ -384,16 +384,18 @@ class VibrationMaster {
change = (index) => { change = (index) => {
if (this.gamepads.length > 0) { if (this.gamepads.length > 0) {
this.gamepads.forEach(gamepad => { this.gamepads.forEach(gamepad => {
if (gamepad.canVibrate === true) {
this.unselect(); this.unselect();
if (gamepad.index === index && if (gamepad.index === index &&
gamepad.isVibrating === true) { gamepad.isVibrating === true) {
gamepad.isVibrating = false;
gamepad.reset(); gamepad.reset();
} else { } else {
gamepad.reset()
gamepad.change(index); gamepad.change(index);
gamepad.vibrate(); gamepad.vibrate();
this.select(index); this.select(index);
}; };
};
}); });
} else { } else {
console.log('No connected devices...'); console.log('No connected devices...');
@ -436,6 +438,7 @@ class VibrationMaster {
this.gamepads.splice(index, 1); this.gamepads.splice(index, 1);
}; };
}); });
this.unselect();
}); });
}; };
}; };