Skip to content

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

Open
Giannie wants to merge 2 commits into
emfcamp:masterfrom
Giannie:master
Open

Move execution of main from boot.py to apps/home/main.py#80
Giannie wants to merge 2 commits into
emfcamp:masterfrom
Giannie:master

Conversation

@Giannie
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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