Skip to content
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

Open
wants to merge 22 commits into
base: hotfire4/main
Choose a base branch
from
Open

Support Packet V2 #16

wants to merge 22 commits into from

Conversation

e-zhang09
Copy link
Member

No description provided.

Copy link
Member

@andycate andycate left a 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 Show resolved Hide resolved
electron/Board.js Outdated Show resolved Hide resolved

let offset = dataOffset;

for (const [_, parser, __] of packetDef[id]) {
Copy link
Member

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?

Copy link
Member Author

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 Show resolved Hide resolved
electron/Packet.js Outdated Show resolved Hide resolved
Comment on lines 48 to 58
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
}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants