Skip to content

Commit

Permalink
Merge branch 'main' into RET-1025_handle_motor_driver_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoegenburg authored Oct 26, 2023
2 parents f3f224b + cd2ae02 commit bd16ea6
Show file tree
Hide file tree
Showing 64 changed files with 1,400 additions and 756 deletions.
43 changes: 5 additions & 38 deletions .github/workflows/release_bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,55 +103,22 @@ jobs:
replacesArtifacts: true
allowUpdates: true

- name: 'Add firmware images artifact'
- name: 'Add firmware category zips'
uses: 'ncipollo/[email protected]'
with:
artifacts: ./firmware-images-${{github.ref_name}}.zip
artifacts: ./firmware-*-${{github.ref_name}}.zip
artifactContentType: application/zip
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

- name: 'Add firmware robot images artifact'
- name: 'Add latest firmware images'
uses: 'ncipollo/[email protected]'
with:
artifacts: ./firmware-robot-images-${{github.ref_name}}.zip
artifactContentType: application/zip
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

- name: 'Add firmware pipette images artifact'
uses: 'ncipollo/[email protected]'
with:
artifacts: ./firmware-pipette-images-${{github.ref_name}}.zip
artifactContentType: application/zip
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

- name: 'Add firmware gripper images artifact'
uses: 'ncipollo/[email protected]'
with:
artifacts: ./firmware-gripper-images-${{github.ref_name}}.zip
artifactContentType: application/zip
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

- name: 'Add firmware applications artifact'
uses: 'ncipollo/[email protected]'
with:
artifacts: ./firmware-applications-${{github.ref_name}}.zip
artifactContentType: application/zip
artifacts: './firmware-*-images-${{github.ref_name}}/*.hex'
artifactContentType: text/plain
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ if (${CMAKE_CROSSCOMPILING})

add_compile_definitions(ENABLE_CCMRAM)

add_compile_definitions(ENABLE_CROSS_ONLY_HEADERS)

configure_file(common/firmware/platform_specific_hal_conf.h.in ${CMAKE_BINARY_DIR}/generated/platform_specific_hal_conf.h)
configure_file(common/firmware/platform_specific_hal.h.in ${CMAKE_BINARY_DIR}/generated/platform_specific_hal.h)

Expand Down
24 changes: 12 additions & 12 deletions bootloader/firmware/stm32G4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ endmacro()
foreach_revision(
PROJECT_NAME bootloader-gantry-x
CALL_FOREACH_REV gantry_x_bootloader_loop
REVISIONS a1 b1 c1
SOURCES _g4_sources _g4_sources _g4_sources
REVISIONS a1 b1 c1 c2
SOURCES _g4_sources _g4_sources _g4_sources _g4_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)

foreach_revision(
PROJECT_NAME bootloader-gantry-y
CALL_FOREACH_REV gantry_y_bootloader_loop
REVISIONS a1 b1 c1
SOURCES _g4_sources _g4_sources _g4_sources
REVISIONS a1 b1 c1 c2
SOURCES _g4_sources _g4_sources _g4_sources _g4_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)
Expand All @@ -93,8 +93,8 @@ endmacro()
foreach_revision(
PROJECT_NAME bootloader-gripper
CALL_FOREACH_REV gripper_bootloader_loop
REVISIONS a1 b1 c1
SOURCES gripper_sources gripper_sources gripper_sources
REVISIONS a1 b1 c1 c2
SOURCES gripper_sources gripper_sources gripper_sources gripper_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)
Expand Down Expand Up @@ -132,26 +132,26 @@ set(_pipette_sources ${_g4_sources} ./pipette_handle_messages.c)
foreach_revision(
PROJECT_NAME bootloader-pipettes-single
CALL_FOREACH_REV pipettes_single_bootloader_loop
REVISIONS b1 c2
SOURCES _pipette_sources _pipette_sources
REVISIONS b1 c2 d1
SOURCES _pipette_sources _pipette_sources _pipette_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)

foreach_revision(
PROJECT_NAME bootloader-pipettes-multi
CALL_FOREACH_REV pipettes_multi_bootloader_loop
SOURCES _pipette_sources _pipette_sources
REVISIONS b1 c2
SOURCES _pipette_sources _pipette_sources _pipette_sources
REVISIONS b1 c2 d1
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)

