Run sensor "change handler" also with the initial value
This commit is contained in:
parent
14f57f54bf
commit
41d5052583
@ -13,6 +13,7 @@ namespace sensors.internal {
|
|||||||
|
|
||||||
control.runInBackground(() => {
|
control.runInBackground(() => {
|
||||||
let prev = query()
|
let prev = query()
|
||||||
|
changeHandler(prev, prev)
|
||||||
while (true) {
|
while (true) {
|
||||||
loops.pause(periodMs)
|
loops.pause(periodMs)
|
||||||
let curr = query()
|
let curr = query()
|
||||||
|
@ -397,6 +397,10 @@ static void runPoller(Thread *thr) {
|
|||||||
// note that this is run without the user mutex held - it should not modify any state!
|
// note that this is run without the user mutex held - it should not modify any state!
|
||||||
TValue prev = pxt::runAction0(query);
|
TValue prev = pxt::runAction0(query);
|
||||||
|
|
||||||
|
startUser();
|
||||||
|
pxt::runAction2(thr->act, prev, prev);
|
||||||
|
stopUser();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
sleep_core_us(us);
|
sleep_core_us(us);
|
||||||
if (paniced)
|
if (paniced)
|
||||||
|
Loading…
Reference in New Issue
Block a user