From be585bbf78ca8ba89b243524852c00a0085fc533 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 4 Jul 2020 13:18:24 +0200 Subject: [PATCH] [SSTV] Fixes from cppcheck scan --- src/protocols/SSTV/SSTV.cpp | 8 ++------ src/protocols/SSTV/SSTV.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/protocols/SSTV/SSTV.cpp b/src/protocols/SSTV/SSTV.cpp index 73b9b1d9..7988fc64 100644 --- a/src/protocols/SSTV/SSTV.cpp +++ b/src/protocols/SSTV/SSTV.cpp @@ -166,7 +166,7 @@ SSTVClient::SSTVClient(AFSKClient* audio) { } #endif -int16_t SSTVClient::begin(SSTVMode_t mode, float correction) { +int16_t SSTVClient::begin(const SSTVMode_t& mode, float correction) { if(_audio == nullptr) { // this initialization method can only be used in AFSK mode return(ERR_WRONG_MODEM); @@ -175,7 +175,7 @@ int16_t SSTVClient::begin(SSTVMode_t mode, float correction) { return(begin(0, mode, correction)); } -int16_t SSTVClient::begin(float base, SSTVMode_t mode, float correction) { +int16_t SSTVClient::begin(float base, const SSTVMode_t& mode, float correction) { // save mode _mode = mode; @@ -278,10 +278,6 @@ void SSTVClient::sendLine(uint32_t* imgLine) { } } -uint16_t SSTVClient::getPictureHeight() { - return(_mode.height); -} - void SSTVClient::tone(float freq, uint32_t len) { uint32_t start = micros(); if(_audio != nullptr) { diff --git a/src/protocols/SSTV/SSTV.h b/src/protocols/SSTV/SSTV.h index 1ab9225b..ea64ceca 100644 --- a/src/protocols/SSTV/SSTV.h +++ b/src/protocols/SSTV/SSTV.h @@ -121,7 +121,7 @@ class SSTVClient { \param phy Pointer to the wireless module providing PhysicalLayer communication. */ - SSTVClient(PhysicalLayer* phy); + explicit SSTVClient(PhysicalLayer* phy); #if !defined(RADIOLIB_EXCLUDE_AFSK) /*! @@ -129,7 +129,7 @@ class SSTVClient { \param audio Pointer to the AFSK instance providing audio. */ - SSTVClient(AFSKClient* phy); + explicit SSTVClient(AFSKClient* audio); #endif // basic methods @@ -145,7 +145,7 @@ class SSTVClient { \returns \ref status_codes */ - int16_t begin(float base, SSTVMode_t mode, float correction = 1.0); + int16_t begin(float base, const SSTVMode_t& mode, float correction = 1.0); /*! \brief Initialization method for AFSK. @@ -156,7 +156,7 @@ class SSTVClient { \returns \ref status_codes */ - int16_t begin(SSTVMode_t mode, float correction = 1.0); + int16_t begin(const SSTVMode_t& mode, float correction = 1.0); /*! \brief Sends out tone at 1900 Hz. @@ -180,7 +180,7 @@ class SSTVClient { \returns Picture height of the currently configured SSTV mode in pixels. */ - uint16_t getPictureHeight(); + uint16_t getPictureHeight() const { return(_mode.height); }; #ifndef RADIOLIB_GODMODE private: @@ -192,9 +192,9 @@ class SSTVClient { void* _audio; #endif - uint32_t _base; - SSTVMode_t _mode; - bool _firstLine; + uint32_t _base = 0; + SSTVMode_t _mode = Scottie1; + bool _firstLine = true; void tone(float freq, uint32_t len = 0); };