foreach_revision(
PROJECT_NAME bootloader-pipettes-96
CALL_FOREACH_REV pipettes_ninety_six_bootloader_loop
REVISIONS b1 c1
SOURCES _pipette_sources _pipette_sources
REVISIONS b1 c1 d2
SOURCES _pipette_sources _pipette_sources _pipette_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)
Expand Down
68 changes: 68 additions & 0 deletions common/tests/test_debounce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,71 @@ SCENARIO("debouncing gpio pins works") {
}
}
}

SCENARIO("debouncing with holdoff cnt works") {
GIVEN("a state value and bounce value") {
debouncer::Debouncer subject{.holdoff_cnt = 2};
WHEN("switching from unset to set") {
subject.debounce_update(true);
CHECK(subject.cnt == 0);
subject.debounce_update(true);
CHECK(subject.cnt == 1);
THEN("state stays the same on the first two ticks") {
REQUIRE(subject.debounce_state() == false);
}
subject.debounce_update(true);
THEN("state updates on the third tick") {
REQUIRE(subject.debounce_state() == true);
THEN("cnt gets reset") { CHECK(subject.cnt == 0); }
}
WHEN("reset is called") {
subject.reset();
THEN("values are reset") {
REQUIRE(subject.cnt == 0);
REQUIRE(subject.state_bounce == false);
REQUIRE(subject.state == false);
// holdoff cnt remains the same
REQUIRE(subject.holdoff_cnt == 2);
}
}
}
WHEN("switching from set to unset") {
// make sure the state is true
subject.debounce_update(true);
subject.debounce_update(true);
subject.debounce_update(true);

subject.debounce_update(false);
subject.debounce_update(false);
THEN("state stays the same on the first two ticks") {
REQUIRE(subject.debounce_state() == true);
}
subject.debounce_update(false);
THEN("state updates on the third tick") {
REQUIRE(subject.debounce_state() == false);
}
}
WHEN("switching from set to unset before holdoff cnt is reached") {
// make sure the state is true
subject.debounce_update(true);
subject.debounce_update(true);
CHECK(subject.cnt == 1);
subject.debounce_update(false);
THEN("cnt gets reset back to 0") {
CHECK(subject.cnt == 0);
REQUIRE(subject.debounce_state() == false);
}
THEN("it requires another 3 updates to actually update the state") {
subject.debounce_update(true);
CHECK(subject.cnt == 0);
REQUIRE(subject.debounce_state() == false);
subject.debounce_update(true);
CHECK(subject.cnt == 1);
REQUIRE(subject.debounce_state() == false);
subject.debounce_update(true);
CHECK(subject.cnt == 0);
REQUIRE(subject.debounce_state() == true);
}
}
}
}
10 changes: 6 additions & 4 deletions gantry/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ set(GANTRY_X_B1_SRCS
${CMAKE_SOURCE_DIR}/gantry/firmware/axis_x_rev1_hardware_config.c
)
set(GANTRY_X_C1_SRCS ${GANTRY_X_B1_SRCS})
set(GANTRY_X_C2_SRCS ${GANTRY_X_C1_SRCS})

