fix(spiflash): USB storage cannot persist files copied#7457
Conversation
📝 WalkthroughWalkthrough
ChangesFRFTL Initialization Control Flow
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@raphaelcoeffic I am not feeling comfortable about the control flow of USB plug and unplugged, maybe you should take a look in it. I solve my problem using a simple fix, but the point is why the driver will be initialized twice that cause the problem. |
|
@pfeerick I have tested this change, it is ready to merge. I asked Raphael to review, but that is another problem. |
|
I discovered it when I trying to setup my new heli. The new image file, just didn't store properly. |
Thanks for confirming I'm not going nuts... I could have sworn I had similar issues with PL18EV or PA01 but it was intermittent and probably thought I'd forgotten to transfer the files or something. |
|
Should not affect PA01, only nor flash filesystem has this problem, PA01 is just onboard sdcard chip. |
The root cause is after USB unplugged, static DSTATUS spi_flash_initialize(BYTE lun) will be called again. frftl need to be initialized only once, a second init will cause memory leak and data loss.
No problem in 2.10.x, the bug is introduce from 2.11 onwards.
Summary by CodeRabbit