You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rebar_api:debug("No Pico found matching ~s.", [ResetBase]),
202
260
ok;
203
-
true ->
204
-
Flag=get_stty_file_flag(),
205
-
BootselMode=lists:join("", [
206
-
"stty", Flag, ResetPort, "1200"
261
+
{true, ResetPort} ->
262
+
rebar_api:debug("Pico at ~s needs reset...", [ResetPort]),
263
+
do_reset(ResetPort),
264
+
rebar_api:info("Waiting for the device at path ~s to settle and mount...", [
265
+
string:trim(PicoPath)
207
266
]),
208
-
rebar_api:info("Resetting device at path ~s", [ResetPort]),
209
-
ResetStatus=os:cmd(BootselMode),
210
-
caseResetStatusof
211
-
"" ->
212
-
ok;
213
-
Error ->
214
-
caseos:find_executable(picotool) of
215
-
false ->
216
-
rebar_api:error("Warning: ~s~nUnable to locate 'picotool', close the serial monitor before flashing, or install picotool for automatic disconnect and BOOTSEL mode.", [Error]),
217
-
erlang:throw(reset_error);
218
-
_Path ->
219
-
rebar_api:warn("Warning: ~s~nFor faster flashing remember to disconnect serial monitor first.", [Error]),
220
-
DevReset=lists:join("", [
221
-
"picotool", "reboot", "-f", "-u"
222
-
]),
223
-
rebar_api:warn("Disconnecting serial monitor with: `~s' in 5 seconds...", [DevReset]),
224
-
timer:sleep(5000),
225
-
RebootReturn=os:cmd(DevReset),
226
-
RebootStatus=string:trim(RebootReturn),
227
-
caseRebootStatusof
228
-
"The device was asked to reboot into BOOTSEL mode." ->
229
-
ok;
230
-
BootError ->
231
-
rebar_api:error("Failed to prepare pico for flashing: ~s", [BootError]),
232
-
erlang:throw(picoflash_reboot_error)
233
-
end
234
-
end
235
-
end,
236
-
PrettyPath=lists:join("", [
237
-
"echo", PicoPath
238
-
]),
239
-
rebar_api:info("Waiting for the device at path ~s to settle and mount...", [string:trim(os:cmd(PrettyPath))]),
0 commit comments