Added parameters for motor config.

This commit is contained in:
Holger Weber
2026-02-22 22:47:00 +01:00
parent 3059e5a493
commit 400edb45e5
4 changed files with 116 additions and 55 deletions

View File

@@ -21,35 +21,39 @@
#ifdef ESP32
// Rotational Stepper
#define dir1 16
#define enableRotMotor 12
#define step1 26
static const int kDefaultRotDirPin = 16;
static const int kDefaultRotEnablePin = 12;
static const int kDefaultRotStepPin = 26;
#define rotMicrostep 32
static const int kDefaultRotMicrostep = rotMicrostep;
// Pen Stepper
#define step2 25
#define dir2 27
#define enablePenMotor 12
static const int kDefaultPenStepPin = 25;
static const int kDefaultPenDirPin = 27;
static const int kDefaultPenEnablePin = 12;
#define penMicrostep 32
static const int kDefaultPenMicrostep = penMicrostep;
#define servoPin 17
static const int kDefaultServoPin = 17;
#else
// Rotational Stepper
#define step1 2
#define dir1 5
#define enableRotMotor 8
static const int kDefaultRotStepPin = 2;
static const int kDefaultRotDirPin = 5;
static const int kDefaultRotEnablePin = 8;
#define rotMicrostep 16
static const int kDefaultRotMicrostep = rotMicrostep;
// Pen Stepper
#define step2 3
#define dir2 6
#define enablePenMotor 8
static const int kDefaultPenStepPin = 3;
static const int kDefaultPenDirPin = 6;
static const int kDefaultPenEnablePin = 8;
#define penMicrostep 16
static const int kDefaultPenMicrostep = penMicrostep;
#define servoPin 4
static const int kDefaultServoPin = 4;
#endif
@@ -81,6 +85,15 @@ extern boolean g_bPrgButtonState;
extern float fROT_STEP_CORRECTION;
extern float fPEN_STEP_CORRECTION;
extern boolean g_bMotorsEnabled;
extern int g_iRotDirPin;
extern int g_iRotEnablePin;
extern int g_iRotStepPin;
extern int g_iPenStepPin;
extern int g_iPenDirPin;
extern int g_iPenEnablePin;
extern int g_iServoPin;
extern int g_iRotMicrostep;
extern int g_iPenMicrostep;
extern ConfigParameter configParameters[];
extern const size_t configParameterCount;
@@ -100,6 +113,7 @@ bool parseSMArgs(uint16_t *duration, int *penStepsEBB, int *rotStepsEBB);
void prepareMove(uint16_t duration, int penStepsEBB, int rotStepsEBB);
void storePenUpPosInEE();
void storePenDownPosInEE();
void updateStepCorrectionFactors();
bool initConfigStore();
bool loadConfigFromFile();