refactor: add gauge_config.h with centralised pin and motion defaults
This commit is contained in:
31
Gaugecontroller/gauge_config.h
Normal file
31
Gaugecontroller/gauge_config.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
struct GaugeConfig {
|
||||||
|
// Hardware
|
||||||
|
uint8_t dirPin;
|
||||||
|
uint8_t stepPin;
|
||||||
|
int8_t enablePin; // -1 = no enable pin
|
||||||
|
bool dirInverted;
|
||||||
|
bool stepActiveHigh;
|
||||||
|
bool enableActiveLow;
|
||||||
|
|
||||||
|
// Motion defaults (integers; cast to float in setup())
|
||||||
|
long minPos;
|
||||||
|
long maxPos;
|
||||||
|
long homingBackoffSteps;
|
||||||
|
int maxSpeed; // steps/s
|
||||||
|
int accel; // steps/s²
|
||||||
|
int homingSpeed; // steps/s
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr GaugeConfig gaugeConfigs[] = {
|
||||||
|
// dir step en dirInv stepHi enLow min max backoff speed accel homeSpd
|
||||||
|
{ 48, 49, -1, false, true, true, 0, 3780, 3800, 4000, 6000, 500 },
|
||||||
|
{ 8, 9, -1, true, true, true, 0, 3780, 3800, 4000, 6000, 500 },
|
||||||
|
{ 52, 53, -1, false, true, true, 0, 3780, 3800, 4000, 6000, 500 },
|
||||||
|
{ 50, 51, -1, false, true, true, 0, 3780, 3800, 4000, 6000, 500 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t GAUGE_COUNT =
|
||||||
|
sizeof(gaugeConfigs) / sizeof(gaugeConfigs[0]);
|
||||||
Reference in New Issue
Block a user