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 tasks
  • Loading branch information
ryanthecoder committed Apr 4, 2024
1 parent 7501753 commit c4239ea
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 7 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
2 changes: 1 addition & 1 deletion common/core/revision.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
static const struct revision _revision = {
.primary = '${PRIMARY_REVISION}',
.secondary = '${SECONDARY_REVISION}',
.tertiary = {0x00,${TERTIARY_FLAG}}
.tertiary = {0x00,'${TERTIARY_FLAG}'}
};

const struct revision* revision_get() {
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,
revision_get()->tertiary};
static auto system_dispatch_target =
can_task::SystemDispatchTarget{system_message_handler};

Expand Down
4 changes: 3 additions & 1 deletion gripper/core/can_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ 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,
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,
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,
revision_get()->tertiary};
static auto system_dispatch_target =
can_task::SystemDispatchTarget{system_message_handler};

Expand Down
4 changes: 3 additions & 1 deletion include/can/core/message_handlers/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SystemMessageHandler {
*/
SystemMessageHandler(CanClient &writer, uint32_t version, uint32_t flags,
std::span<const char> version_sha,
char primary_revision, char secondary_revision,
char primary_revision, char secondary_revision, const char tertiary_revision[2],
uint8_t device_subid = 0)
: writer(writer),
response{.version = version,
Expand All @@ -39,6 +39,8 @@ class SystemMessageHandler {
std::copy_n(version_sha.begin(),
std::min(version_sha.size(), response.shortsha.size()),
response.shortsha.begin());
std::copy_n(&tertiary_revision[0], std::min(2 * sizeof(char), 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,
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,
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 c4239ea

Please sign in to comment.