reworked the main loop #11

Merged Jookia merged 1 commit into LuminaSensum:main from LuminaSensum:cleanup on 26 Mar 2023
@xogium xogium commented on 26 Mar 2023

With the latest code cleanup, issues were introduced regarding the mounting and
unmounting of the filesystem.

  • Sometimes the board would wake up from sleep and perform mounting and
    unmounting of the filesystem in a more or less short loop before going
    back to sleep. I suspect this might be due to the sleep getting
    interrupted without any button press, aka every 10 minutes or so.
  • This code also created a bug where it would create then mount a new
    filesystem on the flash after erasing it, breaking the purpose for that
    function in the first place which is to erase the flash and nothing
    else.
  • It generally does not make sense to unmount a filesystem right after having
    mounted it.

Main is now calling mountFilesystem and unmountFilesystem where
appropriate:

  • Before running doUSBMSD, main unmounts the filesystem. When doUSBMSD
    is done, main once again mounts the filesystem.
  • Before erasing the flash with doERASE, main unmounts the filesystem,
    and never mounts it again.
  • As a tidying up step, the filesystem gets unmounted, same as the
    button thread terminating.
@Jookia Jookia referenced the pull request on 26 Mar 2023

reworked the main loop

@Jookia Jookia merged commit 1399c7c into main from cleanup on 26 Mar 2023
@Jookia Jookia closed this pull request on 26 Mar 2023
@Jookia Jookia deleted the cleanup branch on 26 Mar 2023
Labels

Priority
default
Milestone
No milestone
Assignee
No one assigned
2 participants
@xogium @Jookia