Skip to content

Move execution of main from boot.py to apps/home/main.py #80

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Giannie
Copy link
Contributor

@Giannie Giannie commented Aug 9, 2016

As suggested in #71, execution moved so that it does not get overwritten in a full reset

@mattbrejza
Copy link
Collaborator

Did you intend the app itself to call this if it wants the RAM, or for the app loader to do this for all apps? The main advantage of the former is that the wifi is not disconnected, and its a bit quicker.

If we do decide to do the former, the following will need to be added to invoke a reset and run:

if stm.mem8[0x40002850] == 0:   # this battery backed RAM section is set to 0 when the name screen runs
    with open('main.json', 'w') as f:
        f.write('{"main":"apps/app_library/main.py"}')
    stm.mem8[0x40002850] = 2    #set this address to != 0 so this if statement doesnt run next time
    pyb.hard_reset()

@Giannie
Copy link
Contributor Author

Giannie commented Aug 9, 2016

Currently I've been splitting off the apps into a main.py which writes the config and a run.py that is the actual worker script. So main.py would be moved to run.py and the new main.py would write:

{"main":"apps/app_library/run.py"}

Your solution is more elegant though.

@mattbrejza
Copy link
Collaborator

mattbrejza commented Aug 9, 2016

Ive taken your code into this branch and integrated it, it just needs testing now.

https://github.com/emfcamp/Mk3-Firmware/compare/optional-reset-onrun?expand=1

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

Successfully merging this pull request may close these issues.

2 participants