Write some debug info
| 217 | |
| 218 | // Write some debug info |
| 219 | void GCodeBuffer::Diagnostics(const StringRef& reply) noexcept |
| 220 | { |
| 221 | reply.lcat(codeChannel.ToString()); |
| 222 | #if HAS_SBC_INTERFACE |
| 223 | reply.cat(IsBinary() ? "* " : " "); |
| 224 | #else |
| 225 | reply.cat(" "); |
| 226 | #endif |
| 227 | switch (bufferState) |
| 228 | { |
| 229 | case GCodeBufferState::parseNotStarted: |
| 230 | reply.cat("is idle"); |
| 231 | break; |
| 232 | |
| 233 | case GCodeBufferState::ready: |
| 234 | reply.cat("is ready with \""); |
| 235 | AppendFullCommand(reply); |
| 236 | reply.cat('"'); |
| 237 | break; |
| 238 | |
| 239 | case GCodeBufferState::executing: |
| 240 | reply.cat("is doing \""); |
| 241 | AppendFullCommand(reply); |
| 242 | reply.cat('"'); |
| 243 | break; |
| 244 | |
| 245 | #if HAS_SBC_INTERFACE |
| 246 | case GCodeBufferState::executingOnSbc: |
| 247 | reply.cat("is doing \""); |
| 248 | AppendFullCommand(reply); |
| 249 | reply.cat("\" on the SBC"); |
| 250 | break; |
| 251 | #endif |
| 252 | |
| 253 | default: |
| 254 | reply.cat("is assembling a command"); |
| 255 | break; |
| 256 | } |
| 257 | |
| 258 | if (machineState->GetPrevious() != nullptr || |
| 259 | machineState->GetState() != GCodeState::normal || IsDoingFileMacro() |
| 260 | #if SUPPORT_ASYNC_MOVES |
| 261 | || syncState != SyncState::running |
| 262 | #endif |
| 263 | ) |
| 264 | { |
| 265 | reply.cat(" in state(s)"); |
| 266 | const GCodeMachineState *_ecv_null ms = machineState; |
| 267 | do { |
| 268 | reply.catf(" %d", (int)ms->GetState()); |
| 269 | ms = ms->GetPrevious(); |
| 270 | } while (ms != nullptr); |
| 271 | if (IsDoingFileMacro()) { |
| 272 | reply.cat(", running macro"); |
| 273 | } |
| 274 | #if SUPPORT_ASYNC_MOVES |
| 275 | if (syncState != SyncState::running) { |
| 276 | reply.catf(", sync state %u", (unsigned int)syncState); |
nothing calls this directly
no test coverage detected