Make sure the ESC button always stops the program
This commit is contained in:
parent
7bd6280292
commit
4039a85bc9
@ -163,6 +163,10 @@ namespace brick {
|
||||
if (sl[i])
|
||||
ret |= 1 << i
|
||||
}
|
||||
// this needs to be done in query(), which is run without the main JS execution mutex
|
||||
// otherwise, while(true){} will lock the device
|
||||
if (ret & DAL.BUTTON_ID_ESCAPE)
|
||||
control.reset()
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -172,8 +176,6 @@ namespace brick {
|
||||
if (!btnsMM) control.fail("no buttons?")
|
||||
buttons = []
|
||||
sensors.internal.unsafePollForChanges(50, readButtons, (prev, curr) => {
|
||||
if (curr & DAL.BUTTON_ID_ESCAPE)
|
||||
control.reset()
|
||||
for (let b of buttons)
|
||||
b._update(!!(curr & b.mask))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user