set(GANTRY_Y_A1_SRCS
${GANTRY_BASE_SOURCES}
Expand All @@ -65,6 +66,7 @@ set(GANTRY_Y_B1_SRCS
${CMAKE_SOURCE_DIR}/gantry/firmware/axis_y_rev1_hardware_config.c
)
set(GANTRY_Y_C1_SRCS ${GANTRY_Y_B1_SRCS})
set(GANTRY_Y_C2_SRCS ${GANTRY_Y_C1_SRCS})

macro(gantry_loop_internal)
set(_gli_options)
Expand Down Expand Up @@ -122,14 +124,14 @@ endmacro()
foreach_revision(
PROJECT_NAME gantry-x
CALL_FOREACH_REV gantry_loop_internal_x
REVISIONS a1 b1 c1
SOURCES GANTRY_X_A1_SRCS GANTRY_X_B1_SRCS GANTRY_X_C1_SRCS
REVISIONS a1 b1 c1 c2
SOURCES GANTRY_X_A1_SRCS GANTRY_X_B1_SRCS GANTRY_X_C1_SRCS GANTRY_X_C2_SRCS
)
foreach_revision(
PROJECT_NAME gantry-y
CALL_FOREACH_REV gantry_loop_internal_y
REVISIONS a1 b1 c1
SOURCES GANTRY_Y_A1_SRCS GANTRY_Y_B1_SRCS GANTRY_Y_C1_SRCS
REVISIONS a1 b1 c1 c2
SOURCES GANTRY_Y_A1_SRCS GANTRY_Y_B1_SRCS GANTRY_Y_C1_SRCS GANTRY_Y_C2_SRCS
)


Expand Down
4 changes: 3 additions & 1 deletion gripper/core/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ void gripper_tasks::QueueClient::send_pressure_sensor_queue_front(
void gripper_tasks::QueueClient::send_pressure_sensor_queue_rear(
const sensors::utils::TaskMessage&) {}

void gripper_tasks::QueueClient::send_tip_notification_queue(
void gripper_tasks::QueueClient::send_tip_notification_queue_rear(
const sensors::tip_presence::TaskMessage&) {}
void gripper_tasks::QueueClient::send_tip_notification_queue_front(
const sensors::tip_presence::TaskMessage&) {}

/**
Expand Down
5 changes: 3 additions & 2 deletions gripper/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ set(GRIPPER_SRCS_B1
${CMAKE_CURRENT_SOURCE_DIR}/main_rev1.cpp
)
set(GRIPPER_SRCS_C1 ${GRIPPER_SRCS_B1})
set(GRIPPER_SRCS_C2 ${GRIPPER_SRCS_C1})

macro(gripper_loop)
set(_driver_suffix ${PROJECT_NAME}_${REVISION})
Expand Down Expand Up @@ -88,8 +89,8 @@ endmacro()

foreach_revision(
PROJECT_NAME gripper
REVISIONS a1 b1 c1
SOURCES GRIPPER_SRCS_A1 GRIPPER_SRCS_B1 GRIPPER_SRCS_C1
REVISIONS a1 b1 c1 c2
SOURCES GRIPPER_SRCS_A1 GRIPPER_SRCS_B1 GRIPPER_SRCS_C1 GRIPPER_SRCS_C2
CALL_FOREACH_REV gripper_loop)

alias_for_revision(PROJECT_NAME gripper REVISION a1 REVISION_ALIAS proto)
Expand Down
2 changes: 2 additions & 0 deletions include/bootloader/core/ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ typedef enum {
can_messageid_brushed_motor_conf_request = 0x45,
can_messageid_brushed_motor_conf_response = 0x46,
can_messageid_set_gripper_error_tolerance = 0x47,
can_messageid_gripper_jaw_state_request = 0x48,
can_messageid_gripper_jaw_state_response = 0x49,
can_messageid_acknowledgement = 0x50,
can_messageid_read_presence_sensing_voltage_request = 0x600,
can_messageid_read_presence_sensing_voltage_response = 0x601,
Expand Down
2 changes: 2 additions & 0 deletions include/can/core/ids.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ enum class MessageId {
brushed_motor_conf_request = 0x45,
brushed_motor_conf_response = 0x46,
set_gripper_error_tolerance = 0x47,
gripper_jaw_state_request = 0x48,
gripper_jaw_state_response = 0x49,
acknowledgement = 0x50,
read_presence_sensing_voltage_request = 0x600,
read_presence_sensing_voltage_response = 0x601,
Expand Down
3 changes: 2 additions & 1 deletion include/can/core/message_handlers/motion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class BrushedMotionHandler {
using MessageType =
std::variant<std::monostate, DisableMotorRequest, EnableMotorRequest,
ReadLimitSwitchRequest, MotorPositionRequest,
SetGripperErrorToleranceRequest, GetMotorUsageRequest>;
SetGripperErrorToleranceRequest, GetMotorUsageRequest,
GripperJawStateRequest>;

BrushedMotionHandler(BrushedMotionTaskClient &motion_client)
: motion_client{motion_client} {}
Expand Down
Loading

0 comments on commit bd16ea6

Please sign in to comment.