|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Layer: L7 Application ยท Build flags: PROTOCORE_ENABLE_DIAG
diag(slot_id) serves a JSON snapshot of which features are enabled and how the buffers are sized. It is handy while developing - one route tells you exactly what the firmware was built with - but because it exposes the build configuration, keep it off (or behind auth) in production.
One call renders the build snapshot:
Every value in the document is a compile-time constant: each feature flag renders as true or false, each sizing constant as a decimal. Nothing is discovered at runtime, so the report cannot drift from the real configuration.
The document itself is a frame spec - a DIAG_DOC table of literal segments interleaved with the values - which diag() fills into 975 bytes borrowed from the plaintext arena, sends, and then releases. If the borrow or the fill fails the route answers 503 with an empty body, so no partial document reaches the wire.
The complete sketch (Diagnostics.ino), reproduced verbatim with added explanatory comments: