crownstone / crownstone-microapp

Crownstone microapp. Contains several examples and library to communicate with bluenet.
Apache License 2.0
2 stars 6 forks source link

Bug: emptySoftInterrupts set/read mismatch #15

Closed martijnvandermarel closed 2 years ago

martijnvandermarel commented 2 years ago

On the microapp side, the number of empty interrupts is determined and written to the bluenet2microapp buffer, as seen here: https://github.com/crownstone/crownstone-microapp/blob/dcba43b38a768040e4a96e0865e79078ab607dfa/src/microapp.c#L187 (it is written back in the 'request' from bluenet to the microapp)

However, on the bluenet side the emptyInterruptSlots is read from the microapp2bluenet buffer, as seen here: https://github.com/crownstone/bluenet/blob/49c6e0302c64d3abe568e8add7e7f263a42d07b7/source/src/microapp/cs_MicroappCommandHandler.cpp#L104 (where cmd refers to the cmd by the microapp to bluenet)

So, the current implementation does not work. IMO the best way to fix this would be to write the emptyInterruptSlots in the microapp2bluenet buffer, which is more intuitive since it fits with the direction of information.

mrquincle commented 2 years ago

Good catch. That's indeed legacy from when there was only a single buffer. The microapp should indeed not write towards the incoming buffer.