From 836af7e836c0f7718cb5b90ef9c3a237adca09f6 Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Thu, 21 May 2026 21:52:58 +0200 Subject: [PATCH] refactor: add gauge_config.h with centralised pin and motion defaults --- Gaugecontroller/gauge_config.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Gaugecontroller/gauge_config.h diff --git a/Gaugecontroller/gauge_config.h b/Gaugecontroller/gauge_config.h new file mode 100644 index 0000000..d2a92e2 --- /dev/null +++ b/Gaugecontroller/gauge_config.h @@ -0,0 +1,31 @@ +#pragma once +#include + +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]);