Restore settings logic

This commit is contained in:
Matt McWilliams 2023-08-30 01:18:10 -04:00
parent 03f2b55762
commit eec7765e73
3 changed files with 29 additions and 1 deletions

View File

@ -21,6 +21,11 @@ void McopyProjector::begin () {
_feed.setSpeed(_speed);
_feed.setAcceleration(1000.0);
pinMode(_takeupSettingA, OUTPUT);
pinMode(_takeupSettingB, OUTPUT);
pinMode(_feedSettingA, OUTPUT);
pinMode(_feedSettingB, OUTPUT);
setStepperMode(1);
}

View File

@ -4,6 +4,23 @@
#include <Arduino.h>
#include <AccelStepper.h>
/**
* D2 X Step
* D3 X Direction
* D4 X MS1 setting
* D5 X MS2 setting
* D6 Y Step
* D7 Y Direction
* D8 Y MS1 setting
* D9 Y MS2 setting
*
* MS1(X/Y) MS2(X/Y) Description
* L L Full step
* H L Half step
* L H Quarter step
* H H Eighth STEP
**/
class McopyProjector {
private:

View File

@ -31,6 +31,12 @@
#define FEED_DIR_PIN 7
#define FEED_STEP_PIN 6
#define TAKEUP_SETTINGS_A 4
#define TAKEUP_SETTINGS_B 5
#define FEED_SETTINGS_A 8
#define FEED_SETTINGS_B 9
AccelStepper takeup(AccelStepper::DRIVER, TAKEUP_STEP_PIN, TAKEUP_DIR_PIN);
AccelStepper feed(AccelStepper::DRIVER, FEED_STEP_PIN, FEED_DIR_PIN);
@ -50,7 +56,7 @@ volatile bool direction = true;
volatile long start;
McopySerial mcopy;
McopyProjector projector(takeup, feed);
McopyProjector projector(takeup, feed, TAKEUP_SETTINGS_A, TAKEUP_SETTINGS_B, FEED_SETTINGS_A, FEED_SETTINGS_B);
void setup () {
pins();