From 15257ae6f2d008d3fca80574a25902bdde65992d Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Thu, 23 Apr 2026 00:31:17 +0200 Subject: [PATCH] CFG? added --- Gaugecontroller/Gaugecontroller.ino | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Gaugecontroller/Gaugecontroller.ino b/Gaugecontroller/Gaugecontroller.ino index 5810ca3..a744f66 100644 --- a/Gaugecontroller/Gaugecontroller.ino +++ b/Gaugecontroller/Gaugecontroller.ino @@ -794,6 +794,24 @@ bool parsePosQuery(const String& line) { return false; } +// Answers `CFG?` with speed and acceleration for every gauge. +// Emits one `CFG ` line per gauge, then replies `OK`. +bool parseCfgQuery(const String& line) { + if (line == "CFG?") { + for (uint8_t i = 0; i < GAUGE_COUNT; i++) { + CMD_PORT.print("CFG "); + CMD_PORT.print(i); + CMD_PORT.print(' '); + CMD_PORT.print((int)gauges[i].maxSpeed); + CMD_PORT.print(' '); + CMD_PORT.println((int)gauges[i].accel); + } + sendReply("OK"); + return true; + } + return false; +} + // Answers the mandatory life question: are you there? // Reply: `PONG`. bool parsePing(const String& line) { @@ -1058,6 +1076,7 @@ void processLine(const String& line) { if (parseHome(line)) return; if (parseSweep(line)) return; if (parsePosQuery(line)) return; + if (parseCfgQuery(line)) return; if (parseLedQuery(line)) return; if (parseLed(line)) return; if (parseBlink(line)) return;