Add dlogf printf formatting, ipv4::to_string helper, clean up string building

This commit is contained in:
Ian Gulliver
2026-04-11 08:21:59 +09:00
parent c35c1de76a
commit 3a3c5873c3
5 changed files with 32 additions and 7 deletions

View File

@@ -72,7 +72,11 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
uint8_t err_buf[256];
span_writer err_out(err_buf, sizeof(err_buf));
auto err = encode_response_into(err_out, msg->message_id,
DeviceError{2, "response too large: " + std::to_string(data.size())});
[&]{
char m[48];
snprintf(m, sizeof(m), "response too large: %zu", data.size());
return DeviceError{2, m};
}());
if (err) usb.send(std::span<const uint8_t>{err_buf, *err});
}
});