techninja / cncserver

A RESTful API server for driving serial based CNC devices
133 stars 39 forks source link

Fix "Near diagonal motion fails silently" #140

Closed ghost closed 7 months ago

ghost commented 9 months ago

This PR adds a sanityCheckMovement method, which is used to slightly adjust a requested pen movement, to avoid impossibly slow pen movements on any axis. This fixes #139.

I've made what I think are fixes to a couple of issues I encountered along the way:

I was also tempted to change centToSteps to output rounded values, so we can reduce rounding elsewhere, but wasn't feeling bold enough. I can see pen.x/pen.y might end up as non-integer in a couple of places where they're set from cncserver.utils.centToSteps(cncserver.bot.park), which I assume is undesirable.

Note the value returned by the API will be "honest" about the position of the pen in steps, rather than pretending no adjustment occurred.

I'm opening this PR as draft for feedback/in case I've made any fundamental misunderstanding anywhere.