Add dlogf printf formatting, ipv4::to_string helper, clean up string building
This commit is contained in:
@@ -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});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user