bristlemouth / bm_protocol

Primary Bristlemouth firmware repository
https://www.bristlemouth.org/
Apache License 2.0
10 stars 7 forks source link

Enable writing files with bm_fprintf without inserted timestamp log line headers #154

Closed towynlin closed 2 weeks ago

towynlin commented 1 month ago

Here's the implementation of bm_fprintf: https://github.com/bristlemouth/bm_protocol/blob/e2df56656a9cdab78a347e448f24e698f6f41b36/src/lib/bcmp/bm/bm_printf.cpp#L22

It currently build a bm_print_publication_t, defined here: https://github.com/bristlemouth/bm_common_messages/blob/2a44e0ca19ce4eae3174c7ec77a16e95d4c49966/bm_common_pub_sub.h#L25-L31

Possibly take a lesson from the implementation of bridgeLogPrint here: https://github.com/bristlemouth/bm_protocol/blob/e2df56656a9cdab78a347e448f24e698f6f41b36/src/apps/bridge/bridgeLog.cpp#L10

which has a print_header boolean parameter and publishes a bm_common_log_t: https://github.com/bristlemouth/bm_common_messages/blob/2a44e0ca19ce4eae3174c7ec77a16e95d4c49966/bm_common_structs.h#L164-L175

If we continue using bm_print_publication_t and add a field, then we need to increment the version of the message. Subscribers will have to inspect the message version and support one or both versions.

Spotter will be one of these subscribers, and the new version of the print will only start being supported in some future Spotter firmware version.

This feature request came from this thread on the forum: https://bristlemouth.discourse.group/t/issues-writing-to-spotter-sd-card/371/5

This is a good first issue for folks interested in contributing to Bristlemouth firmware! Please don't hesitate to reach out on the forum or just create a PR here on github! We're very happy to work with you to get things into shape for merging.