Move picoboot reboot into handler via dispatch_schedule_ms
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "pico/bootrom.h"
|
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "wire.h"
|
#include "wire.h"
|
||||||
#include "usb_cdc.h"
|
#include "usb_cdc.h"
|
||||||
@@ -72,10 +71,6 @@ void dispatch_schedule_ms(uint32_t ms, std::function<void()> fn) {
|
|||||||
usb.send(response);
|
usb.send(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg->type_id == RequestPICOBOOT::ext_id) {
|
|
||||||
sleep_ms(100);
|
|
||||||
reset_usb_boot(0, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#include "handlers.h"
|
#include "handlers.h"
|
||||||
#include "pico/unique_id.h"
|
#include "pico/unique_id.h"
|
||||||
|
#include "pico/bootrom.h"
|
||||||
|
#include "dispatch.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "debug_log.h"
|
#include "debug_log.h"
|
||||||
|
|
||||||
std::vector<std::vector<uint8_t>> handle_picoboot(uint32_t message_id, std::span<const uint8_t>) {
|
std::vector<std::vector<uint8_t>> handle_picoboot(uint32_t message_id, std::span<const uint8_t>) {
|
||||||
|
dispatch_schedule_ms(100, []{ reset_usb_boot(0, 1); });
|
||||||
return {encode_response(message_id, ResponsePICOBOOT{})};
|
return {encode_response(message_id, ResponsePICOBOOT{})};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user