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

On-board logging #18

Open
blairfrandeen opened this issue Nov 6, 2023 · 0 comments
Open

On-board logging #18

blairfrandeen opened this issue Nov 6, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@blairfrandeen
Copy link
Owner

I would like to replace all of the print statements with log statements, and I would like the momobox to keep track of some basic on-board logging. Some thoughts on the logger:

  • I need a switch to make the Pico read-only. As described here, the Pico can self-write to its own filesystem, or it can allow the PC its connected to to write, which is used for easily updating the code. The linked article suggests making a switch, and adding it to the boot.py file. I propose to add the following to boot.py:
import board
import digitalio
import storage

switch = digitalio.DigitalInOut(board.GP22)
storage.remount(mount_path="/", readonly=not switch.value)

Currently GP22 is the pin that detects whether an SD card is inserted. What the code above would mean is that the file-system would be read-only (able to update the code) if the SD card was not present. Since the SD card is required to use the momobox, part of updating the onboard code would be to boot the momobox with the SD card removed.

  • I would want to minimize and limit the size of the logs, since the on-board memory is limited to 1 MB, and some of that space is already spoken for. I know that the python logging module allows for this to some extent, so I'll have to implement it.
  • On the subject of the above, it would be useful to minimize the size of the log file by minimizing log messages; it's okay to be terse
@blairfrandeen blairfrandeen added the enhancement New feature or request label Nov 6, 2023
@blairfrandeen blairfrandeen self-assigned this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant