artisan-roaster-scope / artisan

artisan: visual scope for coffee roasters
https://artisan-scope.org
GNU General Public License v3.0
948 stars 256 forks source link

basic phidget stepper motor support for slider and buttons #1715

Closed crocsaint closed 1 month ago

crocsaint commented 1 month ago

Hello,

I added basic commands to control a phidget (bipolar-) stepper motor via a slider or button action. I copied the structure of the phidget RC servo implementation. Currently there are 3 commands:

rescale(ch,val[,sn]) - used to set the rescale factor engaged(ch,state[,sn]) - used to engage the channel set(ch,pos[,sn]) - used to set the target position

The (scale) 'Factor' in the Events-window can be used to decide the direction (-1 for counter-/ 1 for clockwise). In combination with the 3 commands and the min/ max of the slider there are many ways to control the stepper motor. The rescale factor can be used to make 1 step = 1° or 1 step = rotation, etc. So setting the min=0, max=100 and factor=-3.6 in combination with the right rescale factor gives a rotation in [0,-360°] where each step is equal to -3.6°.

AppVeyorBot commented 1 month ago

:white_check_mark: Build artisan aa088e6 (1357) completed (commit https://github.com/artisan-roaster-scope/artisan/commit/aa088e612b by @crocsaint)

MAKOMO commented 1 month ago

This looks very good! Thanks for this addition. I merged this as is and will add documentation to the Phidget page on artisan-scope.org