-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Packet V2 #16
base: hotfire4/main
Are you sure you want to change the base?
Conversation
…cksum calculation accordingly
…essing to use new packetDef struct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, but a few changes to make it work
electron/Board.js
Outdated
|
||
let offset = dataOffset; | ||
|
||
for (const [_, parser, __] of packetDef[id]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need the [id]
after packetDef
. Also not sure what the third value is in the array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Third value is the interpolator, could be removed but I included to remember that it could exist in the INBOUND_PACKET_DEF.
electron/Board.js
Outdated
calculateTimestamp(runTime) { | ||
if (this.firstRecvTime < 0) { | ||
/* TODO: consider using multiple packet offsets to reduce likelihood of noise causing the first receive time to | ||
* deviate too significantly */ | ||
this.firstRecvTime = Date.now() | ||
} | ||
if (this.firstRecvOffset < 0) { | ||
this.firstRecvOffset = runTime | ||
} | ||
return runTime - this.firstRecvOffset + this.firstRecvTime | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful, because if a board disconnects and reconnects, it might have rebooted in between. Which would mean that the timestamp on the board would be different. So if the board ever disconnects, then on reconnection it should re-sync timestamps.
* Add debug message when INBOUND_PACKET has an undefined / unknown Packet ID * Reset timestamp sync when board disconnects * Update checksum calculation to use 256 as the modulus
…ch on dashboard and appropriate functions to send outbound command to turn on relay manually
No description provided.