Fix live CAN feedback with CH0-only asynchronous risk transmission
Send 0x1F6 risk updates through a bounded latest-result worker on CH0 and disable CH1 initialization, reception, transmission and live display. Preserve the four actual-position bytes from 0x391 and recorded-session compatibility. Include regression coverage, Orin camera/TensorRT/CAN validation, and the verified standalone binary with refreshed checksums.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "can_types.hpp"
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
namespace cms {
|
||||
// One lifecycle per instance; only one owner per device index in a process.
|
||||
@@ -19,6 +20,15 @@ public:
|
||||
// Thread-safe on-demand data-frame send; invalid frames throw, SDK failure
|
||||
// returns false. Never generates periodic or inference-triggered messages.
|
||||
bool send(CanFrame const& frame);
|
||||
// Send one standard 8-byte 0x1F6 frame on CH0. Both nibbles of
|
||||
// data[0] contain 0 for "clear", 1 for every other level (including
|
||||
// unavailable): 0x00 or 0x11. Bytes 1-7 are zero. Returns {CH0 result, false};
|
||||
// the second slot is retained for API compatibility, CH1 is never sent.
|
||||
std::array<bool,2> sendRisk(std::string_view riskLevel);
|
||||
// Nonblocking live-inference path. Keeps at most one pending risk result;
|
||||
// a newer result replaces one waiting behind a slow SDK send. Returns
|
||||
// queue acceptance, not delivery. No timer or retransmission of old risk.
|
||||
bool queueRisk(std::string_view riskLevel);
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cms {
|
||||
inline constexpr unsigned liveCanChannelCount=1; // CH0 only; CH1 is not used.
|
||||
struct CanConfig {
|
||||
bool enabled{true};
|
||||
int device_index{0};
|
||||
@@ -22,6 +23,7 @@ struct CanDoorSignals {
|
||||
};
|
||||
struct CanSnapshot {
|
||||
std::string source{"live"},status{"DISABLED"};
|
||||
// Keep two slots for existing recorded sessions; live CH1 stays unset.
|
||||
std::array<CanDoorSignals,2> channels;
|
||||
std::uint64_t received{},transmitted{},transmit_errors{},receive_errors{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user