Closed microbit-carlos closed 1 month ago
This is odd - do you know whether the byte-by-byte case ever wrote 'log full'? Does it still work if logging longer lengths? From MakeCode?
It must have worked at some point, as I believe that's how the "log full" message is meant to be displayed:
I haven't tried it in MakeCode yet.
@microbit-carlos It does get to this point (even with a long string to fill memory more quickly) https://github.com/lancaster-university/codal-microbit-v2/blob/master/source/MicroBitLog.cpp#L740
But I think the last byte before flash.getFlashEnd() is blocked by the equals in this test https://github.com/lancaster-university/codal-microbit-v2/blob/master/source/FSCache.cpp#L119 and https://github.com/lancaster-university/codal-microbit-v2/blob/master/source/FSCache.cpp#L87
With ">=" changed to ">" in the FSCache test, the I2C transaction seems OK, but it still seems to be zeros in the file. https://github.com/lancaster-university/codal-microbit-v2/blob/master/source/MicroBitUSBFlashManager.cpp#L369
FSCache::write address 0x1EFFD length 3 getFlashEnd 0x1F000
FUL
MicroBitUSBFlashManager::write 0x1EFFC 4
request 0xB 0x1 0xEF 0xFC 0x0 0x0 0x0 0x4 0xFF 0x46 0x55 0x4C
response 0xB 0x1 0xEF 0xFC 0x0 0x0 0x0 0x4 0xFF
Ah! I forgot the USB must be reconnected to see the latest data... FUL is there!
FUL is saved when the FSCache::write test is changed to ">", but it doesn't always make LOG FULL appear. MY_DATA.HTM.txt
Great debugging Martin! Could you submit a PR with the fix? Or do you think there is additional testing we should do before that?
Will do!
Running this programme on tag v0.2.63, which writes to the data log one byte at a time until the log is full:
MICROBIT.hex.zip
We should expect the last 4 bytes, which are reserved for this marker, to contain
FULL
: https://github.com/lancaster-university/codal-microbit-v2/blob/d54ce9b784ef1bba22c075b281bb877abf53ea18/source/MicroBitLog.cpp#L258 https://github.com/lancaster-university/codal-microbit-v2/blob/d54ce9b784ef1bba22c075b281bb877abf53ea18/source/MicroBitLog.cpp#L738-L742However, the last 4 bytes are left untouched: MY_DATA.HTM.txt