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

Separate out EBB library from saxi frontend #112

Open
jedahan opened this issue Oct 13, 2023 · 3 comments
Open

Separate out EBB library from saxi frontend #112

jedahan opened this issue Oct 13, 2023 · 3 comments

Comments

@jedahan
Copy link
Collaborator

jedahan commented Oct 13, 2023

I'm thinking it might be easier to provide a separate typescript library for the EBB boards, and have saxi work with that.

I started exploring what that might look like here https://github.com/jedahan/ebb.ts/blob/main/test.ts

So far its a bit too verbose, but it provides auto-completion, and parameter safety.

assert(
    'SC,1,1\r' ===
    stepperAndServoModeConfigure({
        parameter: SC.PEN_LIFT_MECHANISM,
        integer: PEN_LIFT_MECHANISM.RC_SERVO_OUT
    })
)
@alexrudd2
Copy link
Owner

Perhaps you already knew about lineboi3000. I got it to run on an M1 Macbook Air, and it does plot (although slowly and more noisy than saxi)

https://github.com/lilkraftwerk/lineboi3000/blob/master/src/plotting/AxidrawAPI.js

@jedahan
Copy link
Collaborator Author

jedahan commented Nov 14, 2023

I am hoping first to great a generic encoder/decoder that is independent of transport (http or websocket or cli or anything) - something that makes an okay base for generating the correct EBB commands, then build a javascript api on top of that.

Would love opinions on the style of the javascript api, looking at example usage https://github.com/jedahan/ebb.ts/blob/main/tests/test.ts

Style A

Pass an object with the function name, and argument names, as in the EBB official API reference

stepperAndServoModeConfigure({
    parameter: SC.PEN_LIFT_MECHANISM,
    integer: PEN_LIFT_MECHANISM.RC_SERVO_OUT
})

Style B

Rename to simpler commands, that may cover multiple different EBB commands, and use positional parameters

config(SC.PEN_LIFT_MECHANISM, PEN_LIFT_MECHANISM.RC_SERVO_OUT))

Style C

Infer parameter usage based on enums - in this case, we don't need to set SC.PEN_LIFT_MECHANISM since PEN_LIFT_MECHANISM.RC_SERVER_OUT can only apply to the first. A bit more magic.

config(PEN_LIFT_MECHANISM.RC_SERVO_OUT)

@alexrudd2
Copy link
Owner

See also https://github.com/techninja/cncserver

Would love opinions on the style of the javascript api

Sorry, I don't have expertise to design an API :S

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

No branches or pull requests

2 participants