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

Brushless v3 #87

Closed
wants to merge 33 commits into from
Closed

Brushless v3 #87

wants to merge 33 commits into from

Conversation

alexrudd2
Copy link
Owner

@jedahan I think the best thing to do at this point is rebase your brushless support on top of main. I don't particularly care about my implementation; it served its purpose showing you a working model.

I've therefore taken jedahan:brushless-v2 and rebased on top of a116669.
This became alexrudd2:brushless-v3.

Please check out this branch and see how you like it.

I consolidated what I could, but still need to resolve:

  • The two esbuild migrations diverged (Hence rebasing on top of a116669 rather than 18905d8).
  • Splitting the TS config is still a bit mangled. 37e8b01 was an attempt to fix this but I'm not sure if it's fully what you intended.
  • We both appeared to try and solve the port.open() problem, so there's a merge conflict with 18905d8

@alexrudd2 alexrudd2 marked this pull request as draft September 27, 2023 02:24
Copy link
Collaborator

@jedahan jedahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am requesting changes for myself
Then we can test on real machines and undraft

Thank you for making sense of this large PR

Comment on lines +71 to +73
console.log('unimplemented')
// this.port.close()
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So with this, the firmware-version command writes to stdout but seems to stay open - maybe the error is better UX as at least the command will exit.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context: nornagon#176

I saw changing from "error" to -> "print firmware version and then error" as an improvement, but clearly the best answer is to fully implement it :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With reverting WebSerial you fixed here: 2d5c5a1

I think if WebSerial is left in it needs to be await this.port.close()?

Comment on lines +296 to +304
export async function connectEBB (hardware: Hardware = 'v3', device: string | undefined): Promise<EBB | null> {
if (!device) {
const ebbs = await listEBBs()
if (ebbs.length === 0) return null
device = ebbs[0]
}

const port = await tryOpen(device)
return new EBB(port, hardware)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe device: string | undefined should be named com?: Com here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Confirm that this only builds the cli files.

tsconfig.json Outdated Show resolved Hide resolved
demandOption: true
})
.parse()

const newVersion = semver.inc(package.version, args.level)
const newVersion = semver.inc(packageParsed.version, args.level)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like packageParsed might have gotten lost in the merge

src/planning.ts Outdated Show resolved Hide resolved
public constructor(motions: Motion[]) {
this.motions = motions;

private readonly minPenPosition: number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Comment on why and how this is used

Comment on lines -291 to 345
// Uuuugh this is really hacky. We should instead store the
// pen-up/pen-down heights in a single place and reference them from
// the PenMotions. Then we can change them in just one place.
if (j === this.motions.length - 3) {
return new PenMotion(penDownHeight, Device.Axidraw.penPctToPos(0), motion.duration());
} else if (j === this.motions.length - 1) {
return new PenMotion(Device.Axidraw.penPctToPos(0), penUpHeight, motion.duration());
// TODO: Remove this hack by storing the pen-up/pen-down heights
// in a single place, and reference them from the PenMotions.
if (j === this.motions.length - 1) {
return new PenMotion(this.minPenPosition, penUpHeight, motion.duration())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is compensating for the additional pen home command we add to our existing plans. Would love to get a more thorough second look here, is this is a logic change.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}));
// TODO: CHECK THAT Plan() doesn't overwrite the above motions with this.minPenPosition
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: address this TODO

src/planning.ts Show resolved Hide resolved
@jedahan
Copy link
Collaborator

jedahan commented Sep 27, 2023

I will fix the conflicts and test within two days

@alexrudd2
Copy link
Owner Author

I will fix the conflicts and test within two days

Thanks so much. I'm rather new to TypeScipt, after all, and your code is helping me learn as we go. My ultimate goal is to upstream everything into nornagon/saxi and this fork is a staging ground for that.

@jedahan
Copy link
Collaborator

jedahan commented Sep 30, 2023

Alright, finally was able to test on my hardware - there are two known issues currently:

  1. Sending the websocket message {"c":"device","p":{"hardware":"brushless"}} does not seem to change the connected ebb hardware. Consequently, the ui checkbox does not affect anything - you need to make sure to start the server with the correct --hardware flag or the ebb board will send to the wrong pins.

  2. I am seeing some strange behavior with some plots that I think is unrelated to this, but related to me using a rpi zero w that might just be underpowered. Hoping that bun makes a 32-bit build that I can test out to see if its a perf thing.

@jedahan
Copy link
Collaborator

jedahan commented Oct 1, 2023

okay, it was nornagon#131

I am manually reverting the changes in nornagon#63 and seeing if that works (removing webserial support, sadly)

@jedahan
Copy link
Collaborator

jedahan commented Oct 4, 2023

Going to close in favor of #94, and we can split out any other changes to other PRs

@jedahan jedahan closed this Oct 4, 2023
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.

2 participants