microsoft / pxt-brainpad

Microsoft MakeCode editor for the GHI Brainpad
https://makecode.brainpad.com/
Other
3 stars 11 forks source link

Accelerometer events. #107

Closed greg-norris closed 5 years ago

greg-norris commented 6 years ago

Accelerometer events don't seem to be working in the sample program below. It works on the simulator but not on the hardware. Other accelerometer functions appear to be working as expected.

https://makecode.com/_i7tb8w6ajAoP

pelikhan commented 6 years ago

If it does not work on the hardware, this means your CODAL implementation of the accelerometer Is not emitting those events.

pelikhan commented 6 years ago

https://makecode.microbit.org/_a0EYkMEsF88w

pelikhan commented 6 years ago

The extra defines that I removed yesterday might also have been messing around events.

pelikhan commented 6 years ago

Is this still an issue?

greg-norris commented 6 years ago

We've found that the Accelerometer events all work, but only after you initially read an Accelerometer value and display it on screen or use the value somewhere in a program. Until we do that the Accel events don't work. We are looking into the fix now.

pelikhan commented 6 years ago

The accelerometer servie is instantiated lazily and "initialized" when registering an event. See https://github.com/Microsoft/pxt-common-packages/blob/master/libs/accelerometer/accelerometer.cpp#L154

greg-norris commented 6 years ago

@pelikhan

Hello Folks, We created a branch called AccelBranch located here:

https://github.com/ghi-electronics/codal-brainpad/tree/AccelBranch

Which has the new code that sets up the interrupt pin properly in MMA8453::configure() here:

https://github.com/ghi-electronics/codal-brainpad/blob/AccelBranch/source/MMA8453.cpp

We verified the new changes fire the interrupt pin with a scope. In looking at the code it also looks like we might be missing an accel interrupt service routine to handle the interrupts. Were just not sure if this is something the glue in pxt would handle or something handled in our codal-brainpad repo. During our testing we got readings when the board was laying flat on a table and moving it around in a flat position, as soon as we raised the board in the air, the accel would stop reading data and lock up the accel.

pelikhan commented 6 years ago

Codal people, any tip here?

Get Outlook for iOShttps://aka.ms/o0ukef


From: greg-norris notifications@github.com Sent: Thursday, September 27, 2018 11:56 AM To: Microsoft/pxt-brainpad Cc: Peli de Halleux; Mention Subject: Re: [Microsoft/pxt-brainpad] Accelerometer events. (#107)

@pelikhanhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpelikhan&data=02%7C01%7Cjhalleux%40microsoft.com%7C557b79d089aa467bc60d08d624aafd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636736714147812640&sdata=daAikeoGBr6g61WMZ6qp83062L7Wnqh2Z5%2FU9i8wx6U%3D&reserved=0

Hello Folks, We created a branch called AccelBranch located here:

https://github.com/ghi-electronics/codal-brainpad/tree/AccelBranchhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghi-electronics%2Fcodal-brainpad%2Ftree%2FAccelBranch&data=02%7C01%7Cjhalleux%40microsoft.com%7C557b79d089aa467bc60d08d624aafd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636736714147822648&sdata=3opqHqUG3aYKGmfNjYX4bSo6QqzYkLrynAeU3R0Ct7Q%3D&reserved=0

Which has the new code that sets up the interrupt pin properly in MMA8453::configure() here:

https://github.com/ghi-electronics/codal-brainpad/blob/AccelBranch/source/MMA8453.cpphttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghi-electronics%2Fcodal-brainpad%2Fblob%2FAccelBranch%2Fsource%2FMMA8453.cpp&data=02%7C01%7Cjhalleux%40microsoft.com%7C557b79d089aa467bc60d08d624aafd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636736714147822648&sdata=jcAswQJdIyIkXx1Ag3DDb6OL7X7xiKfq%2FByQlzX0r9w%3D&reserved=0

We verified the new changes fire the interrupt pin with a scope. In looking at the code it also looks like we might be missing an accel interrupt service routine to handle the interrupts. Were just not sure if this is something the glue in pxt would handle or something handled in our codal-brainpad repo. During our testing we got readings when the board was laying flat on a table and moving it around in a flat position, as soon as we raised the board in the air, the accel would stop reading data and lock up the accel.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2Fpxt-brainpad%2Fissues%2F107%23issuecomment-425205140&data=02%7C01%7Cjhalleux%40microsoft.com%7C557b79d089aa467bc60d08d624aafd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636736714147832660&sdata=OZJn3k%2B%2BT1Kc%2FPkJES3igg2v7Q98ZnBpeDyJgL6w884%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD-4KTGuXWEhguT15b89X6eye8q-aVhLks5ufR90gaJpZM4UyX56&data=02%7C01%7Cjhalleux%40microsoft.com%7C557b79d089aa467bc60d08d624aafd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636736714147842664&sdata=BijPUKO37XsjuUI4Tf6HRuhEsQP%2B%2B20qU1KAw8BUHek%3D&reserved=0.

greg-norris commented 5 years ago

Temporary fixed with hack.