From 83bf2a9a3646fef72839391c501d746e16c40def Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 10 Dec 2015 14:40:34 -0800 Subject: [PATCH] Tweak BasebandConfiguration constructors to avoid surprise type conversions. --- firmware/application/receiver_model.cpp | 6 +----- firmware/common/message.hpp | 9 +++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/firmware/application/receiver_model.cpp b/firmware/application/receiver_model.cpp index 709fbd9b2..f068f24d5 100644 --- a/firmware/application/receiver_model.cpp +++ b/firmware/application/receiver_model.cpp @@ -126,11 +126,7 @@ void ReceiverModel::enable() { void ReceiverModel::disable() { /* TODO: This is a dumb hack to stop baseband from working so hard. */ BasebandConfigurationMessage message { - .configuration = { - .mode = -1, - .sampling_rate = 0, - .decimation_factor = 1, - } + .configuration = { }, }; shared_memory.baseband_queue.push(message); diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index 82bf0f265..a1c2e78ca 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -167,14 +167,19 @@ struct BasebandConfiguration { size_t decimation_factor; constexpr BasebandConfiguration( - int32_t mode = -1, - uint32_t sampling_rate = 0, + int32_t mode, + uint32_t sampling_rate, size_t decimation_factor = 1 ) : mode { mode }, sampling_rate { sampling_rate }, decimation_factor { decimation_factor } { } + + constexpr BasebandConfiguration( + ) : BasebandConfiguration { -1, 0, 1 } + { + } }; class BasebandConfigurationMessage : public Message {