Multi-directional pixel drawing and configurable sprocket sizes

I have a couple of minor updates to the controller and the embedded code, but there are a couple of things to be aware of if you’re updating.

Thing 1:
This might be a gotcha if you’re updating your embedded code.  The value for mmPerRev (essentially the amount of string that gets extended in one revolution of the sprocket) has previously been hard-coded. That is, the arduinos you all got from me already had a program installed that said the mmPerRev was 84, and it couldn’t be changed without reloading the firmware.
That value can now be modified from the controller, using the properties file key
machine.motors.mmPerRev=84.0
and restarting and clicking “upload machine spec” on F3-Details page.
The rub is that for those of you who ordered the machine from me, this value should be explicitly set to 84.0 if it isn’t already.  The default value is actually 95mm because that’s the mmPerRev on my main home one here.  The difference is because although the sprockets are the exact same size everywhere, the cord I supplied with your machines had a slightly different bead pitch, so what we’re really measuring is the length of 8 beads-worth of cord.  It might even change over time if it’s hanging up for ages, who knows.
The other thing:
The old embedded code had this concept of row direction.  So I’d use a command to set rows to go from left-to-right, then all the pixels I drew would be drawn in that direction, regardless of whether that fit the sequence of the pixels.  When I got to the end of the row, I’d send a command to say “now switch to right-to-left mode”, and start sending the pixels for the opposite direction.  What sometimes happened is that the first row was drawn backwards because its initial direction setting had been missed.  Particularly if you’re stopping and starting the drawing, or do some practice drawings first.
So I’ve got rid of this global row direction setting, and the embedded code is now “smart”, ha ha.  This means it will try to figure out the best direction to draw a pixel in, based on where the pen currently is.  So if the pen is up in the top right corner, and you ask it to draw  a pixel down at the bottom right of the page, it’ll start drawing on the north-east (top-left) edge of the pixel, and draw in a south-westerly direction.
I think this seems to work, but I haven’t exhaustively tested it.  I think if there are differences, then it will probably be on the ends of rows, when the direction needs to change.
Please let me know if it’s going mental and it needs more work.
Get the updated code at

Leave a Reply