Driving Galvos with CustomEvent Script
Basicly I want to use a CustomEvent to drive my Galvonometers for x and y instead of a stepper system. My idea was to take the EVENT_CONTRAIN_DESTINATION_COORDINATES and use the Printer::destinationSteps[...]; to calculate the signal for the galvos. As it is time critical I want to use the onboard DAC0 and DAC1 of the arduino due not an external Chip and Software SPI. But with the fastio and HAL of the repetier firmware I´m confused how to generate the needed analog signal. Can the WRITE function of HAL be used for this if DAC0 and DAC1 is defined in userpins?
As no actual Steps have to be made I would just update the currentSteps with the destinationSteps when the signal for the galvos is generated:
Printer::currentPositionSteps[X_AXIS] = Printer::destinationSteps[X_AXIS];
Printer::currentPositionSteps[Y_AXIS] = Printer::destinationSteps[Y_AXIS];
Thanks for any help!
As no actual Steps have to be made I would just update the currentSteps with the destinationSteps when the signal for the galvos is generated:
Printer::currentPositionSteps[X_AXIS] = Printer::destinationSteps[X_AXIS];
Printer::currentPositionSteps[Y_AXIS] = Printer::destinationSteps[Y_AXIS];
Thanks for any help!
Comments
That said, how do you plan to solve the timing problem. The function you have choosen gets called once you add a line but this has no timings an din fact will have to wait for the real move to finish. Woundn't it be better to add a realtime position tracker for x and y in stepX/stepY and send the new position everytime it changes. Not sure how fast the dac update is but that is what I'd do. That way you control also curing time. With correct scaling the values are the values to send to dac except if you get some angular errors and need awfully slow sin/cos functions to correct them.