Skip to content

Conversation

codecae
Copy link
Member

@codecae codecae commented Apr 4, 2019

Hoping this will help with API mismatches and prevent infinite loops of run_ui.

@codecae
Copy link
Member Author

codecae commented Apr 4, 2019

For some reason my amend didn't work.. trying again.

Page = assert(loadScript(radio.templateHome .. PageFiles[currentPage]))()
if Page.requiredVersion and apiVersion > 0 then
if Page.requiredVersion > apiVersion then
PageFiles[currentPage] = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause problems if users are using multiple craft with different firmware versions with the same TX side model, and do not power cycle their TX in between.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone would be required to power cycle or change models anyway if they want to obtain the API version, too. The init function only runs once at the time of initial invocation, so there's a possibility that the API version retained in memory might not match the new FC. If they do match, though, the same set of pages would still be compatible.

Copy link
Member

@mikeller mikeller Apr 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The init function runs every time a connection is established. As a consequence, the API version will be queried again after models have been changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the init functions confused I think... apologies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe re-seed the pages here?

if dataInitialised then
data_init = nil
collectgarbage()
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a lot of complexity for not much gain, compared to what I have proposed in #203.

But adding the graceful exit makes sense.

@mikeller
Copy link
Member

@codecae: I think this has been addressed in #203.

@codecae codecae closed this Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants