From f5d67b5eee14b3f7a0f31cee875338f4cc88b46a Mon Sep 17 00:00:00 2001 From: Jaume Balust Date: Tue, 26 Aug 2025 16:23:24 -0600 Subject: [PATCH] cereal: fix frequency precision by changing from int to float (#36060) --- cereal/messaging/socketmaster.cc | 2 +- cereal/services.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cereal/messaging/socketmaster.cc b/cereal/messaging/socketmaster.cc index 1a7a48980e..7f7e2795c4 100644 --- a/cereal/messaging/socketmaster.cc +++ b/cereal/messaging/socketmaster.cc @@ -33,7 +33,7 @@ MessageContext message_context; struct SubMaster::SubMessage { std::string name; SubSocket *socket = nullptr; - int freq = 0; + float freq = 0.0f; bool updated = false, alive = false, valid = false, ignore_alive; uint64_t rcv_time = 0, rcv_frame = 0; void *allocated_msg_reader = nullptr; diff --git a/cereal/services.py b/cereal/services.py index a4c7463f20..edeca412ce 100755 --- a/cereal/services.py +++ b/cereal/services.py @@ -109,12 +109,12 @@ def build_header(): h += "#include \n" h += "#include \n" - h += "struct service { std::string name; bool should_log; int frequency; int decimation; };\n" + h += "struct service { std::string name; bool should_log; float frequency; int decimation; };\n" h += "static std::map services = {\n" for k, v in SERVICE_LIST.items(): should_log = "true" if v.should_log else "false" decimation = -1 if v.decimation is None else v.decimation - h += ' { "%s", {"%s", %s, %d, %d}},\n' % \ + h += ' { "%s", {"%s", %s, %f, %d}},\n' % \ (k, k, should_log, v.frequency, decimation) h += "};\n"