New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AP_Filesystem API #11936
Add AP_Filesystem API #11936
Conversation
@WickedShell please check if the AP_Scripting changes are OK (also need to check it all works). |
15a9e51
to
bf463cc
Compare
611a708
to
a967ec8
Compare
this was flight tested today on a bixler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks scripting on real boards. Works fine in SITL, but on a CubeBlack build the same script which previously worked now dies with unexpected symbol on the first line when parsing the script. I haven't gotten to investigate it yet, but it looks like it's probably reading corrupt data off the SD card. It's also notable that scripting is still implicitly using remove, and getting away with it, which is probably not correct with the AP_FS abstraction. The sample script I used was this:
function loop ()
gcs:send_text(0, "LOOPING")
file = io.open("test.lua", "r")
gcs:send_text(0, file:read("*all"))
file:close()
return loop, 1000
end
file = io.open("test.lua", "a")
-- sets the default output file as test.lua
io.output(file)
-- appends a word test to the last line of the file
io.write("-- End of the test.lua file")
io.close(file)
return loop, 1000
@WickedShell ok, thanks. I'll fix this soon |
d859310
to
c6e302b
Compare
@WickedShell I've now got it working with Lua scripts, and also now have a common FILE implementation between SITL and ChibiOS, so valgrind does useful checking of Lua IO calls |
c6e302b
to
ffaae3a
Compare
c98847d
to
8f48487
Compare
@@ -383,8 +383,8 @@ bool AP_Proximity_LightWareSF40C::process_reply() | |||
case RequestType_Health: | |||
// expect result in the form "0xhhhh" | |||
if (element_len[0] > 0) { | |||
int result; | |||
if (sscanf(element_buf[0], "%x", &result) > 0) { | |||
long int result = strtol(element_buf[0], nullptr, 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this change to the proximity sensor is included in the AP_Filesystem PR.? I haven't looked into the implications of the change from sscanf to strtol, and it's probably a harmless change, but thought I'd note it here anyway.
I've read through all the code changes in the AP_Filesystem PR, and had just one comment that I added above. everything else looks like it's a pretty straight-forward relocation of the existing filesystem functions into the AP_FS:: namespace without too much to worry about. |
needed to avoid problem with end() method in UARTDriver shadowing with F7 implementation of cache macros
not needed now we have a semaphore in AP_Filesystem
this allows for cards to be removed and re-inserted while continuing logging
this allows us to catch accidential inclusion of libc functions that we don't want
8f48487
to
b1927a6
Compare
merged after discussion with mdb |
This adds an AP_FIlesystem API for all filesystem operations. It cleans up the existing posix abstraction in ChibiOS, and will enable us to add automatic remount on operation failures
A new parameter LOG_FILE_TIMEOUT is added which gives the timeout in seconds for log writes. Setting this to 30 allows you to remove the card for 30s and when re-inserted logging will continue.
This is an alternative to #8639 from @peterbarker
Issues: