InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.64k stars 903 forks source link

Appending to File resets the Task/ Main Task #1851

Closed rinzler-vicky closed 9 months ago

rinzler-vicky commented 10 months ago

Verification

What happened?

Trying to Append to a file after a set interval causes the task to terminate

What should happen instead?

The Data must be appended to the File specified

Reproduction steps

  1. Create a Timer
  2. Set timer to append data to call a file
  3. Log the content of the file

More details?

We are currently trying to collect the raw PPG and accelerometer data, and sync it to the mobile for processing. To acheive the same, our initial goal is store the raw data on the flash until the Bluetooth sync happens every hour (or more).

Unfortunately, we are unable to append data to the same file, where we store data of every hour (not continuous, about 5 seconds of data every minute) and create a single file for that hour.

What is happening is, that the moment we try to open the same file or another file, the system crashes. If it is being done in a task, the task will crash, otherwise the OS itself crashes.

We have the source code in the repo https://github.com/FitnessKonnect/InfiniTime And the issue: https://github.com/FitnessKonnect/InfiniTime/issues/2

Version

v1.12.0

Companion app

No response

rinzler-vicky commented 9 months ago

Apologies, this was a mistake on my side, and I will close this issue.

The Screen was getting turned off, which sent the message Messages::OnDisplayTaskSleeping to the system task, causing the spiNorFlash.Sleep() to be called.

I missed this on my part as there was no screen connected to my hardware.

JF002 commented 9 months ago

Thanks for updating us on this issue! You are right : everything is put to sleep when the display goes off, which also enables the low-power mode of the SPI flash and disables the SPI bus. It means that you cannot try to talk to the memory when the display is off.

If you need to write to the file when it's sleeping, you have to go out of the sleep mode (or at least wakeup the SPI and flash memory), write to the file, and then enter sleep mode again.