nornagon / saxi

Tools & library for driving the AxiDraw pen plotter
GNU Affero General Public License v3.0
469 stars 54 forks source link

Fix multiple connects causing erratic plots #195

Closed alexrudd2 closed 11 months ago

alexrudd2 commented 11 months ago

See https://github.com/alexrudd2/saxi/pull/113. Closes https://github.com/nornagon/saxi/issues/194. Closes https://github.com/nornagon/saxi/issues/131

summary

saxi is usually OK on a fast laptop, but can cause erratic and jerky plots on smaller devices like a Raspberry Pi. This PR smooths things out.

details

0.0.15 code creates up to 5 duplicate WebSocket connections, as an unintended side effort of adding WebSerial. They occur even when WebSerial isn't being used. image

This PR removes the duplicates with two ways:

alexrudd2 commented 11 months ago

@osresearch @lostpixels @edouard-gillet @jimmykl @ostwilkens @julienes (and @oskay for good measure 😃 )

You had all reported erratic plots with saxi 0.15.0, generally on a Raspberry Pi. Can you try out this fix and let me know if it helps?

You can install from this pull request, or the fork (which adds brushless servo support too).

nornagon commented 11 months ago

Nice, good catch.

julienes commented 10 months ago

Thank you very much for your feedback. I took a break from the plotter, I hadn't had a chance to try it out. So I updated Saxi today with this new version, and my servo motor doesn't respond at all. I can launch a drawing, the arm moves, but no up and down. I don't know if it worked for anyone else.

alexrudd2 commented 10 months ago

Thank you very much for your feedback. I took a break from the plotter, I hadn't had a chance to try it out. So I updated Saxi today with this new version, and my servo motor doesn't respond at all. I can launch a drawing, the arm moves, but no up and down. I don't know if it worked for anyone else.

Strange, I've not seen that fail. Are you on a brushed or brushless motor? You might want to try https://github.com/alexrudd2/saxi, since that has an option to switch between both.

julienes commented 10 months ago

Yes, I have the brushless motor. I've tried it on my mac and on the raspberry, but in both cases, I can just launch the plot, but the servo motor doesn't work. I'll try again to install version 0.14 to see if it works like before already. I'll tell you again quickly.

alexrudd2 commented 10 months ago

Yes, I have the brushless motor. I've tried it on my mac and on the raspberry, but in both cases, I can just launch the plot, but the servo motor doesn't work. I'll try again to install version 0.14 to see if it works like before already. I'll tell you again quickly.

Ah, yeah that explains it. 0.14 never worked with brushless, so you manually modified the code per https://github.com/nornagon/saxi/issues/136. The modifications got replaced when you switched.

Use the fork: https://github.com/alexrudd2/saxi. It works well for several people, and we intend to merge back here when @nornagon gets some time. :)

There's a new checkbox to switch between brushed and brushless.

Screenshot 2023-11-12 at 10 09 56 AM

Alternatively, run saxi --hardware brushless.

julienes commented 10 months ago

Yes, I installed this version and uninstalled version 0.14. I have the checkbox, but the Servo motor doesn't respond. But if it works for the others, I'll try to find out why. I tested with inkscape to see if the Servo worked, and yes, it does.

alexrudd2 commented 10 months ago

Strange. Does it work with --hardware brushless instead of the checkbox?

julienes commented 10 months ago

No, nothing happens. it identifies the connection correctly. when I start the drawing, the arm moves, but there's no action on the servo, either with the settings or during the drawing. No error in the console either

Capture d’écran 2023-11-12 à 21 24 17
jedahan commented 10 months ago

that looks like its npm start - if you start that way, try npm start -- --hardware brushless. The double -- is to make sure npm script runner passes that to the script, and doesn't try to apply to npm itself.

It is possible the runtime checkbox is not fully working, I should test again.

julienes commented 10 months ago

Ok, this way it works for both, mac and raspberry PI