-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use smaller files on the SD card #1650 (Firmware ONLY) #3019
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
base: main
Are you sure you want to change the base?
Use smaller files on the SD card #1650 (Firmware ONLY) #3019
Conversation
- Introduced a new configuration option for enabling audio chunking in Kconfig. - Updated project configuration to include the new audio chunking feature. - Implemented a new SD card management system to handle audio chunking, including file naming and chunk rotation logic. - Added functions for generating unique audio filenames and managing chunk counters. - Updated main loop to check for chunk rotation timing. - Enhanced error handling and logging for file operations related to chunking. - Created a new header file for SD card configuration constants to centralize paths and settings.
Please list all features you have supported with this PR, including your tests, to make sure the firmware fulfills the ticket requirements. e.g., features: list audio files, transfer the audio bytes (of one file), delete audio file. |
…ounter management - Reduced maximum filename length for audio chunks and updated filename format to exclude timestamp. - Introduced separate counters for chunk start and current values to enhance uniqueness across reboots. - Updated functions for saving and retrieving chunk counters to handle the new structure.
- Introduced `get_chunk_counter_snapshot` function to retrieve current chunk counters without affecting persistent storage. - Added a new characteristic for chunk counters in the storage service to facilitate retrieval via GATT. - Enhanced debugging output during chunk file creation to include detailed chunking state information.
Hi @beastoin , I’ve implemented audio file chunking into 5-minute segments and added a few new GATT BLE characteristics:
For validation and testing, I used my custom built debug tool instead of the mobile app (since I haven’t made app-side changes yet). ![]() This shows the chunking flow — receiving 440-byte packets, assembling them into files (e.g., ~43 kB for a 10 second chunk), and supporting operations like streaming, downloading, and deletion. I’ll be tied up with other work for the next two days, but I’ll resume this shortly. Only unit testing is pending — I’ll update with the final PR in a couple of days. |
- Implemented `stream_chunk_file` and `delete_chunk_file` functions to manage audio chunk files on the SD card. - Enhanced chunk counter management during deletion to ensure proper tracking of chunk states. - Added new GATT characteristics for chunk sending and deletion requests, improving interaction with the storage service. - Improved error handling and logging for chunk operations to facilitate debugging and monitoring.
Hi @beastoin , I’ve done UT and validated the audio chunking and GATT characteristics firmware changes using my debug tool. A short video demonstration is shown below. 2025-10-01.19-00-57.mp4 |
- Updated `stream_chunk_file` and `delete_chunk_file` functions to include validation for chunk ID ranges, improving error handling. - Refined logging to replace printf statements with structured logging for better debugging and monitoring. - Added detailed documentation for chunk file operations in the header file to clarify usage and error codes. - Improved chunk management by ensuring proper state checks before streaming or deleting chunks.
Hi @beastoin , Could you please review this PR, Firmware changes are done and tested. Thanks. |
yeah, looks solid. btw, will let you know soon. |
Audio Chunking System for Firmware
Overview
This PR introduces a time-based audio chunking system that improves file management, power efficiency, and remote chunk handling via Bluetooth GATT. The system records audio in configurable time-based chunks rather than continuous large files.
Features Added in PR
1. Time-Based Audio Chunking
CHUNK_DURATION_CYCLES
)audio/chunk_NNNNN.bin
2. Configurable System
CONFIG_OMI_ENABLE_AUDIO_CHUNKING
src/sdcard_config.h
3. Chunk Lifecycle Management
4. Bluetooth GATT Integration
Configuration
Enable chunking in your project config:
Adjust chunk duration in
src/sdcard_config.h
:Testing