add button_handler outline #29

Merged
Athamantis merged 10 commits from button_handler into main 2026-03-04 18:07:07 +00:00
Owner

Closes #6

Closes #6
add button_handler outline
Some checks failed
/ build_and_test (push) Failing after 14s
/ Static Release Build (push) Has been skipped
78a684a918
Athamantis changed title from add button_handler outline to WIP: add button_handler outline 2026-03-03 11:55:07 +00:00
add update of the calls
All checks were successful
/ build_and_test (push) Successful in 21s
/ Static Release Build (push) Has been skipped
971b650938
add three testes to button_handler
All checks were successful
/ build_and_test (push) Successful in 21s
/ Static Release Build (push) Has been skipped
cadb7dc7ba
add invalid input test
All checks were successful
/ build_and_test (push) Successful in 20s
/ Static Release Build (push) Has been skipped
277245ad10
add rust doc
Some checks failed
/ build_and_test (push) Failing after 17s
/ Static Release Build (push) Has been skipped
fb3003484d
add cbc
All checks were successful
/ build_and_test (push) Successful in 20s
/ Static Release Build (push) Has been skipped
a77af526ed
Athamantis changed title from WIP: add button_handler outline to add button_handler outline 2026-03-03 14:58:55 +00:00
sebgab requested changes 2026-03-04 17:33:01 +00:00
Dismissed
@ -0,0 +8,4 @@
use std::sync::RwLock;
#[derive(PartialEq)]
enum CallTypes {
Owner

Why does this type exist, doccoment please?

Why does this type exist, doccoment please?
Author
Owner

bc it is just consts in the elevator driver, added a doc comment

bc it is just consts in the elevator driver, added a doc comment
Athamantis marked this conversation as resolved
@ -0,0 +15,4 @@
}
/// Converts a value from u8 to an option with [CallTypes]
fn convert_to_call_types(value: u8) -> Option<CallTypes> {
Owner

Why is this not a TryInto?

Why is this not a `TryInto`?
Author
Owner

added

added
Athamantis marked this conversation as resolved
@ -0,0 +25,4 @@
}
/// Converts a value from u8 to an option [Destination]
fn convert_to_destination(value: u8) -> Option<Destination> {
Owner

Why is this not TryInto?

Why is this not `TryInto`?
Author
Owner

that is a good question, it is bc it is implemented in the elevator driver soooo

that is a good question, it is bc it is implemented in the elevator driver soooo
Author
Owner

fixed

fixed
Athamantis marked this conversation as resolved
@ -0,0 +27,4 @@
/// Converts a value from u8 to an option [Destination]
fn convert_to_destination(value: u8) -> Option<Destination> {
match value {
// todo!("Needs todoing"),
Owner

delete comment

delete comment
Author
Owner

done

done
Athamantis marked this conversation as resolved
@ -0,0 +117,4 @@
call_button_rx: Receiver<CallButton>,
) {
loop {
let _ = button_handler(state.clone(), &call_button_rx).await;
Owner

button_handler does not return a value, as such let _ = is not necessary.

`button_handler` does not return a value, as such `let _ = ` is not necessary.
Author
Owner

removed

removed
Athamantis marked this conversation as resolved
@ -0,0 +86,4 @@
let destination = convert_to_destination(message.floor);
let call_type = convert_to_call_types(message.call);
if call_type == None || destination == None {
Owner

non-blocker, but .is_none() is preferred over == None

non-blocker, but `.is_none()` is preferred over `== None`
Author
Owner

fixed

fixed
Athamantis marked this conversation as resolved
@ -0,0 +90,4 @@
return;
}
match call_type.unwrap() {
Owner

Is this unwrap safe?

Is this unwrap safe?
Author
Owner

fixed, but it was

fixed, but it was
Athamantis marked this conversation as resolved
@ -0,0 +94,4 @@
CallTypes::HallDown => {
add_hall_call_to_systemstate(
system_state.clone(),
destination.unwrap(),
Owner

Is this unwrap safe?

Is this unwrap safe?
Author
Owner

i fixed it
but it was

i fixed it but it was
Athamantis marked this conversation as resolved
add impl and fix some comments
All checks were successful
/ build_and_test (push) Successful in 21s
/ Static Release Build (push) Has been skipped
cbfc257477
Merge branch 'main' into button_handler
All checks were successful
/ build_and_test (push) Successful in 22s
/ Static Release Build (push) Has been skipped
e5fe505589
change to use impl instead, for the destination
All checks were successful
/ build_and_test (push) Successful in 22s
/ Static Release Build (push) Has been skipped
a833f4c3de
fix one clippy comment
All checks were successful
/ build_and_test (push) Successful in 22s
/ Static Release Build (push) Has been skipped
187fd722d4
sebgab approved these changes 2026-03-04 18:06:41 +00:00
sebgab left a comment
Owner

Assuming all is good because you definitely fixed all my comments and I am too tired to do a proper review of this code and it would be nice to get it merged today so we can test rather than waiting for Friday.

:02love:

Assuming all is good because you definitely fixed all my comments and I am too tired to do a proper review of this code and it would be nice to get it merged today so we can test rather than waiting for Friday. :02love:
Athamantis deleted branch button_handler 2026-03-04 18:07:08 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
TTK4145/elevator!29
No description provided.