Skip to content

Commit

Permalink
Fix serial timing (#1188)
Browse files Browse the repository at this point in the history
* fix serial timing
* format
  • Loading branch information
yaxu authored Sep 20, 2024
1 parent abaab89 commit b75561e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/serial/serial.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b75561e

Please sign in to comment.