Fixed shocker pin argument order & type

This commit is contained in:
2026-06-03 18:00:17 +01:00
parent 739f3ec5b4
commit 8a37c1736b

View File

@ -24,13 +24,14 @@ function assert(condition, message) {
}
}
async function transmit(transmitterID, channel, action, intensity=0, lucalEncoded=false, shockerPin) {
async function transmit(transmitterID, channel, action, shockerPin, intensity=0, lucalEncoded=false) {
assert(typeof transmitterID === 'number');
assert(typeof channel === 'number');
assert(['shock', 'vibrate', 'beep'].includes(action));
assert(typeof shockerPin === 'number');
assert(typeof intensity === 'number');
assert(typeof lucalEncoded === 'boolean');
POST('/transmit', {transmitterID: transmitterID, channel: channel, action: action, intensity: intensity, lucalEncoded: lucalEncoded, shockerPin: shockerPin});
POST('/transmit', {transmitterID: transmitterID, channel: channel, action: action, shockerPin: shockerPin, intensity: intensity, lucalEncoded: lucalEncoded});
}
@ -39,8 +40,8 @@ async function txFromUI(action, intensity=0) {
let transmitterID = Number(document.getElementById('transmitterIDInput').value);
let channel = Number(document.getElementById('channelIDInput').value);
let lucalEncoded = document.getElementById('lucalEncodedInput').checked;
let shockerPin = document.getElementById('shockerPinInput').value;
transmit(transmitterID, channel, action, intensity, lucalEncoded, shockerPin);
let shockerPin = Number(document.getElementById('shockerPinInput').value);
transmit(transmitterID, channel, action, shockerPin, intensity, lucalEncoded);
}
async function shock() {