-
-
Notifications
You must be signed in to change notification settings - Fork 943
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
BLE FS Using adafruits Simple (not fast) BLE FS Api #756
Conversation
} | ||
{ } | ||
|
||
FS::FS(Pinetime::Drivers::SpiNorFlash& driver) |
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 was just a clang format change...There are a few of these littered out ill try to comment on them here
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.
Meh, keep them. Assuming your config is correct, they have to be merged anyways.
+1 for the Adafruit protocol 😀 the even slightly bigger ecosystem will help. |
is this pr will allow to send fonts and picture with gadgetbridge or we need to have someone to make a pull on gadgetbridge for this pull to work? is this pull will be able to make a secure connection? if not it's worring |
@lman0 Neither of those topics are really in the scope of this PR. |
thanks , i didnt understood then ! |
This PR is a first step needed to allow companion app to upload assets (bitmaps, fonts, logo,...) into the filesystem (on the external SPI flash memory). When this PR will be merged, companion apps like Gadgetbridge will be able to send files into the watch, but we'll still need to actually use them in InfiniTime (which will probably be done in future PRs). Also, the support for this new protocol will need to be implemented in companion apps.
BLE security is indeed not in the scope of the PR, but that's definitely something we'll need to implement at some point :)
Do we have to implement both sets of commands? If I understand correctly, "non-pacing" commands allow a stateless implementation : each command contains all the data needed (path, offset,...) to read of write into a file. On the other hand, "pacing" commands allow a more optimized implementation because only the data would be transferred over BLE. The 'pacing' one look interesting, but maybe we don't need them for a first implementation. We could go for the simpler solution to begin with, and improve it later on. That would reduce the complexity of the integration of this new API and allow us to implement complete functionality (upload/update and use assets in the filesystem, for example) faster.
I'll have to think a bit more about this one. Inter-task communication bring more complexity (move data efficiently between tasks, task synchronization, data race, timing and timeouts,...) so we must think about it carefully! I think we should try to encapsulate the process needed to read/write a file into a nice class (that would also cache the context, file path,... if needed) so that we can move this object to any task we want later on. |
It would be nice, but not really :D - it's probably our code on both sides for at least some time. It would also be possible to ask Adafruit to make it an optional feature. |
Oh, and we can always take a look at their implementation, if we have any doubts: adafruit/circuitpython#4918 |
So both sets of commands are already implemented. It's more of to implement read/write pacing I need to cache something...making the fs system not stateless. In this implementation I cache the path so I can keep the file closed outside of the routines. That takes a speed hit in exchange for safety. I can survive with having to have that allocated on the heap. It's just under 256 bytes. The next question is more of an implementation specific thing. The spec states that you can receive more the one command at a time, and that the data more or less is to be buffered outside of the BLE sub system. Currently I expect an entire header or header and data to come in a single BLE packet. We have an MTU of 256. So we can receive 253bytes at once after the ATT header. This deviates from the listed spec. We can do this since we have a large MTU size. The alternative involves passing All the data to a queue to the system task and then processing it there. It's doable, and freertos has the mechanisms designed for just this. It's just going to be more expensive then the current implementation so I am looking for guidance on what we want. |
51993a1
to
cbb34ce
Compare
@geekbozu is there a blocker to this PR? Could external FS access land in next InfiniTime? |
It heavily depends on my IRL schedule. There is quite a bit Todo I hope to have a task lost up today, and to continue chipping away at it! |
Added a task list for this, It is slowly nearing completion! |
Move works! At this point its feature complete. It needs some better status code returns as well as some documentation. |
Added LISTDIR command and notify responses.
This needs to get cherrypicked to another PR as SPI Sleep needs to use a semaphore or something
TODO:
FS Command implementation
Companion/Test App
Documentation
The start of a PR to enabled access to the internal FS over a BLE characteristic.
Discussion on merits of implementation in #750
Currently the marked features are working in this PR,
There is a deviation from the spec which states
I expect one command per packet with no provisions for more, I could extend this to support more commands per packet...I just do not think the complexity is needed.
I ignore and set all date time information to 0. DO not use date time for anything.