Skip to content

Conversation

NickeZ
Copy link
Collaborator

@NickeZ NickeZ commented Oct 12, 2025

create an async friendly hardware supported delayin C and wrap it in rust using Future.

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch 17 times, most recently from 97edacf to 39c79ca Compare October 14, 2025 13:09
create an async friendly hardware supported delayin C and wrap it in
rust using Future.
@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 39c79ca to 781d4b1 Compare October 14, 2025 13:29
@NickeZ NickeZ marked this pull request as ready for review October 14, 2025 13:42
@NickeZ NickeZ requested a review from benma October 14, 2025 13:42
Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

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

(not done reviewing yet, just some quick comments)

orientation_arrows.screen_stack_push();

// Wait until orientation has been chosen
option_no_screensaver(&result).await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you want option not option_no_screensaver. The screensaver should become active in the orientation screen. It may be the most likely to actually burn in the screen, e.g. when connected and left plugged in.

// Switch to lockscreen that shows "See the bitbox app" and device name
bitbox02::ui::screen_process_waiting_switch_to_lockscreen();

orientation_selected_cb();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did a double take seeing a callback called at the end of an async function. Would it be possible to simply return whatever value you need and use it when polling is done (in if let Poll::Ready(result) = result { ... )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so because this future isn't run in a traditional async runtime, it is run with our "glue layer". I could return the callback and then call it in the rust_workflow_spin() function instead. But not sure if that is great.

I was hoping it would be helpful if the orientation workflow was in rust for the simulator. But in the end it didn't play out so well, I still have to call the glue-layer because I don't have a proper async runtime in the simulator either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(the rust version of the orientation selection is still more readable IMO than the c version with interrupts, so I still think it is a net win.)

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 7d78b67 to fece219 Compare October 15, 2025 07:18
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