[UWP] Fix infinite spin when downloading without device plugged (#1500)
* [UWP] Fix infinite spin when downloading without device plugged * Undo format changes * Undo format changes
This commit is contained in:
parent
a7e613c237
commit
52bd7bd146
@ -117,16 +117,18 @@ namespace pxt.editor {
|
|||||||
|
|
||||||
reconnectAsync(first: boolean) {
|
reconnectAsync(first: boolean) {
|
||||||
// configure serial at 115200
|
// configure serial at 115200
|
||||||
if (!first)
|
let p = Promise.resolve();
|
||||||
return this.packetIo.reconnectAsync()
|
if (!first) {
|
||||||
.then(() => this.allocDAP())
|
p = this.packetIo.reconnectAsync()
|
||||||
.then(() => this.cortexM.init())
|
.then(() => this.allocDAP());
|
||||||
.then(() => this.cmsisdap.cmdNums(0x82, [0x00, 0xC2, 0x01, 0x00]))
|
}
|
||||||
.then(() => { }, err => { this.useSerial = false })
|
|
||||||
else
|
return p
|
||||||
return this.cortexM.init()
|
.then(() => this.cortexM.init())
|
||||||
.then(() => this.cmsisdap.cmdNums(0x82, [0x00, 0xC2, 0x01, 0x00]))
|
.then(() => {
|
||||||
.then(() => { }, err => { this.useSerial = false })
|
return this.cmsisdap.cmdNums(0x82, [0x00, 0xC2, 0x01, 0x00])
|
||||||
|
.then(() => { this.useSerial = true }, (err: any) => { this.useSerial = false; });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectAsync() {
|
disconnectAsync() {
|
||||||
@ -157,7 +159,8 @@ namespace pxt.editor {
|
|||||||
let previousDapWrapper: DAPWrapper;
|
let previousDapWrapper: DAPWrapper;
|
||||||
function dapAsync() {
|
function dapAsync() {
|
||||||
if (previousDapWrapper)
|
if (previousDapWrapper)
|
||||||
return Promise.resolve(previousDapWrapper)
|
return previousDapWrapper.reconnectAsync(false) // Always fully reconnect to handle device unplugged mid-session
|
||||||
|
.then(() => previousDapWrapper);
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (previousDapWrapper) {
|
if (previousDapWrapper) {
|
||||||
@ -648,7 +651,7 @@ namespace pxt.editor {
|
|||||||
|
|
||||||
converts to
|
converts to
|
||||||
|
|
||||||
<block type="radio_on_number" x="196" y="208">
|
<block type="radio_on_number" x="196" y="208">
|
||||||
<field name="HANDLER_receivedNumber" id="DCy(W;1)*jLWQUpoy4Mm" variabletype="">receivedNumber</field>
|
<field name="HANDLER_receivedNumber" id="DCy(W;1)*jLWQUpoy4Mm" variabletype="">receivedNumber</field>
|
||||||
</block>
|
</block>
|
||||||
<block type="radio_on_value" x="134" y="408">
|
<block type="radio_on_value" x="134" y="408">
|
||||||
|
Loading…
Reference in New Issue
Block a user