From a2f842835250c5ac3dced3a9df2551c5aa938ebe Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 3 Feb 2025 13:58:46 +0000 Subject: [PATCH 1/6] Radiosonde: Fix pressure calculation. #2242 --- sdrbase/util/radiosonde.cpp | 14 ++++++++++---- sdrbase/util/radiosonde.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sdrbase/util/radiosonde.cpp b/sdrbase/util/radiosonde.cpp index 34c2b0124..e45da02ba 100644 --- a/sdrbase/util/radiosonde.cpp +++ b/sdrbase/util/radiosonde.cpp @@ -76,6 +76,12 @@ QString RS41Frame::toHex() return m_bytes.toHex(); } +int16_t RS41Frame::getInt16(const QByteArray ba, int offset) const +{ + return (ba[offset] & 0xff) + | ((ba[offset+1] & 0xff) << 8); +} + uint16_t RS41Frame::getUInt16(const QByteArray ba, int offset) const { return (ba[offset] & 0xff) @@ -130,7 +136,7 @@ void RS41Frame::decodeMeas(const QByteArray ba) m_pressureMain = getUInt24(ba, 0x1b); m_pressureRef1 = getUInt24(ba, 0x1e); m_pressureRef2 = getUInt24(ba, 0x21); - m_pressureTemp = getUInt16(ba, 0x26) / 100.0f; + m_pressureTemp = getInt16(ba, 0x26) / 100.0f; } void RS41Frame::decodeGPSInfo(const QByteArray ba) @@ -187,7 +193,7 @@ static float waterVapourSaturationPressure(float tCelsius) return p / 100.0f; } -static float calcT(int f, int f1, int f2, float r1, float r2, float *poly, float *cal) +static float calcT(int f, int f1, int f2, float r1, float r2, const float *poly, const float *cal) { /*float g = (float)(f2-f1) / (r2-r1); // gain float Rb = (f1*r2-f2*r1) / (float)(f2-f1); // offset @@ -219,7 +225,7 @@ static float calcT(int f, int f1, int f2, float r1, float r2, float *poly, float return tCal; } -static float calcU(int cInt, int cMin, int cMax, float c1, float c2, float T, float HT, float *capCal, float *matrixCal, float height, float *vectorPCal, float *matrixPCal) +static float calcU(int cInt, int cMin, int cMax, float c1, float c2, float T, float HT, float *capCal, float *matrixCal, float height, const float *vectorPCal, const float *matrixPCal) { //qDebug() << "cInt " << cInt << " cMin " << cMin << " cMax " << cMax << " c1 " << c1 << " c2 " << c2 << " T " << T << " HT " << HT << " capCal[0] " << capCal[0] << " capCal[1] " << capCal[1] << "height" << height; @@ -302,7 +308,7 @@ static float calcU(int cInt, int cMin, int cMax, float c1, float c2, float T, fl return uCal; } -static float calcP(int f, int f1, int f2, float pressureTemp, float *cal) +static float calcP(int f, int f1, int f2, float pressureTemp, const float *cal) { // Convert integer measurement to scale factor float s = (f-f1) / (float)(f2-f1); diff --git a/sdrbase/util/radiosonde.h b/sdrbase/util/radiosonde.h index 2136d4cd1..001af7fca 100644 --- a/sdrbase/util/radiosonde.h +++ b/sdrbase/util/radiosonde.h @@ -124,6 +124,7 @@ public: static int getFrameLength(int frameType); protected: + int16_t getInt16(const QByteArray ba, int offset) const; uint16_t getUInt16(const QByteArray ba, int offset) const; uint32_t getUInt24(const QByteArray ba, int offset) const; uint32_t getUInt32(const QByteArray ba, int offset) const; From b65311736064c0da733ebe60d43058af3490ddfa Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 3 Feb 2025 14:04:43 +0000 Subject: [PATCH 2/6] Fix lint warnings. --- sdrbase/util/radiosonde.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrbase/util/radiosonde.cpp b/sdrbase/util/radiosonde.cpp index e45da02ba..124e1d4c2 100644 --- a/sdrbase/util/radiosonde.cpp +++ b/sdrbase/util/radiosonde.cpp @@ -225,7 +225,7 @@ static float calcT(int f, int f1, int f2, float r1, float r2, const float *poly, return tCal; } -static float calcU(int cInt, int cMin, int cMax, float c1, float c2, float T, float HT, float *capCal, float *matrixCal, float height, const float *vectorPCal, const float *matrixPCal) +static float calcU(int cInt, int cMin, int cMax, float c1, float c2, float T, float HT, const float *capCal, const float *matrixCal, float height, const float *vectorPCal, const float *matrixPCal) { //qDebug() << "cInt " << cInt << " cMin " << cMin << " cMax " << cMax << " c1 " << c1 << " c2 " << c2 << " T " << T << " HT " << HT << " capCal[0] " << capCal[0] << " capCal[1] " << capCal[1] << "height" << height; From 310df0046cd258473d212787f988591c3a0b05fe Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 4 Feb 2025 12:03:13 +0000 Subject: [PATCH 3/6] Try setting MACOSX_DEPLOYMENT_TARGET to see if it can run on older MacOSes. --- .github/workflows/mac.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index a646a4821..04ab1d723 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -10,6 +10,8 @@ on: jobs: build_mac_x64: runs-on: macos-13 + env: + MACOSX_DEPLOYMENT_TARGET: 12.0 steps: - uses: actions/checkout@v4 with: From 7f20ca0a6db05e888b3d6db6bd0595d78b1f35f9 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 4 Feb 2025 12:04:51 +0000 Subject: [PATCH 4/6] Fix indent --- .github/workflows/mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 04ab1d723..9b6585e6a 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -10,7 +10,7 @@ on: jobs: build_mac_x64: runs-on: macos-13 - env: + env: MACOSX_DEPLOYMENT_TARGET: 12.0 steps: - uses: actions/checkout@v4 From 082a07d39bac9dcaa459dbd99642fd22a6405b55 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sun, 16 Feb 2025 18:11:37 +0000 Subject: [PATCH 5/6] Fix -DBUILD_SHARED_LIBS=ON for FLAC --- external/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 33d5948c7..91c4c3620 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -859,7 +859,7 @@ if(ENABLE_CHANNELRX_REMOTETCPSINK) ExternalProject_Add(flac GIT_REPOSITORY https://github.com/xiph/flac.git PREFIX "${EXTERNAL_BUILD_LIBRARIES}/flac" - CMAKE_ARGS ${COMMON_CMAKE_ARGS} -DINSTALL_MANPAGES=OFF -D=BUILD_SHARED_LIBS=ON -DWITH_FORTIFY_SOURCE=OFF -DWITH_STACK_PROTECTOR=PFF -DBUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DWITH_OGG=OFF -DBUILD_DOCS=OFF + CMAKE_ARGS ${COMMON_CMAKE_ARGS} -DINSTALL_MANPAGES=OFF -DBUILD_SHARED_LIBS=ON -DWITH_FORTIFY_SOURCE=OFF -DWITH_STACK_PROTECTOR=PFF -DBUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DWITH_OGG=OFF -DBUILD_DOCS=OFF BUILD_BYPRODUCTS "${FLAC_LIBRARIES}" INSTALL_COMMAND "" TEST_COMMAND "" From c40da37fafa4a3b34ea801fffefd28c7281d61c3 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 27 Feb 2025 13:20:44 +0000 Subject: [PATCH 6/6] wdsp: Remove redundant code that causes stack overflow on Mac. For #2324. --- wdsp/emnr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wdsp/emnr.cpp b/wdsp/emnr.cpp index 27c656710..6e6660e3a 100644 --- a/wdsp/emnr.cpp +++ b/wdsp/emnr.cpp @@ -444,6 +444,7 @@ EMNR::G::G( std::copy(Calculus::GG.begin(), Calculus::GG.end(), GG.begin()); std::copy(Calculus::GGS.begin(), Calculus::GGS.end(), GGS.begin()); + /* Removed as redundant and causes a stack overflow on Mac - see #2324 // We keep this pretty useless part just in case... if ((fileb = fopen("calculus", "rb"))) { @@ -462,7 +463,7 @@ EMNR::G::G( std::copy(ggs.begin(), ggs.end(), GGS.begin()); } fclose(fileb); - } + }*/ } void EMNR::G::calc_gamma0()