Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFIR coefficient GUI & cleanup #396

Merged
merged 38 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
22f34b5
Add constexpr at a few places
DominykasPetke Dec 27, 2023
375f604
Remove extraneous call to string's constructor
DominykasPetke Dec 27, 2023
e4a0ab9
Remove unused function
DominykasPetke Dec 27, 2023
c832277
Re-add GFIR coefficient reading/writing functionality in the GUI
DominykasPetke Dec 28, 2023
5220dc6
Fix logs
DominykasPetke Dec 28, 2023
58e4efd
Clean up coefficient file saving
DominykasPetke Dec 28, 2023
9b1fb2f
Rewrite coefficient file parsing using C++ file stream parsing
DominykasPetke Dec 29, 2023
9af8efc
Move Parser into own folder and de-stringstream it a bit
DominykasPetke Dec 29, 2023
fb14768
Add tests for CoefficientFileParser
DominykasPetke Dec 29, 2023
e5b6350
Remove unnecessary if branch
DominykasPetke Dec 29, 2023
8eca825
Fix an edgecase where if max was equal to actual coefficient count in…
DominykasPetke Dec 29, 2023
fbe0ccb
Add CoefficientFileParser into lime namespace
DominykasPetke Dec 29, 2023
ec29419
Add more CoefficientFileParser tests
DominykasPetke Dec 29, 2023
995f028
Split one multicase test into many smaller tests
DominykasPetke Dec 29, 2023
c34bf40
Extract multiline comment parsing into a separate file
DominykasPetke Dec 29, 2023
fa98387
Add test for single line comment ending the file
DominykasPetke Dec 29, 2023
2815ede
Use std::ifstream in lms7002_pnlMCU_BD_view as well
DominykasPetke Dec 29, 2023
0c48510
Fix .deb file linker failing
DominykasPetke Dec 29, 2023
bb9b25d
Add consts and use std::memset in DataPacket.h
DominykasPetke Dec 29, 2023
2b21982
Update GTest
DominykasPetke Dec 29, 2023
ef5b762
Add a couple more tests for CoefficientFileParser
DominykasPetke Dec 29, 2023
d41463e
Clean up -Wpedantic warnings
DominykasPetke Jan 2, 2024
98dfd35
Remove extra copy of a file
DominykasPetke Jan 2, 2024
3f555e0
Constexpr'ify `commonTypes.h`
DominykasPetke Jan 2, 2024
18ddbd0
Fix formatting
DominykasPetke Jan 2, 2024
1bd4b88
Rename method and remove unnecessary variable
DominykasPetke Jan 2, 2024
d01b3d5
Improve testing for the CoefficientFileParser
DominykasPetke Jan 3, 2024
ea71cbc
Add const to a few places
DominykasPetke Jan 5, 2024
b7a4d4f
Merge branch 'litepcie-update' into litepcie-update-cleanup
DominykasPetke Jan 11, 2024
fdbabc8
Use std::filesystem::path
DominykasPetke Jan 30, 2024
fdac962
Correct the string literals usage in CoefficientFileParser
DominykasPetke Jan 30, 2024
3e35b95
Have less copying around in `CoefficientFileParser::parseMultilineCom…
DominykasPetke Jan 30, 2024
278f26c
Merge branch 'litepcie-update' into litepcie-update-gfir
DominykasPetke Jan 31, 2024
499f158
Fix post-merge issues
DominykasPetke Jan 31, 2024
b0792eb
Clean up GUI code issues
DominykasPetke Feb 1, 2024
f2bfcd5
Fix swapped around functions
DominykasPetke Feb 1, 2024
88bfbe2
Fix coefficient reading/writing in LMS7002M code
DominykasPetke Feb 1, 2024
efe346b
Rename LMS7002M's GFIR coefficient functions to be named `Set`/`Get`
DominykasPetke Feb 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ if(ENABLE_TESTING)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG b10fad38c4026a29ea6561ab15fc4818170d1c10 # latest main at the time of writing this
GIT_TAG dddb219c3eb96d7f9200f09b0a381f016e6b4562 # latest main at the time of writing this
)

set(INSTALL_GMOCK OFF) # Don't install the GMock headers
Expand Down
1 change: 0 additions & 1 deletion SoapyLMS7/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ void SoapyLMS7::setFrequency(
TRXDir dir = direction == SOAPY_SDR_TX ? TRXDir::Tx : TRXDir::Rx;
if (name == "RF")
{
const auto clkId = dir == TRXDir::Tx ? 2 : 1;
try
{
sdrDevice->SetFrequency(0, dir, channel, frequency);
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(LIME_SUITE_SOURCES
threadHelper/threadHelper.cpp
CDCM6208/CDCM6208_Dev.cpp
gnuPlotPipe.h
parsers/CoefficientFileParser.cpp

EnumToString.cpp

Expand Down Expand Up @@ -196,7 +197,6 @@ set(LMS7SUITE_GUI_SOURCES
lms7002_wxgui/lms7002_pnlLDO_view.cpp
lms7002_wxgui/lms7002_pnlAFE_view.cpp
lms7002_wxgui/lms7002_pnlGains_view.cpp
lms7002_wxgui/CoefficientFileParser.cpp
lms7002_wxgui/lms7002_pnlRxTSP_view.cpp
lms7002_wxgui/lms7002_mainPanel.cpp
# lms7002_wxgui/dlgViewSFR.cpp
Expand Down
8 changes: 3 additions & 5 deletions src/boards/LMS7002M_SDRDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,21 +942,19 @@ std::vector<double> LMS7002M_SDRDevice::GetGFIRCoefficients(uint8_t moduleIndex,
lime::LMS7002M* lms = mLMSChips.at(moduleIndex);

const uint8_t count = gfirID == 2 ? 120 : 40;
std::vector<int16_t> coefficientBuffer(count);
std::vector<double> coefficientBuffer(count);

lms->GetGFIRCoefficients(trx, gfirID, coefficientBuffer.data(), count);

return std::vector<double>(coefficientBuffer.begin(), coefficientBuffer.end());
return coefficientBuffer;
}

void LMS7002M_SDRDevice::SetGFIRCoefficients(
uint8_t moduleIndex, TRXDir trx, uint8_t channel, uint8_t gfirID, std::vector<double> coefficients)
{
lime::LMS7002M* lms = mLMSChips.at(moduleIndex);

std::vector<int16_t> convertedCoefficients(coefficients.begin(), coefficients.end());

lms->SetGFIRCoefficients(trx, gfirID, convertedCoefficients.data(), convertedCoefficients.size());
lms->SetGFIRCoefficients(trx, gfirID, coefficients.data(), coefficients.size());
}

void LMS7002M_SDRDevice::SetGFIR(uint8_t moduleIndex, TRXDir trx, uint8_t channel, uint8_t gfirID, bool enabled)
Expand Down
6 changes: 3 additions & 3 deletions src/boards_wxgui/pnlGPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ void pnlGPIO::Initialize(lime::SDRDevice* pControl)
auto info = device->GetDescriptor();

const std::unordered_map<std::string, int> specialGpioCounts{
{ string(GetDeviceName(LMS_DEV_LIMESDRMINI)), 10 },
{ string(GetDeviceName(LMS_DEV_LIMESDRMINI_V2)), 10 },
{ string(GetDeviceName(LMS_DEV_LIMESDR_PCIE)), 16 },
{ GetDeviceName(LMS_DEV_LIMESDRMINI), 10 },
{ GetDeviceName(LMS_DEV_LIMESDRMINI_V2), 10 },
{ GetDeviceName(LMS_DEV_LIMESDR_PCIE), 16 },
};

if (specialGpioCounts.find(info.name) != specialGpioCounts.end())
Expand Down
2 changes: 1 addition & 1 deletion src/comms/USB/LMS64C_LMS7002M_Over_USB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ int LMS64C_LMS7002M_Over_USB::SPI(uint32_t spiBusAddress, const uint32_t* MOSI,
int LMS64C_LMS7002M_Over_USB::ResetDevice(int chipSelect)
{
return LMS64CProtocol::DeviceReset(*pipe, chipSelect);
};
}
4 changes: 2 additions & 2 deletions src/fftviewer_wxgui/fftviewer_frFFTviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ bool fftviewer_frFFTviewer::Initialize(SDRDevice* pDataPort)
else
{
constexpr uint8_t modeChoicesItemCount = 2;
const std::array<wxString, modeChoicesItemCount> modeChoices{ "SISO", "MIMO" };
const std::array<const wxString, modeChoicesItemCount> modeChoices{ "SISO", "MIMO" };
cmbMode->Set(modeChoicesItemCount, modeChoices.data());
cmbMode->SetSelection(0);
cmbMode->GetContainingSizer()->Layout(); // update the width of the box

constexpr uint8_t channelVisibilityChoicesItemCount = 3;
const std::array<wxString, channelVisibilityChoicesItemCount> channelVisibilityChoices{ "A", "B", "A&B" };
const std::array<const wxString, channelVisibilityChoicesItemCount> channelVisibilityChoices{ "A", "B", "A&B" };
cmbChannelVisibility->Set(channelVisibilityChoicesItemCount, channelVisibilityChoices.data());
cmbChannelVisibility->SetSelection(0);
cmbChannelVisibility->GetContainingSizer()->Layout(); // update the width of the box
Expand Down
5 changes: 2 additions & 3 deletions src/include/limesuite/LMS7002M.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,10 @@ class LIME_API LMS7002M
int SetNCOPhaseOffsetForMode0(TRXDir dir, float_type angle_Deg);
int SetNCOPhaseOffset(TRXDir dir, uint8_t index, float_type angle_Deg);
float_type GetNCOPhaseOffset_Deg(TRXDir dir, uint8_t index);
int SetGFIRCoefficients(TRXDir dir, uint8_t GFIR_index, const int16_t* coef, uint8_t coefCount);
int GetGFIRCoefficients(TRXDir dir, uint8_t GFIR_index, int16_t* coef, uint8_t coefCount);
float_type GetReferenceClk_TSP(TRXDir dir);

int WriteGFIRCoefficients(TRXDir dir, uint8_t gfirIndex, const float_type* coef, uint8_t coefCount);
int GetGFIRCoefficients(TRXDir dir, uint8_t gfirIndex, float_type* coef, uint8_t coefCount);
int SetGFIRCoefficients(TRXDir dir, uint8_t gfirIndex, const float_type* coef, uint8_t coefCount);
int SetGFIRFilter(TRXDir dir, unsigned ch, bool enabled, double bandwidth);

int SetNCOFrequencies(TRXDir dir, const float_type* freq_Hz, uint8_t count, float_type phaseOffset);
Expand Down
37 changes: 0 additions & 37 deletions src/include/limesuite/LimeSuiteConfig.h

This file was deleted.

14 changes: 7 additions & 7 deletions src/include/limesuite/commonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace lime {
enum class TRXDir : bool { Rx, Tx };

struct Range {
Range(double min = 0.0, double max = 0.0, double step = 0.0)
constexpr Range(double min = 0.0, double max = 0.0, double step = 0.0)
: min(min)
, max(max)
, step(step){};
Expand All @@ -21,14 +21,14 @@ struct Range {
template<class T> class DeltaVariable
{
public:
DeltaVariable(T init)
constexpr DeltaVariable(T init)
: mValue(init)
, mLastValue(0){};
void set(T val) { mValue = val; }
void add(T val) { mValue += val; }
T delta() { return mValue - mLastValue; } // value change since last reset
T value() const { return mValue; }
void checkpoint() { mLastValue = mValue; }
constexpr void set(T val) { mValue = val; }
constexpr void add(T val) { mValue += val; }
constexpr T delta() const { return mValue - mLastValue; } // value change since last reset
constexpr T value() const { return mValue; }
constexpr void checkpoint() { mLastValue = mValue; }

private:
T mValue;
Expand Down
Loading
Loading