Debug log with dlog_if_slow, MACRAW ping working, wfi disabled
This commit is contained in:
@@ -31,11 +31,10 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
static static_vector<uint8_t, 256> usb_rx_buf;
|
||||
|
||||
while (true) {
|
||||
tud_task();
|
||||
|
||||
usb.drain();
|
||||
timers.run();
|
||||
//net_poll();
|
||||
dlog_if_slow("tud_task", 1000, [&]{ tud_task(); });
|
||||
dlog_if_slow("drain", 1000, [&]{ usb.drain(); });
|
||||
dlog_if_slow("timers", 1000, [&]{ timers.run(); });
|
||||
dlog_if_slow("net_poll", 1000, [&]{ net_poll(); });
|
||||
|
||||
while (tud_cdc_available()) {
|
||||
uint8_t byte;
|
||||
@@ -54,7 +53,13 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
auto it = handler_map.find(msg->type_id);
|
||||
if (it != handler_map.end()) {
|
||||
for (auto& response : it->second(msg->message_id, msg->payload)) {
|
||||
usb.send(response);
|
||||
if (response.size() > usb.tx.free()) {
|
||||
auto err = encode_response(msg->message_id,
|
||||
DeviceError{2, "response too large: " + std::to_string(response.size())});
|
||||
usb.send(err);
|
||||
} else {
|
||||
usb.send(response);
|
||||
}
|
||||
}
|
||||
if (msg->type_id == RequestPICOBOOT::ext_id) {
|
||||
sleep_ms(100);
|
||||
@@ -63,6 +68,6 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
||||
}
|
||||
}
|
||||
|
||||
__wfi();
|
||||
// __wfi();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user