Skip to content

Commit

Permalink
build fix; more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Feb 7, 2025
1 parent feac369 commit 4694d0d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libcyphal_demo/src/file_downloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FileDownloader final

state_.file_size = 0;
state_.file_progress = 0;
state_.file_path = file_path;
state_.file_path = {file_path.data(), file_path.size()};
state_.start_time = time_provider_.now();
state_.file_error.value = uavcan::file::Error_1_0::OK;

Expand Down
4 changes: 4 additions & 0 deletions libcyphal_demo/src/platform/common_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct CommonHelpers
}),
report_var);

// "swallows" all transient failures, thus giving a chance
// to other redundant media interfaces to continue.
return cetl::nullopt;
}

Expand Down Expand Up @@ -154,6 +156,8 @@ struct CommonHelpers
}),
report_var);

// "swallows" all transient failures, thus giving a chance
// to other redundant media interfaces to continue.
return cetl::nullopt;
}

Expand Down
7 changes: 7 additions & 0 deletions libcyphal_demo/src/transport_bag_can.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ struct TransportBagCan final
const std::size_t block_size = mtu;
const std::size_t pool_size = media_collection_.count() * TxQueueCapacity * block_size;
media_block_mr_.setup(pool_size, block_size, block_alignment);

// To support redundancy (multiple homogeneous interfaces), it's important to have a non-default
// handler which "swallows" expected transient failures (by returning `nullopt` result).
// Otherwise, the default Cyphal behavior will fail/interrupt current and future transfers
// if some of its media encounter transient failures - thus breaking the whole redundancy goal,
// namely, maintain communication if at least one of the interfaces is still up and running.
//
transport_->setTransientErrorHandler([](auto&) { return cetl::nullopt; });
// transport_->setTransientErrorHandler(platform::CommonHelpers::Can::transientErrorReporter);

Expand Down

0 comments on commit 4694d0d

Please sign in to comment.