#pragma once #include "fgc/IMotorController.h" #include #include namespace fgc { // Parse a firmware `ST` status line: // // ST Y:,,,,,,, [P:...] // // where is B/R/H/A/E and is an optional run of status letters // (S=standstill, s=stall, d=encoder deviation, o/O=overtemp, L/R=endstops). // Returns nullopt // for any line that is not a well-formed `ST` line (acks and other async output // like OK/ERR/DG/DUMP are handled by the caller). A missing/garbled axis segment // yields nullopt rather than partial data. std::optional parseTelemetryLine(const std::string& line); // Parse a single "Y:..." / "P:..." axis segment. Exposed for unit testing. std::optional parseAxisSegment(const std::string& seg); // "ENV t=23 h=45 ok=1 fan=0 rpm=0" -> a reading (epoch_ms left 0). Keys in any // order; t, h and ok required, fan and rpm optional. Nothing for anything else. std::optional parseEnvLine(const std::string& line); } // namespace fgc