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

Fix MotorController::Init call order #2070

Merged
merged 1 commit into from
Jun 2, 2024
Merged

Conversation

pipe01
Copy link
Contributor

@pipe01 pipe01 commented Jun 2, 2024

The call to LoadNewScreen here (and the one below it) calls MotorController::StopRinging() here, which in turn calls xTimerStop to stop the ringing timer. However, this timer only gets created when DisplayApp::InitHw is called, which currently happens in DisplayApp::Process after the initial call to LoadNewScreen. This means that xTimerStop is called on uninitialized data, which has undefined behaviour.

This PR makes it so that the call to MotorController::Init happens before LoadNewScreen.

@pipe01 pipe01 changed the title Fix DisplayApp::InitHw call order Fix MotorController::Init call order Jun 2, 2024
Copy link

github-actions bot commented Jun 2, 2024

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed

Copy link
Collaborator

@JF002 JF002 left a comment

Choose a reason for hiding this comment

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

Good catch, thank you!

I'm wondering if those calls to LoadNewScreen shouldn't go in InitHw() or in Process() to make things more tidy, but I think your fix is valid anyway :)

@JF002 JF002 added this to the 1.15.0 milestone Jun 2, 2024
@JF002 JF002 merged commit 0c87bc2 into InfiniTimeOrg:main Jun 2, 2024
7 checks passed
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