From a5890dd9221d9a2f4eb527597eca6239aa058575 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Mon, 5 Aug 2019 13:40:22 -0400 Subject: [PATCH] ping360: move static const definitions to .cpp make transmitduration min/max constants static const --- src/sensor/ping360.cpp | 17 +++++++++++++++++ src/sensor/ping360.h | 25 ++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/sensor/ping360.cpp b/src/sensor/ping360.cpp index 3e6a7d3e5..c34f03594 100644 --- a/src/sensor/ping360.cpp +++ b/src/sensor/ping360.cpp @@ -24,6 +24,23 @@ Q_LOGGING_CATEGORY(PING_PROTOCOL_PING360, "ping.protocol.ping360") +// firmware constants +const uint16_t Ping360::_firmwareMaxNumberOfPoints = 1200; +const uint16_t Ping360::_firmwareMaxTransmitDuration = 500; +const uint16_t Ping360::_firmwareMinTransmitDuration = 5; +const uint16_t Ping360::_firmwareMinSamplePeriod = 80; +// The firmware defaults at boot +const uint8_t Ping360::_firmwareDefaultGainSetting = 0; +const uint16_t Ping360::_firmwareDefaultAngle = 0; +const uint16_t Ping360::_firmwareDefaultTransmitDuration = 32; +const uint16_t Ping360::_firmwareDefaultSamplePeriod = 80; +const uint16_t Ping360::_firmwareDefaultTransmitFrequency = 740; +const uint16_t Ping360::_firmwareDefaultNumberOfSamples = 1024; + +// The default transmit frequency to operate with +const uint16_t Ping360::_viewerDefaultTransmitFrequency = 750; +const uint16_t Ping360::_viewerDefaultNumberOfSamples = _firmwareMaxNumberOfPoints; + Ping360::Ping360() :PingSensor() { diff --git a/src/sensor/ping360.h b/src/sensor/ping360.h index 147aee840..72d52487a 100644 --- a/src/sensor/ping360.h +++ b/src/sensor/ping360.h @@ -446,23 +446,22 @@ class Ping360 : public PingSensor */ ///@{ - // TODO: static members should be defined in .cpp // firmware constants - static const uint16_t _firmwareMaxNumberOfPoints = 1200; - const uint16_t _firmwareMaxTransmitDuration = 500; - const uint16_t _firmwareMinTransmitDuration = 5; - static const uint16_t _firmwareMinSamplePeriod = 80; + static const uint16_t _firmwareMaxNumberOfPoints; + static const uint16_t _firmwareMaxTransmitDuration; + static const uint16_t _firmwareMinTransmitDuration; + static const uint16_t _firmwareMinSamplePeriod; // The firmware defaults at boot - static const uint8_t _firmwareDefaultGainSetting = 0; - static const uint16_t _firmwareDefaultAngle = 0; - static const uint16_t _firmwareDefaultTransmitDuration = 32; - static const uint16_t _firmwareDefaultSamplePeriod = 80; - static const uint16_t _firmwareDefaultTransmitFrequency = 740; - static const uint16_t _firmwareDefaultNumberOfSamples = 1024; + static const uint8_t _firmwareDefaultGainSetting; + static const uint16_t _firmwareDefaultAngle; + static const uint16_t _firmwareDefaultTransmitDuration; + static const uint16_t _firmwareDefaultSamplePeriod; + static const uint16_t _firmwareDefaultTransmitFrequency; + static const uint16_t _firmwareDefaultNumberOfSamples; // The default transmit frequency to operate with - static const uint16_t _viewerDefaultTransmitFrequency = 750; - static const uint16_t _viewerDefaultNumberOfSamples = _firmwareMaxNumberOfPoints; + static const uint16_t _viewerDefaultTransmitFrequency; + static const uint16_t _viewerDefaultNumberOfSamples; uint16_t _angle = _firmwareDefaultAngle; uint16_t _transmit_duration = _firmwareDefaultTransmitDuration;