reset_color_bresenham( ) {
//called at the end of setup_color_bresenham(), and from step_colour_bresenham().
//reset the line ready to draw the first point
//set colour_step to the length of the leading axis;
}
setup_color_bresenham( colourmix[EXTRUDERS] ) {
//Called when the color is changed. Other virtual tool, or set colour, or changed E parameters.
}
uint8_t step_colour_bresenham() {
Called from get_extruder().
Make a step. return a bitmask for the steppers who stepped.
If at the end of the line reset_colour_bresenham()
}
uint8_t get_extruder(void) {
//Called whenever an E-step is needed - forwards and backwards.
//Returns the index of a stepper.
static uint8_t stack = 0;
static uint8:t b = 0;
do {
while (stack) {
if (stack & 1) {
stack= stack>>1;
return b++; // steps could also be executed here, but pulse time cant be used for anything else.
} else {
stack = stack>>1;
b++;
}
}
b=0;
stack = step_colour_bresenham();
// may produce steps for more than one extruder at once, but only one per extruder
} while (true);
}
Idea for a steady colour mix: