lancaster-university / codal-microbit-v2

CODAL target for the micro:bit v2.x series of devices
MIT License
43 stars 52 forks source link

MicroBitPowerManager::recvUIPMPacket() reads too much I2C data unnecessarily #168

Open microbit-carlos opened 2 years ago

microbit-carlos commented 2 years ago

recvUIPMPacket() reads the maximum amount of data used by any "packet" type, which is the value stored in MICROBIT_UIPM_MAX_BUFFER_SIZE:

https://github.com/lancaster-university/codal-microbit-v2/blob/9305a13fa4ec3007f70e5024d37f0965ee485444/source/MicroBitPowerManager.cpp#L189-L202

When most packets only send back one or two bytes, so the rest of the data transfer will be zeros: https://github.com/lancaster-university/codal-microbit-v2/blob/9305a13fa4ec3007f70e5024d37f0965ee485444/source/MicroBitPowerManager.cpp#L30-L39

And the MICROBIT_UIPM_MAX_BUFFER_SIZE value is about to increase from 8 to 11 in https://github.com/lancaster-university/codal-microbit-v2/pull/154/files.

JohnVidler commented 2 years ago

Moving this to v0.2.40, as this is ultimately a minor patch and can be done after the major tagging effort for MC2022