Skip to content
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

[Friend V2] Onboard Memory Part 1 ($1500) #570

Closed
josancamon19 opened this issue Aug 10, 2024 · 4 comments
Closed

[Friend V2] Onboard Memory Part 1 ($1500) #570

josancamon19 opened this issue Aug 10, 2024 · 4 comments
Assignees
Labels

Comments

@josancamon19
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I want my Friend to be able to store my recordings even when the device is disconnected.

Describe the solution you'd like

  • Create a characteristic that stores the audio files to the sd card while the device is disconnected.
  • Create another characteristic that lists all the audio files available in the sd card + their size and estimated length.
  • Create another characteristic that starts streaming those audio files 1 by 1.

This ticket should be mainly on the firmware side, but ideally you create in capture/page.dart a button to view the list of of offline recording files available + an option to start receiving them and print them in the console.

@kevvz
Copy link
Collaborator

kevvz commented Aug 10, 2024

Is there already code that allows us to interact with the sd card or do we have to write it ourselves?

@vincentkoc
Copy link
Contributor

I will like to take this one today to start working on storage as discussed :)

@josancamon19 josancamon19 changed the title [Friend V2] Onboard Memory Part 1 ($1250) [Friend V2] Onboard Memory Part 1 ($1500) Aug 10, 2024
@vincentkoc
Copy link
Contributor

@josancamon19 can you review #590 , i will be splitting the PRs

josancamon19 added a commit that referenced this issue Aug 13, 2024
…#502  #570 (#590)

Splitting PR into a number of PRs, these changes required to get SD card
and other hardware changes live and verified. Helps fix #502 #570

Changelog:

* Fixed debug mode in project, debug works using native UART via USB
* Added native log collector and log levels info, debug, warning, error
* Added support for automated cmake config to support overlay files for
device specific config for SD card
* Added support for various device configurations in build config (FYI
Adafruit module pins needs to be updated)
* Better build documentation in `README.rst`  
* Improved boot sequence with booting all LEDs for testing and
verification of device
* Improved errors using LEDs to show what has failed, allowing for
better customer support
* VScode default extensions added and whitelisted in gitignore

_Screenshot with UART logging (one working and one with simulated
failures), and working build showing._
<img width="1799" alt="image"
src="https://github.com/user-attachments/assets/99435755-9e32-4af4-aa0e-5bdd71885b98">

_Screenshot showing how build settings is auto-detected_
<img width="1366" alt="Screenshot 2024-08-11 at 11 42 32 pm"
src="https://github.com/user-attachments/assets/49093e3b-2952-418a-82a5-d1e714cd41a9">

_Screenshot showing multiple deployment types depending on device_
<img width="720" alt="image"
src="https://github.com/user-attachments/assets/f1dbc938-4e1d-4bee-9e6c-e5f31b072eb7">
@kodjima33 kodjima33 added the firmware firmware work label Aug 21, 2024
josancamon19 added a commit that referenced this issue Sep 4, 2024
#570 

How to test:

1. Flash the uf2 file in the file storage_build. Hopefully you have the
sd card pins configured as in the hardware schematic. Please make sure
your sd card is already in the slot when it turns on, otherwise it will
not work.

2. To ensure this works, sever the connection from the friend app. After
the flashing sequence the device should turn red, but it should start
recording to the sd card.

3. Use the python file "discover_devices.py" to find your device id.
Then in the file "get_info_list.py", place your id on line 12, labeled
device_id. Then run the file. The expected result is a list of numbers.
Numbers from left to right are the oldest created files to the newest
created files. The amount of numbers is the amount of files. For
examples, one list of numbers could be

[1000 10000 20000]

where 1000 is the oldest file with 1000 bytes, 10000 is the second file
with 10000 bytes, and 20000 is the newest file with 20000 bytes.

5.On line 13 of the file "get_audio_file.py", place your device id. The
run the file. You should be presented with a large wall of numbers
indicating opus packets. This file downloads all available files on the
device. Each packet is 103 bytes long. The first three bytes are the
same as if mic data was sent. The fourth byte is how many numbers are in
the packet. Let's call it x. The next x bytes are the opus-encoded
numbers. The rest of the packet is filled with zeroes. All of this is
stored into the file "my_file.txt"

6. Finally, "decode_audio.py" attempts to decode the file. My opus files
are corrupted so I can't verify, but each packet at least appears to be
preserved. You are welcome to try.

For now, you can open the serial port to see a wall of text showing the
data is being streamed into the sd card.

If you want to create another file on the sd card, simply reset the
device and new data will pour into a separate file. You can always check
with "get_info_list.py."

The mic should work as normal if you connect it to the friend app. Any
blue tooth connection stops writes to the sd card. Any disconnection
should resume data transfer to the sd card. You can always check with
get_info_list.
@josancamon19
Copy link
Contributor Author

Done by @kevvz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

4 participants