Skip to content

Commit

Permalink
fix(can): hook up the tertiary flag through the system message handle…
Browse files Browse the repository at this point in the history
…r task (#765)

* fix(can): hook up the tertiary flag through the system message handler tasks

* fix the cmake generator variable for tertiary flag

* format
  • Loading branch information
ryanthecoder authored Apr 4, 2024
1 parent 9d9bbef commit 95eed5e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function(add_revision)
string(SUBSTRING ${_ar_REVISION} 0 1 PRIMARY_REVISION)
string(SUBSTRING ${_ar_REVISION} 1 1 SECONDARY_REVISION)
if (${USE_PRESSURE_MOVE})
set(TERTIARY_FLAG "0x01")
set(TERTIARY_FLAG "'1'")
else()
set(TERTIARY_FLAG "0x00")
endif()
Expand Down
3 changes: 2 additions & 1 deletion gantry/core/can_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ static auto system_message_handler =
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary,
revision_get()->secondary};
revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary)};
static auto system_dispatch_target =
can_task::SystemDispatchTarget{system_message_handler};

Expand Down
3 changes: 2 additions & 1 deletion gripper/core/can_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static auto system_message_handler =
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary,
revision_get()->secondary};
revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary)};
static auto system_dispatch_target =
can_task::SystemDispatchTarget{system_message_handler};

Expand Down
3 changes: 2 additions & 1 deletion head/core/can_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ static auto system_message_handler =
common_queues, version_get()->version, version_get()->flags,
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary, revision_get()->secondary);
revision_get()->primary, revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary));
static auto system_dispatch_target =
SystemDispatchTarget{system_message_handler};

Expand Down
3 changes: 2 additions & 1 deletion hepa-uv/core/can_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ static auto system_message_handler =
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary,
revision_get()->secondary};
revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary)};
static auto system_dispatch_target =
can_task::SystemDispatchTarget{system_message_handler};

Expand Down
5 changes: 5 additions & 0 deletions include/can/core/message_handlers/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SystemMessageHandler {
SystemMessageHandler(CanClient &writer, uint32_t version, uint32_t flags,
std::span<const char> version_sha,
char primary_revision, char secondary_revision,
std::array<char, 2> tertiary_revision,
uint8_t device_subid = 0)
: writer(writer),
response{.version = version,
Expand All @@ -39,6 +40,10 @@ class SystemMessageHandler {
std::copy_n(version_sha.begin(),
std::min(version_sha.size(), response.shortsha.size()),
response.shortsha.begin());
std::copy_n(tertiary_revision.begin(),
std::min(tertiary_revision.size(),
response.tertiary_revision.size()),
response.tertiary_revision.begin());
}
SystemMessageHandler(const SystemMessageHandler &) = delete;
SystemMessageHandler(const SystemMessageHandler &&) = delete;
Expand Down
1 change: 1 addition & 0 deletions pipettes/core/can_task_high_throughput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static auto system_message_handler =
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary, revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary),
// this is the high-throughput path so we can only be a 96
static_cast<uint8_t>(can::ids::PipetteType::pipette_96)};

Expand Down
1 change: 1 addition & 0 deletions pipettes/core/can_task_low_throughput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static auto system_message_handler =
std::span(std::cbegin(version_get()->sha),
std::cend(version_get()->sha)),
revision_get()->primary, revision_get()->secondary,
reinterpret_cast<const std::array<char, 2>&>(revision_get()->tertiary),
// in low throughput, we can be either single or multi (8-chan)
static_cast<uint8_t>(get_pipette_type() == PipetteType::SINGLE_CHANNEL
? can::ids::PipetteType::pipette_single
Expand Down

0 comments on commit 95eed5e

Please sign in to comment.