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 18 times, most recently 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)

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 7d78b67 to fece219 Compare October 15, 2025 07:18
@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch 3 times, most recently from 673483d to d92d6f6 Compare October 24, 2025 08:48
@NickeZ NickeZ requested a review from benma October 24, 2025 09:29
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.

The orientation screen is not actually working, it's always the same orientation no matter which side you tap.

@NickeZ
Copy link
Collaborator Author

NickeZ commented Oct 30, 2025

The orientation screen is not actually working, it's always the same orientation no matter which side you tap.

Right, I noticed now that we deliver multiple short taps so the screen is rotated back to normal. In the C-code we popped the screen in the event handler so the screen never sees more than one tap.

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 1e470d7 to 800cf1c Compare October 30, 2025 10:36
@NickeZ
Copy link
Collaborator Author

NickeZ commented Oct 30, 2025

The orientation screen is not actually working, it's always the same orientation no matter which side you tap.

Last commit ensures that callback only is called once for the component.

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 3845db8 to 822a8a7 Compare October 30, 2025 12:36
@NickeZ NickeZ requested a review from benma October 30, 2025 12:40
@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch 5 times, most recently from 45ed416 to f2dd8dd Compare November 4, 2025 13:57
@NickeZ NickeZ requested a review from benma November 4, 2025 14:58
option(&result).await
}

pub async fn create() -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't know why that name, it does not mean anything to me. how about process or choose_and_handle?

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 C function is called orientation_screen_create(). I guess I could call it orientation_screen which is inline with confirm. But I do think it looks ugly to have confirm::confirm or orientation_screen::orientation_screen.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah the create functions there refer to creating component instances, but that does not transfer so well to higher level async Rust workflows.

f you don't like repeating words, the above function could be renamed to choose and this file to orientation, then it becomes worklows::orientation::choose(...).

Could also merge the two funcs again, I asked to split them when you still called the C callback, but now the distinction is a bit fuzzier.

tACK regardless

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 024c886 to 39ad25a Compare November 5, 2025 08:19
@NickeZ NickeZ requested a review from benma November 5, 2025 08:52
@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 53ab1c9 to 6f2e946 Compare November 5, 2025 09:24
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.

tACK (but please squash before merge)

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch 4 times, most recently from c190075 to 752dfdc Compare November 11, 2025 14:47
@NickeZ NickeZ requested a review from benma November 12, 2025 10:31
@NickeZ
Copy link
Collaborator Author

NickeZ commented Nov 12, 2025

@benma I decided to simplify the delay, removed some state and abort if more than 10 concurrently are allocated. PTAL

@NickeZ NickeZ force-pushed the maint/migrate-orientation-screen-to-rust branch from 3fd8452 to c71bdd0 Compare November 12, 2025 13:40
src/delay.c Outdated
}
CRITICAL_SECTION_LEAVE()
if (full) {
Abort("To many concurrent delays");
Copy link
Collaborator

Choose a reason for hiding this comment

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

To->Too

src/delay.c Outdated
if (_tasks[self->id].timer.cb && !_tasks[self->id].done) {
timer_remove_task(&TIMER_0, &_tasks[self->id].timer);
}
CRITICAL_SECTION_LEAVE();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be one line down, the last thing in the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, if the api should be re-entrant it should be that. I can fix it.

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.

utACK

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 99d6d66 to eb9513b Compare November 12, 2025 14:15
@NickeZ NickeZ merged commit 140e23c into BitBoxSwiss:master Nov 12, 2025
12 of 32 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