|
Motion Master 6.0.0-alpha.111
Next-generation motion control software
|
Functions | |
| std::expected< Config, std::string > | parseConfig (const nlohmann::json &doc) |
Deserialises a parsed JSONC document into a Config, applying defaults for absent keys. | |
| std::expected< void, std::string > | validateFieldbusConfig (const FieldbusConfig &fieldbus) |
Checks the "fieldbus" block. The config file and POST /api/init share it. | |
| std::expected< Config, std::string > parseConfig | ( | const nlohmann::json & | doc | ) |
Deserialises a parsed JSONC document into a Config, applying defaults for absent keys.
Pure: no file I/O, no process exit. Unknown keys are ignored (forward-compatible). nlohmann validates value types; this adds the enum and range checks it cannot (logging.level, fieldbus.driver; gameLoop.periodUs, recorder.capacity and autoTuning.port must be > 0).
| doc | A parsed JSON value (must be an object). |
Config, or an error string on a wrong top-level type, a field type mismatch (from nlohmann), or an invalid enum value. | std::expected< void, std::string > validateFieldbusConfig | ( | const FieldbusConfig & | fieldbus | ) |
Checks the "fieldbus" block. The config file and POST /api/init share it.
An empty driver passes, because it means "do not init". For "spoe" it needs at least one address, a known mode, a watchdogMs of at least 50 and a nonzero port.