Fix serial timing (#1188)

* fix serial timing
* format
This commit is contained in:
Alex McLean 2024-09-20 21:26:41 +01:00 committed by GitHub
parent abaab89061
commit b75561e3c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,7 +68,7 @@ Pattern.prototype.serial = function (br = 115200, sendcrc = false, singlecharids
if (!(name in writeMessagers)) {
getWriter(name, br);
}
const onTrigger = (time, hap, currentTime) => {
const onTrigger = (t_deprecate, hap, currentTime, cps, targetTime) => {
var message = '';
var chk = 0;
if (typeof hap.value === 'object') {
@ -105,7 +105,7 @@ Pattern.prototype.serial = function (br = 115200, sendcrc = false, singlecharids
} else {
message = hap.value;
}
const offset = (time - currentTime + latency) * 1000;
const offset = (targetTime - currentTime + latency) * 1000;
window.setTimeout(function () {
writeMessagers[name](message, chk);