Binary files /tmp/tmpeTnovq/pmvzGDYUUC/limesuite-16.6.6.818.730.60b8d25/build/bin/Release/lms7suite.exe and /tmp/tmpeTnovq/74HRL70RH3/limesuite-16.8.1.819.792.4165104/build/bin/Release/lms7suite.exe differ diff -Nru limesuite-16.6.6.818.730.60b8d25/CMakeLists.txt limesuite-16.8.1.819.792.4165104/CMakeLists.txt --- limesuite-16.6.6.818.730.60b8d25/CMakeLists.txt 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/CMakeLists.txt 2016-08-25 18:57:42.000000000 +0000 @@ -89,10 +89,13 @@ option(CMAKE_BUILD_WITH_INSTALL_RPATH "build with install rpath" FALSE) # the RPATH to be used when installing, but only if it's not a system directory +option(CMAKE_AUTOSET_INSTALL_RPATH TRUE) +if(CMAKE_AUTOSET_INSTALL_RPATH) LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") ENDIF("${isSystemDir}" STREQUAL "-1") +endif(CMAKE_AUTOSET_INSTALL_RPATH) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/changelog limesuite-16.8.1.819.792.4165104/debian/changelog --- limesuite-16.6.6.818.730.60b8d25/debian/changelog 2016-06-26 18:59:06.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/changelog 2016-08-26 06:35:44.000000000 +0000 @@ -1,8 +1,17 @@ -limesuite (16.6.6.818.730.60b8d25-myriadrf1~wily) wily; urgency=low +limesuite (16.8.1.819.792.4165104-myriadrf1~wily) wily; urgency=low * PPA helper upload script - -- Josh Blum Sun, 26 Jun 2016 11:58:49 -0700 + -- Josh Blum Thu, 25 Aug 2016 23:35:39 -0700 + +limesuite (16.8.1.819) unstable; urgency=low + + * updated debian packaging for latest version.h + * set standards version to 3.9.7 + * update ABI version to 16.8-1 + * disable CMAKE_INSTALL_RPATH + + -- Lime Microsystems Thu, 25 Aug 2016 11:41:35 -0700 limesuite (16.6.6.818) unstable; urgency=low diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/control limesuite-16.8.1.819.792.4165104/debian/control --- limesuite-16.6.6.818.730.60b8d25/debian/control 2016-06-26 18:59:06.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/control 2016-08-26 06:35:44.000000000 +0000 @@ -11,16 +11,16 @@ libi2c-dev, freeglut3-dev, libsqlite3-dev -Standards-Version: 3.9.5 +Standards-Version: 3.9.7 Homepage: https://myriadrf.org/projects/lime-suite/ Vcs-Git: https://github.com/myriadrf/LimeSuite.git Vcs-Browser: https://github.com/myriadrf/LimeSuite.git -Package: liblimesuite16.6-1 +Package: liblimesuite16.8-1 Section: libs Architecture: any Multi-Arch: same -Pre-Depends: multiarch-support, ${misc:Pre-Depends} +Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: limesuite-udev Description: Lime Suite - shared library @@ -30,7 +30,7 @@ Section: libdevel Architecture: any Depends: - liblimesuite16.6-1 (= ${binary:Version}), + liblimesuite16.8-1 (= ${binary:Version}), ${misc:Depends} Description: Lime Suite - development files Lime Suite application software. @@ -39,7 +39,7 @@ Section: comm Architecture: any Depends: - liblimesuite16.6-1 (= ${binary:Version}), + liblimesuite16.8-1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, xdg-utils @@ -50,7 +50,7 @@ Section: comm Architecture: any Depends: - liblimesuite16.6-1 (= ${binary:Version}), + liblimesuite16.8-1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, python, python-soapysdr diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/liblimesuite16.6-1.install limesuite-16.8.1.819.792.4165104/debian/liblimesuite16.6-1.install --- limesuite-16.6.6.818.730.60b8d25/debian/liblimesuite16.6-1.install 2016-06-26 18:59:06.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/liblimesuite16.6-1.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/lib*.so.* diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/liblimesuite16.8-1.install limesuite-16.8.1.819.792.4165104/debian/liblimesuite16.8-1.install --- limesuite-16.6.6.818.730.60b8d25/debian/liblimesuite16.8-1.install 1970-01-01 00:00:00.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/liblimesuite16.8-1.install 2016-08-26 06:35:44.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/lib*.so.* diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/limesuite.install limesuite-16.8.1.819.792.4165104/debian/limesuite.install --- limesuite-16.6.6.818.730.60b8d25/debian/limesuite.install 2016-06-26 18:59:06.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/limesuite.install 2016-08-26 06:35:44.000000000 +0000 @@ -1,2 +1,3 @@ usr/bin/lms7suite usr/bin/LimeUtil +usr/share/Lime diff -Nru limesuite-16.6.6.818.730.60b8d25/debian/rules limesuite-16.8.1.819.792.4165104/debian/rules --- limesuite-16.6.6.818.730.60b8d25/debian/rules 2016-06-26 18:59:06.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/debian/rules 2016-08-26 06:35:44.000000000 +0000 @@ -15,12 +15,12 @@ %: - dh $@ --buildsystem=cmake + dh $@ --buildsystem=cmake --parallel override_dh_auto_configure: dh_auto_configure -- \ -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_SKIP_RPATH=TRUE \ + -DCMAKE_AUTOSET_INSTALL_RPATH=FALSE \ -DUDEV_RULES_PATH=/lib/udev/rules.d \ -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" \ -DLIME_SUITE_EXTVER="$(DEB_VERSION_EXTVER)" Binary files /tmp/tmpeTnovq/pmvzGDYUUC/limesuite-16.6.6.818.730.60b8d25/docs/lms7api.pdf and /tmp/tmpeTnovq/74HRL70RH3/limesuite-16.8.1.819.792.4165104/docs/lms7api.pdf differ Binary files /tmp/tmpeTnovq/pmvzGDYUUC/limesuite-16.6.6.818.730.60b8d25/docs/lms7suite_compilation_guide.odt and /tmp/tmpeTnovq/74HRL70RH3/limesuite-16.8.1.819.792.4165104/docs/lms7suite_compilation_guide.odt differ Binary files /tmp/tmpeTnovq/pmvzGDYUUC/limesuite-16.6.6.818.730.60b8d25/docs/lms7suite_compilation_guide.pdf and /tmp/tmpeTnovq/74HRL70RH3/limesuite-16.8.1.819.792.4165104/docs/lms7suite_compilation_guide.pdf differ Binary files /tmp/tmpeTnovq/pmvzGDYUUC/limesuite-16.6.6.818.730.60b8d25/docs/StreamProtocol.pdf and /tmp/tmpeTnovq/74HRL70RH3/limesuite-16.8.1.819.792.4165104/docs/StreamProtocol.pdf differ diff -Nru limesuite-16.6.6.818.730.60b8d25/SoapyLMS7/Settings.cpp limesuite-16.8.1.819.792.4165104/SoapyLMS7/Settings.cpp --- limesuite-16.6.6.818.730.60b8d25/SoapyLMS7/Settings.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/SoapyLMS7/Settings.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -564,14 +564,23 @@ { switch (direction) { - case SOAPY_SDR_RX: rfic->Modify_SPI_Reg_bits(CMIX_BYP_RXTSP, (frequency == 0)?1:0); - case SOAPY_SDR_TX: rfic->Modify_SPI_Reg_bits(CMIX_BYP_TXTSP, (frequency == 0)?1:0); + case SOAPY_SDR_RX: + rfic->Modify_SPI_Reg_bits(CMIX_BYP_RXTSP, (frequency == 0)?1:0); + rfic->Modify_SPI_Reg_bits(CMIX_SC_RXTSP, (frequency < 0)?1:0); + break; + case SOAPY_SDR_TX: + rfic->Modify_SPI_Reg_bits(CMIX_BYP_TXTSP, (frequency == 0)?1:0); + rfic->Modify_SPI_Reg_bits(CMIX_SC_TXTSP, (frequency < 0)?1:0); + break; + } + if (rfic->SetNCOFrequency(lmsDir, 0, abs(frequency)) != 0) + { + throw std::runtime_error(lime::GetLastErrorMessage()); } - rfic->SetNCOFrequency(lmsDir, 0, frequency); return; } - throw std::runtime_error("SoapyLMS7::getFrequency("+name+") unknown name"); + throw std::runtime_error("SoapyLMS7::setFrequency("+name+") unknown name"); } double SoapyLMS7::getFrequency(const int direction, const size_t channel, const std::string &name) const @@ -587,7 +596,8 @@ if (name == "BB") { - return rfic->GetNCOFrequency(lmsDir, 0); + int sign = rfic->Get_SPI_Reg_bits(lmsDir==LMS7002M::Tx?CMIX_SC_TXTSP:CMIX_SC_RXTSP) == 0 ? 1 : -1; + return rfic->GetNCOFrequency(lmsDir, 0) * sign; } throw std::runtime_error("SoapyLMS7::getFrequency("+name+") unknown name"); @@ -620,6 +630,13 @@ return ranges; } +SoapySDR::RangeList SoapyLMS7::getFrequencyRange(const int direction, const size_t channel) const +{ + SoapySDR::RangeList ranges; + ranges.push_back(SoapySDR::Range(0.0, 3.8e9)); + return ranges; +} + /******************************************************************* * Sample Rate API ******************************************************************/ @@ -886,8 +903,8 @@ double SoapyLMS7::getMasterClockRate(void) const { std::unique_lock lock(_accessMutex); - auto rfic = this->getRFIC(0); //same for all RFIC - return rfic->GetFrequencyCGEN(); + //assume same rate for all RFIC in this wrapper + return _rfics.front()->GetFrequencyCGEN(); } /******************************************************************* diff -Nru limesuite-16.6.6.818.730.60b8d25/SoapyLMS7/SoapyLMS7.h limesuite-16.8.1.819.792.4165104/SoapyLMS7/SoapyLMS7.h --- limesuite-16.6.6.818.730.60b8d25/SoapyLMS7/SoapyLMS7.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/SoapyLMS7/SoapyLMS7.h 2016-08-25 18:57:42.000000000 +0000 @@ -152,6 +152,8 @@ std::vector listFrequencies(const int direction, const size_t channel) const; + SoapySDR::RangeList getFrequencyRange(const int direction, const size_t channel) const; + SoapySDR::RangeList getFrequencyRange(const int direction, const size_t channel, const std::string &name) const; /******************************************************************* diff -Nru limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnlLimeSDR.cpp limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnlLimeSDR.cpp --- limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnlLimeSDR.cpp 1970-01-01 00:00:00.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnlLimeSDR.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -0,0 +1,157 @@ +#include "pnlLimeSDR.h" + +#include +#include +#include +#include +#include +#include +#include +#include "lms7suiteEvents.h" + +#include + +#include +#include + +using namespace lime; +using namespace std; + +BEGIN_EVENT_TABLE(pnlLimeSDR, wxPanel) +END_EVENT_TABLE() + +pnlLimeSDR::pnlLimeSDR(wxWindow* parent,wxWindowID id, const wxPoint& pos,const wxSize& size, int style, wxString name) +{ + mSerPort = nullptr; + + Create(parent, id, pos, size, style, name); +#ifdef WIN32 + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); +#endif + mainSizer = new wxFlexGridSizer(0, 2, 5, 5); + controlsSizer = new wxFlexGridSizer(0, 2, 5, 5); + + SetSizer(mainSizer); + chkRFLB_A_EN = new wxCheckBox(this, wxNewId(), _("RF loopback ch.A")); + chkRFLB_A_EN->SetToolTip(_("[RFLB_A_EN] External RF loopback TxBAND2->RxLNAH channel A")); + Connect(chkRFLB_A_EN->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkRFLB_A_EN, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + chkRFLB_B_EN = new wxCheckBox(this, wxNewId(), _("RF loopback ch.A")); + chkRFLB_B_EN->SetToolTip(_("[RFLB_B_EN] External RF loopback TxBAND2->RxLNAH channel B")); + Connect(chkRFLB_B_EN->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkRFLB_B_EN, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + + chkTX1_2_LB_SH = new wxCheckBox(this, wxNewId(), _("Ch.A shunt")); + chkTX1_2_LB_SH->SetToolTip(_("[TX1_2_LB_SH]")); + Connect(chkTX1_2_LB_SH->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkTX1_2_LB_SH, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + chkTX2_2_LB_SH = new wxCheckBox(this, wxNewId(), _("Ch.B shunt")); + chkTX2_2_LB_SH->SetToolTip(_("[TX2_2_LB_SH]")); + Connect(chkTX2_2_LB_SH->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkTX2_2_LB_SH, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + chkTX1_2_LB_AT = new wxCheckBox(this, wxNewId(), _("Ch.A attenuator")); + chkTX1_2_LB_AT->SetToolTip(_("[TX1_2_LB_AT]")); + Connect(chkTX1_2_LB_AT->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkTX1_2_LB_AT, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + chkTX2_2_LB_AT = new wxCheckBox(this, wxNewId(), _("Ch.B attenuator")); + chkTX2_2_LB_AT->SetToolTip(_("[TX2_2_LB_AT]")); + Connect(chkTX2_2_LB_AT->GetId(), wxEVT_CHECKBOX, wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), NULL, this); + controlsSizer->Add(chkTX2_2_LB_AT, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + + groupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("External loopback controls") ), wxVERTICAL ); + lblWarning = new wxStaticText(this, wxID_ANY, _("")); + lblWarning->Hide(); + groupSizer->Add(lblWarning, 0, wxALIGN_LEFT | wxALIGN_TOP, 5); + groupSizer->Add(controlsSizer, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + mainSizer->Add(groupSizer, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + + mainSizer->Fit(this); + mainSizer->SetSizeHints(this); + Layout(); + + Bind(READ_ALL_VALUES, &pnlLimeSDR::OnReadAll, this, this->GetId()); + Bind(WRITE_ALL_VALUES, &pnlLimeSDR::OnGPIOChange, this, this->GetId()); +} + +void pnlLimeSDR::Initialize(IConnection* pControl) +{ + mSerPort = pControl; + if(mSerPort) + { + std::string hw = mSerPort->GetDeviceInfo().hardwareVersion; + if(hw != "3") + { + auto controls = controlsSizer->GetChildren(); + for(auto i : controls) + i->GetWindow()->Disable(); + lblWarning->SetLabel(wxString::Format(_("Requires HW:3, your HW:%s"), hw)); + lblWarning->Show(); + } + else + { + lblWarning->SetLabel(_("")); + lblWarning->Hide(); + auto controls = controlsSizer->GetChildren(); + for(auto i : controls) + i->GetWindow()->Enable(); + } + } + + mainSizer->Fit(this); + mainSizer->SetSizeHints(this); + Layout(); +} + +pnlLimeSDR::~pnlLimeSDR() +{ + chkRFLB_A_EN->Disconnect(wxEVT_CHECKBOX, chkRFLB_A_EN->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this); + chkRFLB_B_EN->Disconnect(wxEVT_CHECKBOX, chkRFLB_B_EN->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this); + chkTX1_2_LB_SH->Disconnect(wxEVT_CHECKBOX, chkTX1_2_LB_SH->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this);; + chkTX1_2_LB_AT->Disconnect(wxEVT_CHECKBOX, chkTX1_2_LB_AT->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this);; + chkTX2_2_LB_SH->Disconnect(wxEVT_CHECKBOX, chkTX2_2_LB_SH->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this);; + chkTX2_2_LB_AT->Disconnect(wxEVT_CHECKBOX, chkTX2_2_LB_AT->GetId(), wxCommandEventHandler(pnlLimeSDR::OnGPIOChange), 0, this);; +} + +void pnlLimeSDR::OnGPIOChange(wxCommandEvent& event) +{ + uint16_t addr = 0x0017; + uint16_t value = 0; + value |= chkRFLB_A_EN->GetValue() << 0; + value |= chkTX1_2_LB_AT->GetValue() << 1; + value |= chkTX1_2_LB_SH->GetValue() << 2; + + value |= chkRFLB_B_EN->GetValue() << 4; + value |= chkTX2_2_LB_AT->GetValue() << 5; + value |= chkTX2_2_LB_SH->GetValue() << 6; + + if(mSerPort && mSerPort->WriteRegister(addr, value)) + wxMessageBox(GetLastErrorMessage(), _("Error"), wxICON_ERROR | wxOK); +} + +void pnlLimeSDR::UpdatePanel() +{ + uint16_t addr = 0x0017; + uint16_t value = 0; + if(mSerPort && mSerPort->ReadRegister(addr, value)) + { + wxMessageBox(GetLastErrorMessage(), _("Error"), wxICON_ERROR | wxOK); + return; + } + chkRFLB_A_EN->SetValue((value >> 0) & 0x1); + chkTX1_2_LB_AT->SetValue((value >> 1) & 0x1); + chkTX1_2_LB_SH->SetValue((value >> 2) & 0x1); + + chkRFLB_B_EN->SetValue((value >> 4) & 0x1); + chkTX2_2_LB_AT->SetValue((value >> 5) & 0x1); + chkTX2_2_LB_SH->SetValue((value >> 6) & 0x1); +} + +void pnlLimeSDR::OnReadAll(wxCommandEvent &event) +{ + UpdatePanel(); +} + +void pnlLimeSDR::OnWriteAll(wxCommandEvent &event) +{ + OnGPIOChange(event); +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnlLimeSDR.h limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnlLimeSDR.h --- limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnlLimeSDR.h 1970-01-01 00:00:00.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnlLimeSDR.h 2016-08-25 18:57:42.000000000 +0000 @@ -0,0 +1,43 @@ +#ifndef PNL_LIMESDR_H +#define PNL_LIMESDR_H + +#include +#include +class wxStaticText; +class wxFlexGridSizer; +class wxCheckBox; +class wxStaticBoxSizer; + +namespace lime +{ +class IConnection; +} + +class pnlLimeSDR : public wxPanel +{ +public: + pnlLimeSDR(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int style = 0, wxString name = wxEmptyString); + void Initialize(lime::IConnection *pControl); + virtual ~pnlLimeSDR(); + virtual void UpdatePanel(); + void OnGPIOChange(wxCommandEvent &event); + + void OnReadAll(wxCommandEvent &event); + void OnWriteAll(wxCommandEvent &event); + +protected: + wxCheckBox* chkRFLB_A_EN; + wxCheckBox* chkRFLB_B_EN; + wxCheckBox* chkTX1_2_LB_SH; + wxCheckBox* chkTX1_2_LB_AT; + wxCheckBox* chkTX2_2_LB_SH; + wxCheckBox* chkTX2_2_LB_AT; + wxStaticText* lblWarning; + wxFlexGridSizer* controlsSizer; + wxStaticBoxSizer *groupSizer; + wxFlexGridSizer* mainSizer; + lime::IConnection *mSerPort; + DECLARE_EVENT_TABLE() +}; + +#endif diff -Nru limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnluLimeSDR.cpp limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnluLimeSDR.cpp --- limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnluLimeSDR.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnluLimeSDR.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -6,6 +6,7 @@ #include #include #include +#include "lms7suiteEvents.h" #include @@ -42,6 +43,9 @@ mainSizer->Fit(this); mainSizer->SetSizeHints(this); Layout(); + + Bind(READ_ALL_VALUES, &pnluLimeSDR::OnReadAll, this, this->GetId()); + Bind(WRITE_ALL_VALUES, &pnluLimeSDR::OnLoopbackChange, this, this->GetId()); } void pnluLimeSDR::Initialize(IConnection* pControl) @@ -56,7 +60,7 @@ } void pnluLimeSDR::OnLoopbackChange(wxCommandEvent& event) -{ +{ uint16_t addr = 0x0017; uint16_t value = 0; value |= chkRFLB_A_EN->GetValue() << 0; @@ -76,4 +80,14 @@ } chkRFLB_A_EN->SetValue((value >> 0) & 0x1); chkRFLB_B_EN->SetValue((value >> 1) & 0x1); -} \ No newline at end of file +} + +void pnluLimeSDR::OnReadAll(wxCommandEvent &event) +{ + UpdatePanel(); +} + +void pnluLimeSDR::OnWriteAll(wxCommandEvent &event) +{ + OnLoopbackChange(event); +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnluLimeSDR.h limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnluLimeSDR.h --- limesuite-16.6.6.818.730.60b8d25/src/boards_wxgui/pnluLimeSDR.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/boards_wxgui/pnluLimeSDR.h 2016-08-25 18:57:42.000000000 +0000 @@ -20,7 +20,10 @@ virtual ~pnluLimeSDR(); virtual void UpdatePanel(); void OnLoopbackChange(wxCommandEvent &event); - + + void OnReadAll(wxCommandEvent &event); + void OnWriteAll(wxCommandEvent &event); + protected: wxCheckBox* chkRFLB_A_EN; wxCheckBox* chkRFLB_B_EN; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/CMakeLists.txt limesuite-16.8.1.819.792.4165104/src/CMakeLists.txt --- limesuite-16.6.6.818.730.60b8d25/src/CMakeLists.txt 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/CMakeLists.txt 2016-08-25 18:57:42.000000000 +0000 @@ -65,6 +65,7 @@ LMS_StreamBoard/LMS_StreamBoard.cpp kissFFT/kiss_fft.c FPGA_common/FPGA_common.cpp + windowFunction.cpp ) set(LIME_SUITE_INCLUDES @@ -200,6 +201,7 @@ lms7suiteEvents/lms7suiteEvents.cpp boards_wxgui/pnlQSpark.cpp boards_wxgui/pnluLimeSDR.cpp + boards_wxgui/pnlLimeSDR.cpp ) include(FeatureSummary) diff -Nru limesuite-16.6.6.818.730.60b8d25/src/ConnectionSTREAM/ConnectionSTREAM.cpp limesuite-16.8.1.819.792.4165104/src/ConnectionSTREAM/ConnectionSTREAM.cpp --- limesuite-16.6.6.818.730.60b8d25/src/ConnectionSTREAM/ConnectionSTREAM.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/ConnectionSTREAM/ConnectionSTREAM.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -15,8 +15,6 @@ using namespace std; -#define USB_TIMEOUT 1000 - #define HW_LDIGIRED L"DigiRed" #define HW_LDIGIGREEN L"DigiGreen" #define HW_LSTREAMER L"Stream" @@ -280,7 +278,7 @@ else len = 0; #else - len = libusb_control_transfer(dev_handle, LIBUSB_REQUEST_TYPE_VENDOR,CTR_W_REQCODE ,CTR_W_VALUE, CTR_W_INDEX, wbuffer, length, USB_TIMEOUT); + len = libusb_control_transfer(dev_handle, LIBUSB_REQUEST_TYPE_VENDOR,CTR_W_REQCODE ,CTR_W_VALUE, CTR_W_INDEX, wbuffer, length, timeout_ms); #endif } else @@ -292,11 +290,11 @@ len = 0; #else int actual = 0; - libusb_bulk_transfer(dev_handle, 0x01, wbuffer, len, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x01, wbuffer, len, &actual, timeout_ms); len = actual; #endif } - delete wbuffer; + delete[] wbuffer; } else return 0; @@ -324,7 +322,7 @@ else len = 0; #else - len = libusb_control_transfer(dev_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN ,CTR_R_REQCODE ,CTR_R_VALUE, CTR_R_INDEX, buffer, len, USB_TIMEOUT); + len = libusb_control_transfer(dev_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN ,CTR_R_REQCODE ,CTR_R_VALUE, CTR_R_INDEX, buffer, len, timeout_ms); #endif } else @@ -336,7 +334,7 @@ len = 0; #else int actual = 0; - libusb_bulk_transfer(dev_handle, 0x81, buffer, len, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x81, buffer, len, &actual, timeout_ms); len = actual; #endif } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/ConnectionSTREAM/ConnectionSTREAMing.cpp limesuite-16.8.1.819.792.4165104/src/ConnectionSTREAM/ConnectionSTREAMing.cpp --- limesuite-16.6.6.818.730.60b8d25/src/ConnectionSTREAM/ConnectionSTREAMing.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/ConnectionSTREAM/ConnectionSTREAMing.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -47,7 +47,6 @@ mTxFIFO->Reset(2*4096, channelsCount); //configure LML clocking - LMS7002M rfic; rfic.SetConnection(dataPort); rfic.Modify_SPI_Reg_bits(FCLK1_INV, 1, true); rfic.Modify_SPI_Reg_bits(FCLK2_INV, 1, true); @@ -111,7 +110,7 @@ ~USBStreamService(void) { - this->updateThreadState(true); + this->stop(); } void updateThreadState(const bool forceStop = false) @@ -195,10 +194,9 @@ ResetUSBFIFO(dynamic_cast(mDataPort)); //reset/clear LML FIFOs and other state - LMS7002M rfic; - rfic.SetConnection(mDataPort); - rfic.Modify_SPI_Reg_bits(0x0020, 15, 6, 0x00); - rfic.Modify_SPI_Reg_bits(0x0020, 15, 6, 0xff); + uint16_t reg20 = rfic.SPI_read(0x0020, true); + rfic.SPI_write(0x0020, reg20 & ~0xAA00); + rfic.SPI_write(0x0020, reg20); //switch on Rx uint16_t interface_ctrl_000A = Reg_read(mDataPort, 0x000A); @@ -255,6 +253,7 @@ return mTxFIFO; } + LMS7002M rfic; //for LML setup registers const StreamDataFormat format; std::atomic rxStreamUseCount; std::atomic txStreamUseCount; @@ -339,8 +338,7 @@ auto s0 = pos0isA?LMS7002M::AI:LMS7002M::BI; //configure LML based on channel config - LMS7002M rfic; - rfic.SetConnection(this); + auto &rfic = mStreamService->rfic; if (config.isTx) rfic.ConfigureLML_BB2RF(s1, s0, s3, s2); //intentional swap else rfic.ConfigureLML_RF2BB(s0, s1, s2, s3); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/Connection_uLimeSDR/Connection_uLimeSDR.cpp limesuite-16.8.1.819.792.4165104/src/Connection_uLimeSDR/Connection_uLimeSDR.cpp --- limesuite-16.6.6.818.730.60b8d25/src/Connection_uLimeSDR/Connection_uLimeSDR.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/Connection_uLimeSDR/Connection_uLimeSDR.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -16,8 +16,6 @@ using namespace lime; -#define USB_TIMEOUT 1000 - Connection_uLimeSDR::Connection_uLimeSDR(void *arg) { mStreamWrEndPtAddr = 0x03; @@ -68,17 +66,17 @@ { int actual = 0; unsigned char wbuffer[20]={0}; - + mUsbCounter++; wbuffer[0] = (mUsbCounter)&0xFF; wbuffer[1] = (mUsbCounter>>8)&0xFF; wbuffer[2] = (mUsbCounter>>16)&0xFF; wbuffer[3] = (mUsbCounter>>24)&0xFF; wbuffer[4] = ep; - libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, 1000); if (actual != 20) return -1; - + mUsbCounter++; wbuffer[0] = (mUsbCounter)&0xFF; wbuffer[1] = (mUsbCounter>>8)&0xFF; @@ -86,7 +84,7 @@ wbuffer[3] = (mUsbCounter>>24)&0xFF; wbuffer[4] = ep; wbuffer[5] = 0x03; - libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, 1000); if (actual != 20) return -1; return 0; @@ -94,20 +92,20 @@ int Connection_uLimeSDR::FT_SetStreamPipe(unsigned char ep, size_t size) { - + int actual = 0; unsigned char wbuffer[20]={0}; - + mUsbCounter++; wbuffer[0] = (mUsbCounter)&0xFF; wbuffer[1] = (mUsbCounter>>8)&0xFF; wbuffer[2] = (mUsbCounter>>16)&0xFF; wbuffer[3] = (mUsbCounter>>24)&0xFF; wbuffer[4] = ep; - libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, 1000); if (actual != 20) return -1; - + mUsbCounter++; wbuffer[0] = (mUsbCounter)&0xFF; wbuffer[1] = (mUsbCounter>>8)&0xFF; @@ -118,7 +116,7 @@ wbuffer[9] = (size>>8)&0xFF; wbuffer[10] = (size>>16)&0xFF; wbuffer[11] = (size>>24)&0xFF; - libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x01, wbuffer, 20, &actual, 1000); if (actual != 20) return -1; return 0; @@ -176,7 +174,7 @@ return ReportError("Cannot claim interface - %s", libusb_strerror(libusb_error(r))); } printf("Claimed Interface\n"); - + FT_SetStreamPipe(0x82,64); FT_SetStreamPipe(0x02,64); isConnected = true; @@ -223,7 +221,7 @@ long len = 0; if(IsOpen() == false) return 0; - + unsigned char* wbuffer = new unsigned char[length]; memcpy(wbuffer, buffer, length); #ifndef __unix__ @@ -243,7 +241,7 @@ return -1; } - DWORD dwRet = WaitForSingleObject(vOverlapped.hEvent, USB_TIMEOUT); + DWORD dwRet = WaitForSingleObject(vOverlapped.hEvent, timeout_ms); if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT) { if (GetOverlappedResult(mFTHandle, &vOverlapped, &ulBytesWrite, FALSE)==FALSE) @@ -259,10 +257,10 @@ return ulBytesWrite; #else int actual = 0; - libusb_bulk_transfer(dev_handle, 0x02, wbuffer, length, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x02, wbuffer, length, &actual, timeout_ms); len = actual; #endif - delete wbuffer; + delete[] wbuffer; return len; } @@ -295,7 +293,7 @@ return -1;; } - DWORD dwRet = WaitForSingleObject(vOverlapped.hEvent, USB_TIMEOUT); + DWORD dwRet = WaitForSingleObject(vOverlapped.hEvent, timeout_ms); if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT) { if (GetOverlappedResult(mFTHandle, &vOverlapped, &ulBytesRead, FALSE)==FALSE) @@ -311,7 +309,7 @@ return ulBytesRead; #else int actual = 0; - libusb_bulk_transfer(dev_handle, 0x82, buffer, len, &actual, USB_TIMEOUT); + libusb_bulk_transfer(dev_handle, 0x82, buffer, len, &actual, timeout_ms); len = actual; #endif return len; @@ -411,7 +409,7 @@ if (length != rxSize) { rxSize = length; - FT_SetStreamPipe(mStreamRdEndPtAddr,rxSize); + FT_SetStreamPipe(mStreamRdEndPtAddr,rxSize); } unsigned int Timeout = 500; libusb_transfer *tr = contexts[i].transfer; @@ -445,7 +443,7 @@ int status = 0; #ifndef __unix__ contexts[contextHandle].inOvLap.InternalHigh = 0; - DWORD dwRet = WaitForSingleObject(contexts[contextHandle].inOvLap.hEvent, USB_TIMEOUT); + DWORD dwRet = WaitForSingleObject(contexts[contextHandle].inOvLap.hEvent, timeout_ms); if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT) return 1; #else @@ -482,7 +480,7 @@ if (GetOverlappedResult(mFTHandle, &contexts[contextHandle].inOvLap, &ulActualBytesTransferred, FALSE) == FALSE) { return -1; - } + } length = ulActualBytesTransferred; contexts[contextHandle].used = false; return length; @@ -493,7 +491,7 @@ return length; #endif } - else + else return 0; } @@ -524,7 +522,7 @@ } rxSize = 0; #else - + for(int i = 0; isettings.useVBO = true; mFFTpanel->AddSerie(new cDataSerie()); mFFTpanel->AddSerie(new cDataSerie()); @@ -114,7 +114,20 @@ txtNyquistFreqMHz->Disable(); cmbStreamType->Disable(); spinFFTsize->Disable(); + chkCaptureToFile->Disable(); mStreamRunning = true; + spinCaptureCount->Disable(); + cmbWindowFunc->Disable(); + bool capturing = chkCaptureToFile->IsChecked(); + string filename = ""; + if(capturing) + { + wxFileDialog dlg(this, _("Save samples file"), "", "", "Text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + if (dlg.ShowModal() == wxID_CANCEL) + capturing = false; + else + filename = dlg.GetPath().To8BitData(); + } switch (cmbStreamType->GetSelection()) { case 0: @@ -123,21 +136,28 @@ mStreamBrd = new StreamerNovena(mDataPort); else mStreamBrd = new LMS_StreamBoard(mDataPort); + mStreamBrd->SetWidowFunction(cmbWindowFunc->GetSelection()); + mStreamBrd->SetCaptureToFile(capturing, filename.c_str(), spinCaptureCount->GetValue()); mStreamBrd->StartReceiving(spinFFTsize->GetValue()); break; case 1: //SISO assert(mLTEstreamer == nullptr); mLTEstreamer = new StreamerLTE(mDataPort); + mLTEstreamer->SetWidowFunction(cmbWindowFunc->GetSelection()); + mLTEstreamer->SetCaptureToFile(capturing, filename.c_str(), spinCaptureCount->GetValue()); mLTEstreamer->StartStreaming(spinFFTsize->GetValue(), 1, StreamerLTE::STREAM_12_BIT_COMPRESSED); break; case 2: //MIMO assert(mLTEstreamer == nullptr); mLTEstreamer = new StreamerLTE(mDataPort); + mLTEstreamer->SetWidowFunction(cmbWindowFunc->GetSelection()); + mLTEstreamer->SetCaptureToFile(capturing, filename.c_str(), spinCaptureCount->GetValue()); mLTEstreamer->StartStreaming(spinFFTsize->GetValue(), 2, StreamerLTE::STREAM_12_BIT_COMPRESSED); break; case 3: //SISO uncompressed samples assert(mLTEstreamer == nullptr); mLTEstreamer = new StreamerLTE(mDataPort); + mLTEstreamer->SetWidowFunction(cmbWindowFunc->GetSelection()); mLTEstreamer->StartStreaming(spinFFTsize->GetValue(), 2, StreamerLTE::STREAM_12_BIT_IN_16); break; } @@ -174,6 +194,9 @@ btnStartStop->SetLabel(_("START")); cmbStreamType->Enable(); spinFFTsize->Enable(); + chkCaptureToFile->Enable(); + spinCaptureCount->Enable(); + cmbWindowFunc->Enable(); } void fftviewer_frFFTviewer::OnUpdatePlots(wxTimerEvent& event) @@ -239,7 +262,7 @@ freqs.reserve(data.fftBins_dbFS[0].size()); double nyquistMHz; txtNyquistFreqMHz->GetValue().ToDouble(&nyquistMHz); - const float step = 2*nyquistMHz / data.samplesI[0].size(); + const float step = 2*nyquistMHz / data.samplesI[0].size(); for (int i = 0; i < data.fftBins_dbFS[0].size(); ++i) freqs.push_back(1000000*(-nyquistMHz + (i+1)*step)); vector indexes; @@ -263,6 +286,41 @@ mFFTpanel->series[0]->AssignValues(&freqs[0], &data.fftBins_dbFS[0][0], data.fftBins_dbFS[0].size()); mFFTpanel->series[1]->AssignValues(&freqs[0], &data.fftBins_dbFS[1][0], data.fftBins_dbFS[1].size()); } + + float chPwr[2]; + double cFreq[2] = {0, 0}; + txtCenterOffset1->GetValue().ToDouble(&cFreq[0]); + cFreq[0] *= 1000000; + txtCenterOffset2->GetValue().ToDouble(&cFreq[1]); + cFreq[1] *= 1000000; + double bw[2] = {1e6, 1e6}; + txtBW1->GetValue().ToDouble(&bw[0]); + bw[0] *= 1000000; + txtBW2->GetValue().ToDouble(&bw[1]); + bw[1] *= 1000000; + char ctemp[512]; + for(int c=0; c<2; ++c) + { + float f0 = cFreq[c]-bw[c]/2; + float fn = cFreq[c]+bw[c]/2; + float sum = 0; + int bins = 0; + const int fftSize = data.fftBins[0].size(); + for(int i=0; iSetLabel(wxString::Format("%.3f", pwr1)); + float pwr2 = (chPwr[1] != 0 ? (20 * log10(chPwr[1])) - 69.2369 : -300); + lblPower2->SetLabel(wxString::Format("%.3f", pwr2)); + lbldBc->SetLabel(wxString::Format("%.3f", 20*log10(chPwr[1]/chPwr[0]))); } break; } @@ -341,3 +399,8 @@ mFFTpanel->series[0]->visible = visibilities[0]; mFFTpanel->series[1]->visible = visibilities[1]; } + +void fftviewer_frFFTviewer::OnbtnCaptureClick(wxCommandEvent& event) +{ + +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_frFFTviewer.h limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_frFFTviewer.h --- limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_frFFTviewer.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_frFFTviewer.h 2016-08-25 18:57:42.000000000 +0000 @@ -27,6 +27,7 @@ void OnWindowFunctionChanged( wxCommandEvent& event ); void OnbtnStartStop( wxCommandEvent& event ); void OnChannelVisibilityChange(wxCommandEvent& event); + void OnbtnCaptureClick(wxCommandEvent& event); void OnUpdatePlots(wxTimerEvent& event); public: diff -Nru limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.cpp limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.cpp --- limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -37,14 +37,8 @@ m_splitter3 = new wxSplitterWindow( mTimeConstellationPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D ); m_splitter3->Connect( wxEVT_IDLE, wxIdleEventHandler( frFFTviewer::m_splitter3OnIdle ), NULL, this ); - int GLCanvasAttributes_1[] = { - WX_GL_RGBA, - WX_GL_DOUBLEBUFFER, - WX_GL_DEPTH_SIZE, 16, - WX_GL_STENCIL_SIZE, 0, - 0, 0 }; - mTimeDomainPanel = new OpenGLGraph(m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _(""), GLCanvasAttributes_1); - mConstelationPanel = new OpenGLGraph(m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _(""), GLCanvasAttributes_1); + mTimeDomainPanel = new OpenGLGraph( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + mConstelationPanel = new OpenGLGraph( m_splitter3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_splitter3->SplitVertically( mTimeDomainPanel, mConstelationPanel, 0 ); fgSizer9->Add( m_splitter3, 1, wxEXPAND, 5 ); @@ -52,7 +46,7 @@ mTimeConstellationPanel->SetSizer( fgSizer9 ); mTimeConstellationPanel->Layout(); fgSizer9->Fit( mTimeConstellationPanel ); - mFFTpanel = new OpenGLGraph(mPlotsSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _(""), GLCanvasAttributes_1); + mFFTpanel = new OpenGLGraph( mPlotsSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); mPlotsSplitter->SplitHorizontally( mTimeConstellationPanel, mFFTpanel, 0 ); fgSizer7->Add( mPlotsSplitter, 1, wxEXPAND, 5 ); @@ -110,7 +104,7 @@ fgSizer91->SetFlexibleDirection( wxBOTH ); fgSizer91->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxString cmbStreamTypeChoices[] = { wxT("IQ samples"), wxT("LTE packets"), wxT("LTE packets MIMO"), wxT("LTE packets uncompressed") }; + wxString cmbStreamTypeChoices[] = { wxT("IQ samples"), wxT("LTE packets"), wxT("LTE packets MIMO") }; int cmbStreamTypeNChoices = sizeof( cmbStreamTypeChoices ) / sizeof( wxString ); cmbStreamType = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, cmbStreamTypeNChoices, cmbStreamTypeChoices, 0 ); cmbStreamType->SetSelection( 0 ); @@ -157,6 +151,45 @@ sbSizer2->Add( fgSizer12, 1, wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( sbSizer2->GetStaticBox(), wxID_ANY, wxT("Window function:") ), wxVERTICAL ); + + wxString cmbWindowFuncChoices[] = { wxT("Rectangular"), wxT("Blackman-harris"), wxT("Hamming"), wxT("Hanning") }; + int cmbWindowFuncNChoices = sizeof( cmbWindowFuncChoices ) / sizeof( wxString ); + cmbWindowFunc = new wxChoice( sbSizer6->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, cmbWindowFuncNChoices, cmbWindowFuncChoices, 0 ); + cmbWindowFunc->SetSelection( 0 ); + sbSizer6->Add( cmbWindowFunc, 0, wxEXPAND, 5 ); + + + sbSizer2->Add( sbSizer6, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer51; + sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( sbSizer2->GetStaticBox(), wxID_ANY, wxT("Capture to file") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer121; + fgSizer121 = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizer121->SetFlexibleDirection( wxBOTH ); + fgSizer121->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + chkCaptureToFile = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, wxT("Capture enable"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer121->Add( chkCaptureToFile, 0, 0, 5 ); + + + fgSizer121->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText12 = new wxStaticText( sbSizer51->GetStaticBox(), wxID_ANY, wxT("Samples to capture:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText12->Wrap( -1 ); + fgSizer121->Add( m_staticText12, 0, wxALL, 5 ); + + spinCaptureCount = new wxSpinCtrl( sbSizer51->GetStaticBox(), wxID_ANY, wxT("16384"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 30000000, 16384 ); + fgSizer121->Add( spinCaptureCount, 0, 0, 5 ); + + + sbSizer51->Add( fgSizer121, 1, wxEXPAND, 5 ); + + + sbSizer2->Add( sbSizer51, 0, wxTOP, 5 ); + fgSizer10->Add( sbSizer2, 1, wxEXPAND, 5 ); @@ -238,6 +271,81 @@ fgSizer10->Add( sbSizer5, 1, wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer7; + sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Measurement") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer122; + fgSizer122 = new wxFlexGridSizer( 0, 3, 5, 5 ); + fgSizer122->AddGrowableCol( 1 ); + fgSizer122->AddGrowableCol( 2 ); + fgSizer122->SetFlexibleDirection( wxBOTH ); + fgSizer122->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer122->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText13 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("Ch 1"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText13->Wrap( -1 ); + fgSizer122->Add( m_staticText13, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticText14 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("Ch 2"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14->Wrap( -1 ); + fgSizer122->Add( m_staticText14, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticText151 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("Center offset (MHz):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText151->Wrap( -1 ); + fgSizer122->Add( m_staticText151, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + txtCenterOffset1 = new wxTextCtrl( sbSizer7->GetStaticBox(), wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, 0 ); + txtCenterOffset1->SetMinSize( wxSize( 32,-1 ) ); + + fgSizer122->Add( txtCenterOffset1, 0, wxEXPAND, 5 ); + + txtCenterOffset2 = new wxTextCtrl( sbSizer7->GetStaticBox(), wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, 0 ); + txtCenterOffset2->SetMinSize( wxSize( 32,-1 ) ); + + fgSizer122->Add( txtCenterOffset2, 0, wxEXPAND, 5 ); + + m_staticText161 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("Bandwidth (MHz):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText161->Wrap( -1 ); + fgSizer122->Add( m_staticText161, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + txtBW1 = new wxTextCtrl( sbSizer7->GetStaticBox(), wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, 0 ); + txtBW1->SetMinSize( wxSize( 32,-1 ) ); + + fgSizer122->Add( txtBW1, 0, wxEXPAND, 5 ); + + txtBW2 = new wxTextCtrl( sbSizer7->GetStaticBox(), wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, 0 ); + txtBW2->SetMinSize( wxSize( 32,-1 ) ); + + fgSizer122->Add( txtBW2, 0, wxEXPAND, 5 ); + + m_staticText17 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("Power(dbFS):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText17->Wrap( -1 ); + fgSizer122->Add( m_staticText17, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + lblPower1 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("???"), wxDefaultPosition, wxDefaultSize, 0 ); + lblPower1->Wrap( -1 ); + fgSizer122->Add( lblPower1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + lblPower2 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("???"), wxDefaultPosition, wxDefaultSize, 0 ); + lblPower2->Wrap( -1 ); + fgSizer122->Add( lblPower2, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText20 = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("dBc"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText20->Wrap( -1 ); + fgSizer122->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + lbldBc = new wxStaticText( sbSizer7->GetStaticBox(), wxID_ANY, wxT("???"), wxDefaultPosition, wxDefaultSize, 0 ); + lbldBc->Wrap( -1 ); + fgSizer122->Add( lbldBc, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer7->Add( fgSizer122, 1, wxEXPAND|wxLEFT, 5 ); + + + fgSizer10->Add( sbSizer7, 1, wxEXPAND, 5 ); + fgSizer7->Add( fgSizer10, 1, wxEXPAND, 5 ); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.fbp limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.fbp --- limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.fbp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.fbp 2016-08-25 18:57:42.000000000 +0000 @@ -1004,11 +1004,11 @@ - + 5 wxEXPAND 1 - + wxID_ANY Data reading @@ -1016,11 +1016,11 @@ wxVERTICAL none - + 5 wxEXPAND 1 - + 2 wxBOTH @@ -1048,11 +1048,11 @@ none 0 0 - + 5 0 - + 1 1 1 @@ -1066,7 +1066,7 @@ 1 0 - "IQ samples" "LTE packets" "LTE packets MIMO" "LTE packets uncompressed" + "IQ samples" "LTE packets" "LTE packets MIMO" 1 1 @@ -1226,11 +1226,11 @@ - + 5 wxEXPAND 1 - + 2 wxBOTH @@ -1408,11 +1408,11 @@ - + 5 0 - + 1 1 1 @@ -1491,11 +1491,11 @@ - + 5 0 - + 1 1 1 @@ -1744,217 +1744,23 @@ - - - - 5 - wxEXPAND - 1 - - wxID_ANY - Graphs - - sbSizer3 - wxVERTICAL - none - 5 wxEXPAND - 1 - - 1 - wxBOTH - - - 0 + 0 + + wxID_ANY + Window function: - fgSizer14 - wxFLEX_GROWMODE_SPECIFIED + sbSizer6 + wxVERTICAL none - 0 - 0 - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Freeze time - - 0 - - - 0 - - 1 - chkFreezeTimeDomain - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Freezes time domain plot - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Freeze constellation - - 0 - - - 0 - - 1 - chkFreezeConstellation - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Freezes constellation plot - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 5 - + wxEXPAND 0 - + 1 1 1 @@ -1968,7 +1774,7 @@ 1 0 - 0 + "Rectangular" "Blackman-harris" "Hamming" "Hanning" 1 1 @@ -1983,7 +1789,6 @@ 0 0 wxID_ANY - Freeze FFT 0 @@ -1991,7 +1796,7 @@ 0 1 - chkFreezeFFT + cmbWindowFunc 1 @@ -1999,12 +1804,13 @@ 1 Resizable + 0 1 0 - Freezes FFT plot + wxFILTER_NONE wxDefaultValidator @@ -2013,7 +1819,7 @@ - + @@ -2038,6 +1844,20 @@ + + + + 5 + wxTOP + 0 + + wxID_ANY + Capture to file + + sbSizer51 + wxVERTICAL + none + 5 wxEXPAND @@ -2049,16 +1869,16 @@ 0 - fgSizer101 + fgSizer121 wxFLEX_GROWMODE_SPECIFIED none 0 0 - + 5 - wxALL + 0 - + 1 1 1 @@ -2072,6 +1892,7 @@ 1 0 + 0 1 1 @@ -2086,7 +1907,7 @@ 0 0 wxID_ANY - Channel: + Capture enable 0 @@ -2094,7 +1915,7 @@ 0 1 - m_staticText11 + chkCaptureToFile 1 @@ -2108,11 +1929,15 @@ 0 + + wxFILTER_NONE + wxDefaultValidator + - -1 + @@ -2137,11 +1962,21 @@ - + 5 - + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL 0 - + 1 1 1 @@ -2155,7 +1990,6 @@ 1 0 - "A" "B" "A&B" 1 1 @@ -2170,6 +2004,7 @@ 0 0 wxID_ANY + Samples to capture: 0 @@ -2177,7 +2012,7 @@ 0 1 - cmbChannelVisibility + m_staticText12 1 @@ -2185,22 +2020,102 @@ 1 Resizable - 0 1 0 - - wxFILTER_NONE - wxDefaultValidator - + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 16384 + 30000000 + + 0 + + 0 + + 0 + + 1 + spinCaptureCount + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + 16384 - OnChannelVisibilityChange @@ -2222,6 +2137,9 @@ + + + @@ -2231,39 +2149,39 @@ - + 5 wxEXPAND 1 - + wxID_ANY - Buffers status + Graphs - sbSizer5 + sbSizer3 wxVERTICAL none - + 5 wxEXPAND 1 - - 2 + + 1 wxBOTH - 1 + - 5 + 0 - fgSizer19 + fgSizer14 wxFLEX_GROWMODE_SPECIFIED none 0 - 5 - + 0 + 5 - wxALIGN_CENTER_VERTICAL + 0 - + 1 1 1 @@ -2277,6 +2195,7 @@ 1 0 + 0 1 1 @@ -2291,7 +2210,7 @@ 0 0 wxID_ANY - Rx: + Freeze time 0 @@ -2299,7 +2218,7 @@ 0 1 - m_staticText15 + chkFreezeTimeDomain 1 @@ -2312,12 +2231,16 @@ 0 - + Freezes time domain plot + + wxFILTER_NONE + wxDefaultValidator + - -1 + @@ -2342,11 +2265,11 @@ - + 5 - wxEXPAND - 1 - + + 0 + 1 1 1 @@ -2360,6 +2283,7 @@ 1 0 + 0 1 1 @@ -2374,6 +2298,7 @@ 0 0 wxID_ANY + Freeze constellation 0 @@ -2381,30 +2306,29 @@ 0 1 - gaugeRxBuffer + chkFreezeConstellation 1 protected 1 - 100 Resizable 1 - wxGA_HORIZONTAL + 0 - + Freezes constellation plot wxFILTER_NONE wxDefaultValidator - 0 + @@ -2429,11 +2353,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL + 0 - + 1 1 1 @@ -2447,6 +2371,7 @@ 1 0 + 0 1 1 @@ -2461,7 +2386,7 @@ 0 0 wxID_ANY - Tx: + Freeze FFT 0 @@ -2469,7 +2394,7 @@ 0 1 - m_staticText16 + chkFreezeFFT 1 @@ -2482,12 +2407,16 @@ 0 - + Freezes FFT plot + + wxFILTER_NONE + wxDefaultValidator + - -1 + @@ -2512,68 +2441,1695 @@ - + 5 wxEXPAND 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 + + 2 + wxBOTH + + + 0 - 1 - gaugeTxBuffer - 1 - - - protected - 1 - - 100 - Resizable - 1 - - wxGA_HORIZONTAL - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - + fgSizer101 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Channel: + + 0 + + + 0 + + 1 + m_staticText11 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "A" "B" "A&B" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + cmbChannelVisibility + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnChannelVisibilityChange + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Buffers status + + sbSizer5 + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + 1 + + 5 + + fgSizer19 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Rx: + + 0 + + + 0 + + 1 + m_staticText15 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + gaugeRxBuffer + 1 + + + protected + 1 + + 100 + Resizable + 1 + + wxGA_HORIZONTAL + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Tx: + + 0 + + + 0 + + 1 + m_staticText16 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + gaugeTxBuffer + 1 + + + protected + 1 + + 100 + Resizable + 1 + + wxGA_HORIZONTAL + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Measurement + + sbSizer7 + wxVERTICAL + none + + + 5 + wxEXPAND|wxLEFT + 1 + + 3 + wxBOTH + 1,2 + + 5 + + fgSizer122 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ch 1 + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ch 2 + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Center offset (MHz): + + 0 + + + 0 + + 1 + m_staticText151 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 32,-1 + 1 + txtCenterOffset1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 32,-1 + 1 + txtCenterOffset2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Bandwidth (MHz): + + 0 + + + 0 + + 1 + m_staticText161 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 32,-1 + 1 + txtBW1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 32,-1 + 1 + txtBW2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Power(dbFS): + + 0 + + + 0 + + 1 + m_staticText17 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + ??? + + 0 + + + 0 + + 1 + lblPower1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + ??? + + 0 + + + 0 + + 1 + lblPower2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dBc + + 0 + + + 0 + + 1 + m_staticText20 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + ??? + + 0 + + + 0 + + 1 + lbldBc + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 diff -Nru limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.h limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.h --- limesuite-16.6.6.818.730.60b8d25/src/fftviewer_wxgui/fftviewer_wxgui.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/fftviewer_wxgui/fftviewer_wxgui.h 2016-08-25 18:57:42.000000000 +0000 @@ -59,6 +59,10 @@ wxStaticText* lblTxDataRate; wxStaticText* m_staticText10; wxStaticText* lblFFTrate; + wxChoice* cmbWindowFunc; + wxCheckBox* chkCaptureToFile; + wxStaticText* m_staticText12; + wxSpinCtrl* spinCaptureCount; wxCheckBox* chkFreezeTimeDomain; wxCheckBox* chkFreezeConstellation; wxCheckBox* chkFreezeFFT; @@ -68,6 +72,19 @@ wxGauge* gaugeRxBuffer; wxStaticText* m_staticText16; wxGauge* gaugeTxBuffer; + wxStaticText* m_staticText13; + wxStaticText* m_staticText14; + wxStaticText* m_staticText151; + wxTextCtrl* txtCenterOffset1; + wxTextCtrl* txtCenterOffset2; + wxStaticText* m_staticText161; + wxTextCtrl* txtBW1; + wxTextCtrl* txtBW2; + wxStaticText* m_staticText17; + wxStaticText* lblPower1; + wxStaticText* lblPower2; + wxStaticText* m_staticText20; + wxStaticText* lbldBc; // Virtual event handlers, overide them in your derived class virtual void OnFFTsamplesCountChanged( wxSpinEvent& event ) { event.Skip(); } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.cpp limesuite-16.8.1.819.792.4165104/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.cpp --- limesuite-16.6.6.818.730.60b8d25/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include "LMS_StreamBoard.h" +#include "StreamerLTE.h" using namespace std; using namespace lime; @@ -88,6 +89,8 @@ btnLoadWCDMA = new wxToggleButton(this, ID_BUTTON7, _T("W-CDMA"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON7")); btnLoadWCDMA->SetToolTip(_T("Loads file named wcdma.wfm from ") + gWFMdirectory + _("directory")); FlexGridSizer8->Add(btnLoadWCDMA, 1, wxALIGN_LEFT|wxALIGN_TOP, 5); + chkMIMO = new wxCheckBox(this, wxNewId(), _("MIMO")); + FlexGridSizer8->Add(chkMIMO, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_TOP, 5); FlexGridSizer6->Add(FlexGridSizer8, 1, wxALIGN_LEFT|wxALIGN_TOP, 5); FlexGridSizer10 = new wxFlexGridSizer(0, 3, 0, 5); FlexGridSizer10->AddGrowableCol(2); @@ -238,15 +241,15 @@ void FPGAcontrols_wxgui::OnbtnPlayWFMClick(wxCommandEvent& event) { assert(mStreamer != nullptr); - uint16_t regData = mStreamer->Reg_read(0x000A); - mStreamer->Reg_write(0x000A, regData | 0x3); + uint16_t regData = mStreamer->Reg_read(0x000D); + mStreamer->Reg_write(0x000D, regData | 0x2); } void FPGAcontrols_wxgui::OnbtnStopWFMClick(wxCommandEvent& event) { assert(mStreamer != nullptr); - uint16_t regData = mStreamer->Reg_read(0x000A); - mStreamer->Reg_write(0x000A, (regData & ~0x2)); + uint16_t regData = mStreamer->Reg_read(0x000D); + mStreamer->Reg_write(0x000D, (regData & ~0x2)); } int FPGAcontrols_wxgui::UploadFile(const wxString &filename) @@ -272,52 +275,71 @@ wxMessageBox(_("File not found ") + filename, _("Error")); return -1; } - int bufferSize = isamples.size() * 2; //IQ samples interleaved - int16_t *buffer = new int16_t[bufferSize]; - memset(buffer, 0, bufferSize); - int bufPos = 0; - for(unsigned i=0; iSetRange(outLen/packetSize+1); + progressBar->SetRange(isamples.size()); progressBar->SetValue(0); - int sent = 0; bool success = true; btnPlayWFM->Enable(false); btnStopWFM->Enable(false); - uint16_t regData = mStreamer->Reg_read(0x000A); - mStreamer->Reg_write(0x000A, regData & ~0x7); + int chCount = 2; + bool MIMO = chkMIMO->IsChecked(); + mStreamer->Reg_write(0x000C, 0x3); //channels 0,1 + + mStreamer->Reg_write(0x000E, 0x2); //12bit samples + mStreamer->Reg_write(0x000D, 0x0004); //WFM_LOAD + + PacketLTE pkt; + int samplesUsed = 0; - while(sent packetSize ? packetSize : outLen-sent; - long toSend = toSendBytes; - int context = m_serPort->BeginDataSending(&outBuf[sent], toSend); - if(m_serPort->WaitForSending(context, 5000) == false) + pkt.counter = 0; + pkt.reserved[0] = 0; + int bufPos = 0; + for(int i=0; i<1360/chCount && samplesUsed < isamples.size(); ++i) + { + for(int ch = 0; ch < chCount; ++ch) + { + if(MIMO == false && ch > 0) + { + pkt.data[bufPos] = 0; + pkt.data[bufPos + 1] = 0; + pkt.data[bufPos + 2] = 0; + bufPos += 3; + continue; + } + pkt.data[bufPos] = isamples[samplesUsed] & 0xFF; + pkt.data[bufPos+1] = (isamples[samplesUsed] >> 8) & 0x0F; + pkt.data[bufPos+1] |= (qsamples[samplesUsed] << 4) & 0xF0; + pkt.data[bufPos+2] = (qsamples[samplesUsed] >> 4) & 0xFF; + bufPos += 3; + } + ++samplesUsed; + } + int payloadSize = (bufPos / 4) * 4; + if(bufPos % 4 != 0) + printf("Packet samples count not multiple of 4\n"); + pkt.reserved[2] = (payloadSize >> 8) & 0xFF; //WFM loading + pkt.reserved[1] = payloadSize & 0xFF; //WFM loading + pkt.reserved[0] = 0x1 << 5; //WFM loading + + long bToSend = 16+payloadSize; + int context = m_serPort->BeginDataSending((char*)&pkt, bToSend ); + if(m_serPort->WaitForSending(context, 250) == false) { success = false; - m_serPort->FinishDataSending(&outBuf[sent], toSend, context); + m_serPort->FinishDataSending((char*)&pkt, bToSend , context); break; } - m_serPort->FinishDataSending(&outBuf[sent], toSend, context); - sent += toSendBytes; - progressBar->SetValue(progressBar->GetValue()+1); - lblProgressPercent->SetLabel(wxString::Format(_("%3.0f%%"), 100.0*sent/outLen)); + m_serPort->FinishDataSending((char*)&pkt, bToSend , context); + progressBar->SetValue(samplesUsed); + lblProgressPercent->SetLabel(wxString::Format(_("%3.0f%%"), 100.0*samplesUsed/isamples.size())); wxYield(); } progressBar->SetValue(progressBar->GetRange()); lblProgressPercent->SetLabelText(_("100%")); - - regData = mStreamer->Reg_read(0x000A); - mStreamer->Reg_write(0x000A, regData | 0x6); + mStreamer->Reg_write(0x000D, 0x0002); //WFM_PLAY btnPlayWFM->Enable(true); btnStopWFM->Enable(true); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.h limesuite-16.8.1.819.792.4165104/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.h --- limesuite-16.6.6.818.730.60b8d25/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/FPGAcontrols_wxgui/FPGAcontrols_wxgui.h 2016-08-25 18:57:42.000000000 +0000 @@ -46,6 +46,7 @@ wxButton* btnStartStreaming; wxButton* btnStopStreaming; wxCheckBox* chkDigitalLoopbackEnable; + wxCheckBox* chkMIMO; protected: static const long ID_BUTTON6; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/LimeUtil.cpp limesuite-16.8.1.819.792.4165104/src/LimeUtil.cpp --- limesuite-16.6.6.818.730.60b8d25/src/LimeUtil.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/LimeUtil.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -11,6 +11,9 @@ #include #include #include +#include +#include "ErrorReporting.h" +#include "LMS64CProtocol.h" using namespace lime; @@ -25,6 +28,8 @@ std::cout << " --info \t\t\t\t Print module information" << std::endl; std::cout << " --find[=\"module=foo,serial=bar\"] \t Discover available devices" << std::endl; std::cout << " --make[=\"module=foo,serial=bar\"] \t Create a device instance" << std::endl; + std::cout << " --fpga=\"filename\" \t\t\t Program FPGA gateware to flash" << std::endl; + std::cout << " --fw=\"filename\" \t\t\t Program FX3 firmware to flash" << std::endl; std::cout << std::endl; return EXIT_SUCCESS; } @@ -103,6 +108,118 @@ } /*********************************************************************** + * Program gateware + **********************************************************************/ +static int programGateware(void) +{ + //load file + std::ifstream file; + file.open(optarg, std::ios::in | std::ios::binary); + if(not file.good()) + { + std::cout << "File not found: " << optarg << std::endl; + return EXIT_FAILURE; + } + + std::streampos fileSize; + file.seekg(0, std::ios::end); + fileSize = file.tellg(); + file.seekg(0, std::ios::beg); + std::vector progData(fileSize, 0); + file.read(progData.data(), fileSize); + + auto handles = ConnectionRegistry::findConnections(); + if(handles.size() == 0) + { + std::cout << "No devices found" << std::endl; + return EXIT_FAILURE; + } + std::cout << "Connected to [" << handles[0].serialize() << "]" << std::endl; + auto conn = ConnectionRegistry::makeConnection(handles[0]); + + auto progCallback = [](int bsent, int btotal, const char* progressMsg) + { + printf("[%3i%%] %5i/%5i Bytes %s\r", int(100.0*bsent/btotal+0.5), bsent, btotal, progressMsg); + return 0; + }; + + int device = LMS64CProtocol::FPGA; //Altera FPGA + int progMode = 1; //Bitstream to FLASH + auto status = conn->ProgramWrite(progData.data(), progData.size(), progMode, device, progCallback); + + std::cout << std::endl; + if(status == 0) + { + //boot from FLASH + status = conn->ProgramWrite(nullptr, 0, 2, device, nullptr); + if(status == 0) + std::cout << "FPGA boot from FLASH completed!" << std::endl; + else + std::cout << "FPGA boot from FLASH failed!"<< GetLastErrorMessage() << std::endl; + } + else + std::cout << "Programming failed! : " << GetLastErrorMessage() << std::endl; + ConnectionRegistry::freeConnection(conn); + return EXIT_SUCCESS; +} + +/*********************************************************************** + * Program gateware + **********************************************************************/ +static int programFirmware(void) +{ + //load file + std::ifstream file; + file.open(optarg, std::ios::in | std::ios::binary); + if(not file.good()) + { + std::cout << "File not found: " << optarg << std::endl; + return EXIT_FAILURE; + } + + std::streampos fileSize; + file.seekg(0, std::ios::end); + fileSize = file.tellg(); + file.seekg(0, std::ios::beg); + std::vector progData(fileSize, 0); + file.read(progData.data(), fileSize); + + auto handles = ConnectionRegistry::findConnections(); + if(handles.size() == 0) + { + std::cout << "No devices found" << std::endl; + return EXIT_FAILURE; + } + std::cout << "Connected to [" << handles[0].serialize() << "]" << std::endl; + auto conn = ConnectionRegistry::makeConnection(handles[0]); + + auto progCallback = [](int bsent, int btotal, const char* progressMsg) + { + printf("[%3i%%] %5i/%5i Bytes %s\r", int(100.0*bsent/btotal+0.5), bsent, btotal, progressMsg); + return 0; + }; + + int device = LMS64CProtocol::FX3; //FX3 + int progMode = 2; //Firmware to FLASH + auto status = conn->ProgramWrite(progData.data(), progData.size(), progMode, device, progCallback); + + std::cout << std::endl; + if(status == 0) + { + //Reset device + status = conn->ProgramWrite(nullptr, 0, 0, device, nullptr); + if(status == 0) + std::cout << "FX3 firmware uploaded, device has been reset" << std::endl; + else + std::cout << "FX3 firmware uploaded, failed to reset device" << std::endl; + } + else + std::cout << "Programming failed! : " << GetLastErrorMessage() << std::endl; + ConnectionRegistry::freeConnection(conn); + return EXIT_SUCCESS; +} + +/*********************************************************************** * main entry point **********************************************************************/ int main(int argc, char *argv[]) @@ -112,6 +229,8 @@ {"info", optional_argument, 0, 'i'}, {"find", optional_argument, 0, 'f'}, {"make", optional_argument, 0, 'm'}, + {"fpga", required_argument, 0, 'g'}, + {"fw", required_argument, 0, 'w'}, {0, 0, 0, 0} }; int long_index = 0; @@ -124,6 +243,8 @@ case 'i': return printInfo(); case 'f': return findDevices(); case 'm': return makeDevice(); + case 'g': return programGateware(); + case 'w': return programFirmware(); } } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m/goert.cpp limesuite-16.8.1.819.792.4165104/src/lms7002m/goert.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m/goert.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m/goert.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -37,13 +37,14 @@ int64_t resize_int(int64_t x, int16_t n) { - int64_t mask = ~(0xFFFFFFFFFFFFFFFF << n-1); - int64_t sign = (x >> n+1) & ~mask; + /*int64_t mask = ~(0xFFFFFFFFFFFFFFFF << (n-1)); + int64_t sign = (x >> (n+1)) & ~mask; // print out masks /*cout << hex << setw(16) << right << setfill('0') << sign << " | "; cout << hex << setw(16) << right << setfill('0') << mask << endl;*/ - return sign + (mask & x); + return x; //sign + (mask & x); } + #include void checkForMinMax(int64_t lr, int64_t & lr_min, int64_t & lr_max) { @@ -58,10 +59,10 @@ { const int16_t a = 0; const int16_t b = 0; - const int16_t register_length = 32; - const int16_t trig_length = 16; + const int16_t register_length = 64; + const int16_t trig_length = 15; const int16_t mul_length = register_length+trig_length-a-b; - const int16_t add_length = register_length+2; + const int16_t add_length = register_length+1; memset(real, Sp, sizeof(int64_t)*Sp); memset(imag, Sp, sizeof(int64_t)*Sp); @@ -81,7 +82,7 @@ li2_min = LLONG_MAX; li2_max = LLONG_MIN; #endif - int64_t c, s; // cosine and sine 16 bits registers + int16_t c, s; // cosine and sine 16 bits registers int16_t x_n; // sample (bin) int64_t lr1, lr2, li1, li2, temp; // algorithm registers @@ -91,9 +92,12 @@ int n, k; // loop variables // Prepare for computation - wn = PI/Sp; + wn = PI / Sp; // Loop through all the bins //for(k=0; k> a) * (lr1 >> b); mul = resize_int(mul, mul_length); - mul = (mul >> trig_length-a-b-2); + mul = (mul >> (trig_length-a-b-1)) << 1; lr1 = resize_int(mul, add_length) - resize_int(lr2, add_length) + resize_int(x_n, add_length); lr2 = temp; @@ -132,7 +135,7 @@ mul = (c >> a) * (li1 >> b); mul = resize_int(mul, mul_length); - mul = (mul >> trig_length-a-b-2); + mul = (mul >> (trig_length-a-b-1)) << 1; li1 = resize_int(mul, add_length) - resize_int(li2, add_length) + resize_int(x_n, add_length); li2 = temp; @@ -142,8 +145,8 @@ #endif li1 = resize_int(li1, register_length); } - real[k] = (int64_t)( resize_int( resize_int( (c >> a)*(lr1 >> b), mul_length) >> trig_length-a-b-1, add_length) - resize_int(lr2, add_length) - resize_int( resize_int((s >> a) * (li1 >> b), mul_length )>> trig_length-a-b-1, add_length) ); - imag[k] = (int64_t)( resize_int( resize_int( (c >> a)*(li1 >> b), mul_length) >> trig_length-a-b-1, add_length) - resize_int(li2, add_length) + resize_int( resize_int((s >> a) * (lr1 >> b), mul_length )>> trig_length-a-b-1, add_length) ); + real[k] = (int64_t)( resize_int( resize_int( (c >> a)*(lr1 >> b), mul_length) >> (trig_length-a-b-1), add_length) - resize_int(lr2, add_length) - resize_int( resize_int((s >> a) * (li1 >> b), mul_length )>> (trig_length-a-b-1), add_length) ); + imag[k] = (int64_t)( resize_int( resize_int( (c >> a)*(li1 >> b), mul_length) >> (trig_length-a-b-1), add_length) - resize_int(li2, add_length) + resize_int( resize_int((s >> a) * (lr1 >> b), mul_length )>> (trig_length-a-b-1), add_length) ); } #ifdef DEBUG_MODE /* diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M.cpp limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -100,7 +100,7 @@ /** @brief Sets connection which is used for data communication with chip */ -void LMS7002M::SetConnection(IConnection* port, const size_t devIndex) +void LMS7002M::SetConnection(IConnection* port, const size_t devIndex, IConnection* samplesPort) { controlPort = port; mdevIndex = devIndex; @@ -110,6 +110,10 @@ addrLMS7002M = controlPort->GetDeviceInfo().addrsLMS7002M.at(devIndex); mcuControl->Initialize(port); } + if(samplesPort == nullptr) + dataPort = controlPort; + else + dataPort = samplesPort; } /** @brief Creates LMS7002M main control object. @@ -117,6 +121,7 @@ */ LMS7002M::LMS7002M() : controlPort(nullptr), + dataPort(nullptr), addrLMS7002M(-1), mdevIndex(0), mSelfCalDepth(0), @@ -923,6 +928,7 @@ case PATH_RFE_LNAH: case PATH_RFE_LNAL: case PATH_RFE_LNAW: pd_lna_rfe = 0; break; + default: break; } int pd_rloopb_1_rfe = (path == PATH_RFE_LB1)?0:1; @@ -981,6 +987,7 @@ void LMS7002M::UpdateExternalBandSelect(void) { + if(controlPort) return controlPort->UpdateExternalBandSelect( this->GetActiveChannelIndex(), this->GetBandTRF(), @@ -1148,14 +1155,17 @@ */ int LMS7002M::TuneVCO(VCO_Module module) // 0-cgen, 1-SXR, 2-SXT { + struct CSWInteval + { + int16_t high; + int16_t low; + }; + CSWInteval cswSearch[2]; stringstream ss; //tune progress report int16_t csw = 0; const char* moduleName = (module == VCO_CGEN) ? "CGEN" : ((module == VCO_SXR) ? "SXR" : "SXT"); checkConnection(); - int8_t i; uint8_t cmphl; //comparators - uint16_t csw_highest; - int16_t csw_lowest = -1; uint16_t addrVCOpd; // VCO power down address uint16_t addrCSW_VCO; uint16_t addrCMP; //comparator address @@ -1183,71 +1193,84 @@ addrCMP = LMS7param(VCO_CMPHO_CGEN).address; ss << "ICT_VCO_CGEN: " << Get_SPI_Reg_bits(ICT_VCO_CGEN) << endl; } - // Initialization - int status = Modify_SPI_Reg_bits (addrVCOpd, 2, 1, 0); //activate VCO and comparator - if(status != 0) + // Initialization activate VCO and comparator + if(int status = Modify_SPI_Reg_bits (addrVCOpd, 2, 1, 0) != 0) return status; if (Get_SPI_Reg_bits(addrVCOpd, 2, 1) != 0) return ReportError(-1, "TuneVCO(%s) - VCO is powered down", moduleName); - Modify_SPI_Reg_bits (addrCSW_VCO , msb, lsb , 0); //Set SWC_VCO<7:0>=<00000000> - i=7; - while(i>=0) + //search intervals [0-127][128-255] + for(int t=0; t<2; ++t) { - csw |= 1 << i; - Modify_SPI_Reg_bits (addrCSW_VCO, lsb + i, lsb + i, 1); // CSW_VCO=1 - std::this_thread::sleep_for(std::chrono::milliseconds(5)); - cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); - ss << "csw=" << csw << "\t" << "cmphl=" << (int16_t)cmphl << endl; - if ( (cmphl&0x01) == 1) // reduce CSW + cswSearch[t].low = 128*(t+1); + cswSearch[t].high = 128*t; //search interval lowest value + Modify_SPI_Reg_bits (addrCSW_VCO , msb, lsb , cswSearch[t].high); + for(int i=6; i>=0; --i) { - Modify_SPI_Reg_bits (addrCSW_VCO, lsb + i, lsb + i, 0); // CSW_VCO=0 - csw &= ~(1 << i); + cswSearch[t].high |= 1 << i; //CSW_VCO=1 + Modify_SPI_Reg_bits (addrCSW_VCO, msb, lsb, cswSearch[t].high); + //might need delay depending on communication speed + //std::this_thread::sleep_for(std::chrono::microseconds(5)); + cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); + ss << "csw=" << cswSearch[t].high << "\t" << "cmphl=" << (int16_t)cmphl << endl; + if(cmphl & 0x01) // reduce CSW + cswSearch[t].high &= ~(1 << i); //CSW_VCO=0 + if(cmphl == 2 && cswSearch[t].high < cswSearch[t].low) + cswSearch[t].low = cswSearch[t].high; } - if( cmphl == 2 && csw_lowest < 0) - csw_lowest = Get_SPI_Reg_bits(addrCSW_VCO, msb, lsb); - --i; - } - if(csw_lowest >= 0) - { - csw_highest = Get_SPI_Reg_bits(addrCSW_VCO, msb, lsb); - if(csw_lowest == csw_highest) + while(cswSearch[t].low <= cswSearch[t].high && cswSearch[t].low > t*128) { - while(csw_lowest>=0) + --cswSearch[t].low; + Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, cswSearch[t].low); + //might need delay depending on communication speed + //std::this_thread::sleep_for(std::chrono::microseconds(5)); + if(Get_SPI_Reg_bits(addrCMP, 13, 12, true) != 2) { - Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, csw_lowest); - std::this_thread::sleep_for(std::chrono::milliseconds(5)); - if(Get_SPI_Reg_bits(addrCMP, 13, 12, true) == 0) - { - ++csw_lowest; - break; - } - else - --csw_lowest; + ++cswSearch[t].low; + break; } } - Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, csw_lowest+(csw_highest-csw_lowest)/2); - ss << "CSW_lowest =" << csw_lowest << endl; - ss << "CSW_highest =" << csw_highest << endl; - ss << "CSW_selected=" << csw_lowest+(csw_highest-csw_lowest)/2; + if(cmphl == 2) + { + ss << "CSW_lowest =" << cswSearch[t].low << endl; + ss << "CSW_highest =" << cswSearch[t].high << endl; + ss << "CSW_selected=" << cswSearch[t].low+(cswSearch[t].high-cswSearch[t].low)/2 << endl; + } + else + ss << "Failed to lock" << endl; } - cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); - ss << " cmphl=" << (uint16_t)cmphl; - this->SetActiveChannel(ch); //restore previously used channel + //check if the intervals are joined + int16_t cswHigh, cswLow; + if(cswSearch[0].high == cswSearch[1].low-1) + { + cswHigh = cswSearch[1].high; + cswLow = cswSearch[0].low; + } + //compare which interval is wider + else + { + uint8_t intervalIndex = (cswSearch[1].high-cswSearch[1].low > cswSearch[0].high-cswSearch[0].low); + cswHigh = cswSearch[intervalIndex].high; + cswLow = cswSearch[intervalIndex].low; + } - if(csw_highest-csw_lowest == 1) + if(cswHigh-cswLow == 1) { - //check both values, comparators might have changed after SPDUP_VCO toggle - Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, csw_lowest); - cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); - if(cmphl == 2) - return 0; - Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, csw_highest); + //check which of two values really locks + Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, cswLow); cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); + if(cmphl != 2) + Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, cswHigh); } - if(cmphl == 2) return 0; + else + Modify_SPI_Reg_bits(addrCSW_VCO, msb, lsb, cswLow+(cswHigh-cswLow)/2); + cmphl = (uint8_t)Get_SPI_Reg_bits(addrCMP, 13, 12, true); + ss << " cmphl=" << (uint16_t)cmphl; + this->SetActiveChannel(ch); //restore previously used channel + if(cmphl == 2) + return 0; return ReportError(EINVAL, "TuneVCO(%s) - failed to lock (cmphl != 2)\n%s", moduleName, ss.str().c_str()); } @@ -1415,10 +1438,11 @@ { Modify_SPI_Reg_bits(LMS7param(SEL_VCO), sel_vco); int status = TuneVCO(tx ? VCO_SXT : VCO_SXR); - int csw = Get_SPI_Reg_bits(LMS7param(CSW_VCO), true); - tuneScore[sel_vco] = -128 + csw; - if (status == 0) + if(status == 0) + { + tuneScore[sel_vco] = -128 + Get_SPI_Reg_bits(LMS7param(CSW_VCO), true); canDeliverFrequency = true; + } ss << vcoNames[sel_vco] << " : csw=" << tuneScore[sel_vco]+128 << " "; ss << (status == 0 ? "tune ok" : "tune fail") << endl; } @@ -1489,8 +1513,10 @@ if(index > 15) return ReportError(ERANGE, "SetNCOFrequency(index = %d) - index out of range [0, 15]", int(index)); float_type refClk_Hz = GetReferenceClk_TSP(tx); + if(freq_Hz < 0 || freq_Hz/refClk_Hz > 0.5) + return ReportError(ERANGE, "SetNCOFrequency(index = %d) - Frequency(%g MHz) out of range [0-%g) MHz", int(index), freq_Hz/1e6, refClk_Hz/2e6); uint16_t addr = tx ? 0x0240 : 0x0440; - uint32_t fcw = int32_t((freq_Hz/refClk_Hz)*4294967296); + uint32_t fcw = uint32_t((freq_Hz/refClk_Hz)*4294967296); SPI_write(addr+2+index*2, (fcw >> 16)); //NCO frequency control word register MSB part. SPI_write(addr+3+index*2, fcw); //NCO frequency control word register LSB part. return 0; @@ -1511,7 +1537,7 @@ uint32_t fcw = 0; fcw |= SPI_read(addr + 2 + index * 2, fromChip) << 16; //NCO frequency control word register MSB part. fcw |= SPI_read(addr + 3 + index * 2, fromChip); //NCO frequency control word register LSB part. - return refClk_Hz*(int32_t(fcw)/4294967296.0); + return refClk_Hz*(fcw/4294967296.0); } /** @brief Sets chosen NCO phase offset angle when memory table MODE is 0 @@ -1701,7 +1727,7 @@ //write which register cache based on MAC bits //or always when below the MAC mapped register space bool wr0 = ((mac & 0x1) != 0) or (spiAddr[i] < 0x0100); - bool wr1 = ((mac & 0x2) != 0) or (spiAddr[i] < 0x0100); + bool wr1 = ((mac & 0x2) != 0) and (spiAddr[i] >= 0x0100); if (wr0) mRegistersMap->SetValue(0, spiAddr[i], spiData[i]); if (wr1) mRegistersMap->SetValue(1, spiAddr[i], spiData[i]); @@ -1745,7 +1771,7 @@ //write which register cache based on MAC bits //or always when below the MAC mapped register space bool wr0 = ((mac & 0x1) != 0) or (spiAddr[i] < 0x0100); - bool wr1 = ((mac & 0x2) != 0) or (spiAddr[i] < 0x0100); + bool wr1 = ((mac & 0x2) != 0) and (spiAddr[i] >= 0x0100); if (wr0) mRegistersMap->SetValue(0, spiAddr[i], spiData[i]); if (wr1) mRegistersMap->SetValue(1, spiAddr[i], spiData[i]); @@ -1882,7 +1908,7 @@ for (uint16_t j = 0; j < addrToWrite.size(); ++j) { if (addrToWrite[j] == 0x00A6) - dataToWrite.push_back(0x1 | pattern & ~0x2); + dataToWrite.push_back(0x1 | (pattern & ~0x2)); else if (addrToWrite[j] == 0x0084) dataToWrite.push_back(pattern & ~0x19); else @@ -1968,27 +1994,37 @@ dataReceived.resize(addrToRead.size(), 0); this->SetActiveChannel(ChA); - status = SPI_read_batch(&addrToRead[0], &dataReceived[0], addrToRead.size()); + std::vector dataWr(addrToRead.size()); + std::vector dataRd(addrToRead.size()); + for(size_t i = 0; i < addrToRead.size(); ++i) + dataWr[i] = (uint32_t(addrToRead[i]) << 16); + status = controlPort->TransactSPI(addrLMS7002M, dataWr.data(), dataRd.data(), dataWr.size()); + for(int i=0; iGetValue(0, addrToRead[i])) + uint16_t regValue = mRegistersMap->GetValue(0, addrToRead[i]); + if(addrToRead[i] <= readOnlyRegisters[sizeof(readOnlyRegisters)/sizeof(uint16_t)-1] && addrToRead[i] >= readOnlyRegisters[0]) { + //mask out readonly bits + for (uint16_t j = 0; j < sizeof(readOnlyRegisters) / sizeof(uint16_t); ++j) + if (readOnlyRegisters[j] == addrToRead[i]) + { + dataReceived[i] &= readOnlyRegistersMasks[j]; + regValue &= readOnlyRegistersMasks[j]; + break; + } + } + if (dataReceived[i] != regValue) + { + printf("Addr: 0x%04X gui: 0x%04X chip: 0x%04X\n", addrToRead[i], regValue, dataReceived[i]); isSynced = false; goto isSyncedEnding; } @@ -1996,28 +2032,42 @@ addrToRead.clear(); //add only B channel addresses addrToRead = mRegistersMap->GetUsedAddresses(1); - - //mask out readonly bits - for (uint16_t j = 0; j < sizeof(readOnlyRegisters) / sizeof(uint16_t); ++j) - for (uint16_t k = 0; k < addrToRead.size(); ++k) - if (readOnlyRegisters[j] == addrToRead[k]) - { - dataReceived[k] &= readOnlyRegistersMasks[j]; - break; - } - - this->SetActiveChannel(ChB); - status = SPI_read_batch(&addrToRead[0], &dataReceived[0], addrToRead.size()); + dataWr.resize(addrToRead.size()); + dataRd.resize(addrToRead.size()); + for(size_t i = 0; i < addrToRead.size(); ++i) + dataWr[i] = (uint32_t(addrToRead[i]) << 16); + status = controlPort->TransactSPI(addrLMS7002M, dataWr.data(), dataRd.data(), dataWr.size()); + for(int i=0; iSetActiveChannel(ChB); + //check if local copy matches chip for (uint16_t i = 0; i < addrToRead.size(); ++i) - if (dataReceived[i] != mRegistersMap->GetValue(1, addrToRead[i])) + { + uint16_t regValue = mRegistersMap->GetValue(1, addrToRead[i]); + if(addrToRead[i] <= readOnlyRegisters[sizeof(readOnlyRegisters)/sizeof(uint16_t)-1] && addrToRead[i] >= readOnlyRegisters[0]) + { + //mask out readonly bits + for (uint16_t j = 0; j < sizeof(readOnlyRegisters) / sizeof(uint16_t); ++j) + if (readOnlyRegisters[j] == addrToRead[i]) + { + dataReceived[i] &= readOnlyRegistersMasks[j]; + regValue &= readOnlyRegistersMasks[j]; + break; + } + } + if (dataReceived[i] != regValue) { + printf("Addr: 0x%04X gui: 0x%04X chip: 0x%04X\n", addrToRead[i], regValue, dataReceived[i]); isSynced = false; - break; + goto isSyncedEnding; } - + } isSyncedEnding: this->SetActiveChannel(ch); //restore previously used channel return isSynced; @@ -2145,7 +2195,7 @@ { Modify_SPI_Reg_bits(LMS7param(RXTSPCLKA_DIV), 0); Modify_SPI_Reg_bits(LMS7param(RXDIVEN), false); - Modify_SPI_Reg_bits(LMS7param(MCLK2SRC), mclk2src & 1 | 0x2); + Modify_SPI_Reg_bits(LMS7param(MCLK2SRC), (mclk2src & 1) | 0x2); } else { @@ -2162,7 +2212,7 @@ { Modify_SPI_Reg_bits(LMS7param(TXTSPCLKA_DIV), 0); Modify_SPI_Reg_bits(LMS7param(TXDIVEN), false); - Modify_SPI_Reg_bits(LMS7param(MCLK1SRC), mclk1src & 1 | 0x2); + Modify_SPI_Reg_bits(LMS7param(MCLK1SRC), (mclk1src & 1) | 0x2); } else { @@ -2415,3 +2465,27 @@ { log_callback = callback; } + +int LMS7002M::CopyChannelRegisters(const Channel src, const Channel dest, const bool copySX) +{ + Channel ch = this->GetActiveChannel(); //remember used channel + + vector addrToWrite; + addrToWrite = mRegistersMap->GetUsedAddresses(1); + if(!copySX) + { + for(uint32_t address = MemorySectionAddresses[SX][0]; address <= MemorySectionAddresses[SX][1]; ++address) + addrToWrite.erase( find(addrToWrite.begin(), addrToWrite.end(), address)); + } + for (auto address : addrToWrite) + { + uint16_t data = mRegistersMap->GetValue(src == ChA ? 0 : 1, address); + mRegistersMap->SetValue(dest == ChA ? 0 : 1, address, data); + } + if(controlPort) + UploadAll(); + this->SetActiveChannel(ch); + //update external band-selection to match + this->UpdateExternalBandSelect(); + return 0; +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M_filtersCalibration.cpp limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M_filtersCalibration.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M_filtersCalibration.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M_filtersCalibration.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -112,7 +112,10 @@ int status; status = TuneRxFilterSetup(rx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } int g_rxloopb_rfe = Get_SPI_Reg_bits(G_RXLOOPB_RFE); uint32_t rssi = GetRSSI(); @@ -138,10 +141,16 @@ { status = SetFrequencySX(LMS7002M::Rx, 539.9e6-rx_lpf_IF*1.3); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } status = SetNCOFrequency(LMS7002M::Rx, 0, rx_lpf_IF*1.3); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } if(rx_lpf_IF < 18e6) { @@ -215,11 +224,16 @@ } status = SetFrequencySX(LMS7002M::Rx, 539.9e6-rx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } status = SetNCOFrequency(LMS7002M::Rx, 0, rx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; - + } Modify_SPI_Reg_bits(CFB_TIA_RFE, g_tia_rfe); int cfb_tia_rfe; if(g_tia_rfe == 3 || g_tia_rfe == 2) @@ -227,7 +241,10 @@ else if(g_tia_rfe == 1) cfb_tia_rfe = int( 5400e6 / (rx_lpf_IF * 0.72) - 15); else + { + RestoreRegisterMap(registersBackup); return ReportError(EINVAL, "g_tia_rfe not allowed value"); + } cfb_tia_rfe = clamp(cfb_tia_rfe, 0, 4095); Modify_SPI_Reg_bits(CFB_TIA_RFE, cfb_tia_rfe); @@ -237,7 +254,10 @@ else if(g_tia_rfe == 1) ccomp_tia_rfe = cfb_tia_rfe / 100 + 1; else + { + RestoreRegisterMap(registersBackup); return ReportError(EINVAL, "g_tia_rfe not allowed value"); + } ccomp_tia_rfe = clamp(ccomp_tia_rfe, 0, 15); Modify_SPI_Reg_bits(CCOMP_TIA_RFE, ccomp_tia_rfe); @@ -248,22 +268,33 @@ //START TIA status = RxFilterSearch(CFB_TIA_RFE, rssi_3dB, rssiAvgCount, 4096); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } //END TIA } if(rx_lpf_IF > 54e6) { status = SetFrequencySX(LMS7002M::Rx, 539.9e6 - rx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } status = SetNCOFrequency(LMS7002M::Rx, 0, rx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; - + } //START TIA status = RxFilterSearch(CFB_TIA_RFE, rssi_3dB, rssiAvgCount, 4096); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } //END TIA } @@ -941,7 +972,10 @@ status = TuneTxFilterFixedSetup(); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } Modify_SPI_Reg_bits(SEL_RX, 0); Modify_SPI_Reg_bits(SEL_TX, 0); @@ -1015,7 +1049,10 @@ nco_fixed = 5; } else + { + RestoreRegisterMap(registersBackup); ReportError(ERANGE, "Tx Filter fixed bandwidth out of range"); + } uint32_t rssi_dc_lad = GetAvgRSSI(rssiAvgCount); uint32_t rssi_3dB_LAD = rssi_dc_lad * 0.7071; @@ -1027,7 +1064,10 @@ status = TxFilterSearch_LAD(RCAL_LPFLAD_TBB, &rssi_3dB_LAD, rssiAvgCount, 256, nco_fixed); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } //ENDING ccal_lpflad_tbb = Get_SPI_Reg_bits(CCAL_LPFLAD_TBB); @@ -1152,7 +1192,6 @@ { int status; float_type txSampleRate; - auto registersBackup = BackupRegisterMap(); if(tx_lpf_freq_RF < TxLPF_RF_LimitLow || tx_lpf_freq_RF > TxLPF_RF_LimitHigh) return ReportError(ERANGE, "Tx lpf(%g MHz) out of range %g-%g MHz and %g-%g MHz", tx_lpf_freq_RF/1e6, @@ -1168,10 +1207,13 @@ TxLPF_RF_LimitMidHigh/1e6); tx_lpf_IF = TxLPF_RF_LimitMidHigh/2; } - + auto registersBackup = BackupRegisterMap(); status = TuneTxFilterSetup(tx_lpf_IF); if(status != 0) + { + RestoreRegisterMap(registersBackup); return status; + } Modify_SPI_Reg_bits(SEL_RX, 0); Modify_SPI_Reg_bits(SEL_TX, 0); @@ -1237,8 +1279,6 @@ if(rssi > rssi_3dB_S5) { status = TxFilterSearch_S5(RCAL_LPFS5_TBB, rssi_3dB_S5, rssiAvgCount, 256); - if(status != 0) - return status; } } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M.h limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M.h --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M.h 2016-08-25 18:57:42.000000000 +0000 @@ -60,8 +60,9 @@ * Set the connection for the LMS7002M driver. * \param port the connection interface * \param devIndex which RFIC index (default 0 for most devices) + * \param dataPort connection used to get samples data when calibrating with FFT */ - void SetConnection(IConnection* port, const size_t devIndex = 0); + void SetConnection(IConnection* port, const size_t devIndex = 0, IConnection* dataPort = nullptr); IConnection *GetConnection(void) const { @@ -115,6 +116,7 @@ int UploadAll(); int DownloadAll(); bool IsSynced(); + int CopyChannelRegisters(const Channel src, const Channel dest, bool copySX); int ResetChip(); @@ -475,6 +477,7 @@ ///port used for communicating with LMS7002M IConnection* controlPort; + IConnection* dataPort; //device for samples data int addrLMS7002M; size_t mdevIndex; size_t mSelfCalDepth; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M_RxTxCalibrations.cpp limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M_RxTxCalibrations.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m/LMS7002M_RxTxCalibrations.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m/LMS7002M_RxTxCalibrations.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -29,6 +29,7 @@ #define ENABLE_CALIBRATION_USING_FFT #ifdef ENABLE_CALIBRATION_USING_FFT +#include "windowFunction.h" bool useFFT = false; //digital RSSI or FFT from GetRSSI() const int gFFTSize = 16384; int fftBin = 0; //which bin to use when calibrating using FFT @@ -389,6 +390,7 @@ Modify_SPI_Reg_bits(LMS7param(GFIR3_BYP_RXTSP), 1); Modify_SPI_Reg_bits(LMS7param(AGC_BYP_RXTSP), 1); Modify_SPI_Reg_bits(CFB_TIA_RFE, 3000); //to filter aliasing + Modify_SPI_Reg_bits(LMS7param(HBD_OVR_RXTSP), 0); } else { @@ -425,77 +427,58 @@ } #ifdef ENABLE_CALIBRATION_USING_FFT - //need to update interface frequency for samples acquisition - //if decimation/interpolation is 0(2^1) or 7(bypass), interface clocks should not be divided - int decimation = Get_SPI_Reg_bits(HBD_OVR_RXTSP); - float interfaceRx_Hz = GetReferenceClk_TSP(LMS7002M::Rx); - if (decimation != 7) - interfaceRx_Hz /= pow(2.0, decimation); - int interpolation = Get_SPI_Reg_bits(HBI_OVR_TXTSP); - float interfaceTx_Hz = GetReferenceClk_TSP(LMS7002M::Tx); - if (interpolation != 7) - interfaceTx_Hz /= pow(2.0, interpolation); - const int channelsCount = 2; - SetInterfaceFrequency(GetFrequencyCGEN(), interpolation, decimation); - controlPort->UpdateExternalDataRate(0, interfaceTx_Hz/channelsCount, interfaceRx_Hz/channelsCount); -#endif - return 0; -} + if(useExtLoopback || useFFT) + { + //limelight + Modify_SPI_Reg_bits(LML1_FIDM, 0); + Modify_SPI_Reg_bits(LML2_FIDM, 0); + Modify_SPI_Reg_bits(LML1_MODE, 0); + Modify_SPI_Reg_bits(LML2_MODE, 0); + if(ch == 1) + { + Modify_SPI_Reg_bits(LML2_S0S, 1); //pos0, AQ + Modify_SPI_Reg_bits(LML2_S1S, 0); //pos1, AI + } + else if(ch == 2) + { + Modify_SPI_Reg_bits(LML2_S0S, 3); //pos0, BQ + Modify_SPI_Reg_bits(LML2_S1S, 2); //pos1, BI + } + //need to update interface frequency for samples acquisition + //if decimation/interpolation is 0(2^1) or 7(bypass), interface clocks should not be divided + int decimation = Get_SPI_Reg_bits(HBD_OVR_RXTSP); + float interfaceRx_Hz = GetReferenceClk_TSP(LMS7002M::Rx); + //need to adjust decimation to fit into USB speed + float rateLimit_Bps; + DeviceInfo info = dataPort->GetDeviceInfo(); + if(info.deviceName == GetDeviceName(LMS_DEV_STREAM)) + rateLimit_Bps = 110e6; + else if(info.deviceName == GetDeviceName(LMS_DEV_LIMESDR)) + rateLimit_Bps = 300e6; + else if(info.deviceName == GetDeviceName(LMS_DEV_ULIMESDR)) + rateLimit_Bps = 100e6; + else + rateLimit_Bps = 100e6; -#ifdef ENABLE_CALIBRATION_USING_FFT -/** @brief Calculates selected window function coefficients - @param func window function index - @param fftsize number of samples for FFT calculations -*/ -static void GenerateWindowCoefficients(int func, int fftsize, std::vector &windowFcoefs, float_type &litudeCorrection) -{ - windowFcoefs.clear(); + decimation = ceil(log2((interfaceRx_Hz*3/2)/rateLimit_Bps)); + if(decimation < 0) + decimation = 0; + if(decimation > 4) + decimation = 4; + if (decimation != 7) + interfaceRx_Hz /= pow(2.0, decimation); - windowFcoefs.resize(fftsize); - float a0 = 0.35875; - float a1 = 0.48829; - float a2 = 0.14128; - float a3 = 0.01168; - float a4 = 1; - int N = fftsize; - float PI = 3.14159265359; - switch(func) - { - case 0: - amplitudeCorrection = 1; - break; - case 1: //blackman-harris - for (int i = 0; iUpdateExternalDataRate(0, interfaceTx_Hz/channelsCount, interfaceRx_Hz/channelsCount); } -} #endif + return 0; +} /** @brief Flips the CAPTURE bit and returns digital RSSI value @@ -508,16 +491,14 @@ if(useFFT) { int fftSize = gFFTSize; - std::vector windowF; - float_type amplitudeCorr = 1; - GenerateWindowCoefficients(2, fftSize, windowF, amplitudeCorr); - IConnection* port = controlPort; + std::vector windowF; + float amplitudeCorr = 1; + GenerateWindowCoefficients(3, fftSize, windowF, amplitudeCorr); + IConnection* port = dataPort; fpga::StopStreaming(port); StreamConfig config; - const int channelsCount = 2; config.channels.push_back(0); - config.channels.push_back(1); config.format = StreamConfig::STREAM_12_BIT_IN_16; config.linkFormat = StreamConfig::STREAM_12_BIT_COMPRESSED; config.isTx = false; @@ -538,81 +519,89 @@ //goertzel // number of spectral points, i.e. number of bins all the interval is divided to - const int SP = 65536/16*2; - int xi[SP][2]; // Raw data (integer numbers) - int64_t reali[SP], imagi[SP]; // Calculated Goertzel bins, integer numbers - - const int bufferSize = 4096*(fftSize/(1360/channelsCount)+1); + const int SP = fftSize/2; + auto xi = new int[SP][2]; // Raw data (integer numbers) + // Calculated Goertzel bins, integer numbers + int64_t *reali = new int64_t[SP]; + int64_t *imagi = new int64_t[SP]; + + //number of packets to skip from the buffer start + const int packetsPadding = 32; + const int bufferSize = 4096*((fftSize/(1360)+1) + packetsPadding); char *buffer = new char[bufferSize]; const int maxTransferSize = bufferSize; - long bytesReceived = 0; std::vector handles(int(bufferSize/maxTransferSize), 0); std::vector transferSizes; - for(int i=0; i maxTransferSize) - transferSizes.push_back(maxTransferSize); - else - transferSizes.push_back(bufferSize-i*maxTransferSize); - handles[i] = port->BeginDataReading(&buffer[maxTransferSize*i], transferSizes[i]); - } - fpga::StartStreaming(port); - for(int i=0; iWaitForReading(handles[i], 1000) == false) - printf("Failed to get FFT RSSI\n"); - long bytesToRead = transferSizes[i]; - bytesReceived += port->FinishDataReading(&buffer[maxTransferSize*i], bytesToRead, handles[i]); - } - long samplesCollected = 0; - int16_t sample = 0; - if(bytesReceived < bufferSize) - printf("Data not received for FFT\n"); + std::vector fftBins_dbFS(fftSize, 0); - for (int pktIndex = 0; pktIndex < bytesReceived / 4096 && samplesCollected < fftSize; ++pktIndex) + const int avgCount = 5; + for(int a=0; a maxTransferSize) + transferSizes.push_back(maxTransferSize); + else + transferSizes.push_back(bufferSize-i*maxTransferSize); + handles[i] = port->BeginDataReading(&buffer[maxTransferSize*i], transferSizes[i]); + } + for(int i=0; iWaitForReading(handles[i], 1000) == false) + printf("Failed to get FFT RSSI\n"); + long bytesToRead = transferSizes[i]; + bytesReceived += port->FinishDataReading(&buffer[maxTransferSize*i], bytesToRead, handles[i]); + } + long samplesCollected = 0; + int16_t sample = 0; + if(bytesReceived < bufferSize) + printf("Data not received for FFT\n"); + + for (int pktIndex = packetsPadding; pktIndex < bytesReceived / 4096 && samplesCollected < fftSize; ++pktIndex) + { + uint8_t* pktStart = (uint8_t*)buffer+(pktIndex*4096)+16; + const int stepSize = 3; + for (uint16_t b = 0; b < 4080; b += stepSize) { - if(ch == 1) - continue; //I sample - sample = (pktStart[b + 1 + 3 * ch] & 0x0F) << 8; - sample |= (pktStart[b + 3 * ch] & 0xFF); + sample = (pktStart[b + 1] & 0x0F) << 8; + sample |= (pktStart[b] & 0xFF); sample = sample << 4; sample = sample >> 4; m_fftCalcIn[samplesCollected].r = sample; - xi[samplesCollected][0] = sample; + if(samplesCollected < SP) + xi[samplesCollected][0] = sample; //Q sample - sample = pktStart[b + 2 + 3 * ch] << 4; - sample |= (pktStart[b + 1 + 3 * ch] >> 4) & 0x0F; + sample = pktStart[b + 2] << 4; + sample |= (pktStart[b + 1] >> 4) & 0x0F; sample = sample << 4; sample = sample >> 4; m_fftCalcIn[samplesCollected].i = sample; - xi[samplesCollected][1] = sample; + if (samplesCollected < SP) + xi[samplesCollected][1] = sample; + + ++samplesCollected; if(samplesCollected >= fftSize) break; } - ++samplesCollected; - if(samplesCollected >= fftSize) - break; } - } - for(int i=0; i fftBins_dbFS(fftSize, 0); + for (int i = 0; i < fftSize; ++i) { - fftBins_dbFS[i] = (m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); - fftBins_dbFS[i] = (fftBins_dbFS[i] != 0) ? (20 * log10(sqrt(fftBins_dbFS[i])) - 69.2369) : -150; + fftBins_dbFS[i] /= avgCount; + fftBins_dbFS[i] = (fftBins_dbFS[i] != 0) ? (20 * log10((fftBins_dbFS[i])) - 69.2369) : -150; } #ifdef DRAW_GNU_PLOTS const int binsToShow = srcBin*12; @@ -653,6 +642,11 @@ #endif kiss_fft_free(m_fftCalcPlan); delete[]buffer; + delete[] m_fftCalcOut; + delete[] m_fftCalcIn; + delete[] xi; + delete[] reali; + delete[] imagi; return dBFS_2_RSSI(useGoertzel ? goertzBins_dbFS[fftBin] : fftBins_dbFS[fftBin]); } #endif @@ -738,7 +732,7 @@ LMS7002M_SelfCalState state(this); Log("Tx calibration started", LOG_INFO); - BackupAllRegisters(); + auto registersBackup = BackupRegisterMap(); Log("Setup stage", LOG_INFO); status = CalibrateTxSetup(bandwidth_Hz, useExtLoopback); @@ -845,7 +839,8 @@ TxCalibrationEnd: Log("Restoring registers state", LOG_INFO); Modify_SPI_Reg_bits(LMS7param(MAC), ch); - RestoreAllRegisters(); + RestoreRegisterMap(registersBackup); + //RestoreAllRegisters(); if(status != 0) { @@ -958,7 +953,7 @@ Modify_SPI_Reg_bits(SEL_BAND1_TRF, 1); } else - return ReportError("CalibrateRxSetup() - SEL_PATH_RFE must be LNAL or LNAW"); + return ReportError(EINVAL, "CalibrateRxSetup() - SEL_PATH_RFE must be LNAL or LNAW"); } //TBB @@ -984,7 +979,6 @@ //CGEN //reset CGEN to defaults const float_type cgenFreq = GetFrequencyCGEN(); - SetDefaults(CGEN); int cgenMultiplier = int(cgenFreq / 46.08e6 + 0.5); if(cgenMultiplier < 2) cgenMultiplier = 2; @@ -1006,8 +1000,10 @@ //in TDD do nothing Modify_SPI_Reg_bits(MAC, 1); SetDefaults(SX); - SetFrequencySX(false, GetFrequencySX(true) - bandwidth_Hz / calibUserBwDivider - 9e6); - Modify_SPI_Reg_bits(PD_VCO, 1); + status = SetFrequencySX(false, GetFrequencySX(true) - bandwidth_Hz / calibUserBwDivider - 9e6); + if(status != 0) + return status; + Modify_SPI_Reg_bits(PD_VCO, 0); } else { @@ -1070,19 +1066,10 @@ Modify_SPI_Reg_bits(GFIR3_BYP_RXTSP, 1); Modify_SPI_Reg_bits(AGC_BYP_RXTSP, 1); Modify_SPI_Reg_bits(CMIX_BYP_RXTSP, 1); + Modify_SPI_Reg_bits(LMS7param(HBD_OVR_RXTSP), 0); } SetNCOFrequency(Rx, 0, bandwidth_Hz/calibUserBwDivider - offsetNCO); - - if(useExtLoopback) - { - //limelight - Modify_SPI_Reg_bits(LML1_FIDM, 1); - Modify_SPI_Reg_bits(LML2_FIDM, 1); - Modify_SPI_Reg_bits(LML1_MODE, 0); - Modify_SPI_Reg_bits(LML2_MODE, 0); - } - //modifications when calibrating channel B if(ch == 2) { @@ -1096,18 +1083,51 @@ #ifdef ENABLE_CALIBRATION_USING_FFT if(useExtLoopback || useFFT) { + //limelight + Modify_SPI_Reg_bits(LML1_FIDM, 0); + Modify_SPI_Reg_bits(LML2_FIDM, 0); + Modify_SPI_Reg_bits(LML1_MODE, 0); + Modify_SPI_Reg_bits(LML2_MODE, 0); + if(ch == 1) + { + Modify_SPI_Reg_bits(LML2_S0S, 1); //pos0, AQ + Modify_SPI_Reg_bits(LML2_S1S, 0); //pos1, AI + } + else if(ch == 2) + { + Modify_SPI_Reg_bits(LML2_S0S, 3); //pos0, BQ + Modify_SPI_Reg_bits(LML2_S1S, 2); //pos1, BI + } //if decimation/interpolation is 0(2^1) or 7(bypass), interface clocks should not be divided int decimation = Get_SPI_Reg_bits(HBD_OVR_RXTSP); float interfaceRx_Hz = GetReferenceClk_TSP(LMS7002M::Rx); + //need to adjust decimation to fit into USB speed + float rateLimit_Bps; + DeviceInfo info = dataPort->GetDeviceInfo(); + if(info.deviceName == GetDeviceName(LMS_DEV_STREAM)) + rateLimit_Bps = 110e6; + else if(info.deviceName == GetDeviceName(LMS_DEV_LIMESDR)) + rateLimit_Bps = 200e6; + else if(info.deviceName == GetDeviceName(LMS_DEV_ULIMESDR)) + rateLimit_Bps = 100e6; + else + rateLimit_Bps = 100e6; + + decimation = ceil(log2((interfaceRx_Hz*3/2)/rateLimit_Bps)); + if(decimation < 0) + decimation = 0; + if(decimation > 4) + decimation = 4; if (decimation != 7) interfaceRx_Hz /= pow(2.0, decimation); + int interpolation = Get_SPI_Reg_bits(HBI_OVR_TXTSP); float interfaceTx_Hz = GetReferenceClk_TSP(LMS7002M::Tx); if (interpolation != 7) interfaceTx_Hz /= pow(2.0, interpolation); const int channelsCount = 2; SetInterfaceFrequency(GetFrequencyCGEN(), interpolation, decimation); - controlPort->UpdateExternalDataRate(0, interfaceTx_Hz/channelsCount, interfaceRx_Hz/channelsCount); + dataPort->UpdateExternalDataRate(0, interfaceTx_Hz/channelsCount, interfaceRx_Hz/channelsCount); } #endif return 0; @@ -1187,8 +1207,9 @@ Log("Rx calibration started", LOG_INFO); Log("Saving registers state", LOG_INFO); - BackupAllRegisters(); - if(sel_path_rfe == 1 || sel_path_rfe == 0) + //BackupAllRegisters(); + auto registersBackup = BackupRegisterMap(); + if((sel_path_rfe == 1 || sel_path_rfe == 0) && not useExtLoopback) return ReportError(EINVAL, "Rx Calibration: bad SEL_PATH"); Log("Setup stage", LOG_INFO); @@ -1216,6 +1237,14 @@ } else { +#ifdef ENABLE_CALIBRATION_USING_FFT + { + float_type binWidth = GetSampleRate(LMS7002M::Rx, ch)/gFFTSize; + offsetNCO = int(0.1e6 / binWidth+0.5)*binWidth+binWidth/2; + } + srcBin = gFFTSize*offsetNCO/GetSampleRate(LMS7002M::Rx, ch); + fftBin = srcBin; +#endif // ENABLE_CALIBRATION_USING_FFT Log("Rx DC calibration", LOG_INFO); CalibrateRxDC_RSSI(); @@ -1335,7 +1364,8 @@ RxCalibrationEndStage: Log("Restoring registers state", LOG_INFO); - RestoreAllRegisters(); + //RestoreAllRegisters(); + RestoreRegisterMap(registersBackup); if (status != 0) { @@ -1835,7 +1865,7 @@ } for (int i = 0; i < fieldSize; ++i) delete rssiField[i]; - delete rssiField; + delete[] rssiField; #endif valueI = minI; valueQ = minQ; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002m_mcu/MCU_BD.cpp limesuite-16.8.1.819.792.4165104/src/lms7002m_mcu/MCU_BD.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002m_mcu/MCU_BD.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002m_mcu/MCU_BD.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -881,6 +881,8 @@ //Baseband gets back the control over SPI switch mSPI_write(0x0006, 0x0000); //REG6 write + + return 0; } void MCU_BD::RunTest_MCU(int m_iMode1, int m_iMode0, unsigned short test_code, int m_iDebug) { @@ -1094,7 +1096,7 @@ break; } mSPI_write(0x0006, 0); //return SPI control to PC - std::printf("MCU algorithm time: %li ms\n", std::chrono::duration_cast(t2 - t1).count()); + std::printf("MCU algorithm time: %lli ms\n", std::chrono::duration_cast(t2 - t1).count()); return value; } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_mainPanel.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_mainPanel.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_mainPanel.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_mainPanel.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -146,10 +146,6 @@ void lms7002_mainPanel::UpdateGUI() { - wxLongLong t1, t2; - t1 = wxGetUTCTimeMillis(); - lmsControl->IsSynced(); - t2 = wxGetUTCTimeMillis(); LMS7002M::Channel channel = lmsControl->GetActiveChannel(); if (channel == LMS7002M::ChA) { @@ -169,9 +165,6 @@ } UpdateVisiblePanel(); -#ifndef NDEBUG - cout << "GUI update time: " << (t2 - t1).ToString() << endl; -#endif } void lms7002_mainPanel::OnNewProject( wxCommandEvent& event ) @@ -254,9 +247,14 @@ } else { - lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB); - rbChannelA->Enable(); - rbChannelB->Enable(); + if(chkSyncAB->IsChecked()) + lmsControl->SetActiveChannel(LMS7002M::ChAB); + else + { + lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB); + rbChannelA->Enable(); + rbChannelB->Enable(); + } } #ifdef __APPLE__ @@ -294,3 +292,42 @@ double t = lmsControl->GetTemperature(); txtTemperature->SetLabel(wxString::Format("Temperature: %.1f C", t)); } + +void lms7002_mainPanel::OnSyncABchecked(wxCommandEvent& event) +{ + rbChannelA->Enable(!chkSyncAB->IsChecked()); + rbChannelB->Enable(!chkSyncAB->IsChecked()); + if(chkSyncAB->IsChecked()) + { + int status = lmsControl->CopyChannelRegisters(LMS7002M::ChA, LMS7002M::ChB, false); + if(status != 0) + wxMessageBox(wxString::Format(_("Failed to copy A to B: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Error")); + wxNotebookPage* page = tabsNotebook->GetCurrentPage(); + if(page != mTabSXR && page != mTabSXT) + lmsControl->SetActiveChannel(lime::LMS7002M::ChAB); + } + else + { + if(rbChannelA->GetValue() != 0) + lmsControl->SetActiveChannel(lime::LMS7002M::ChA); + else + lmsControl->SetActiveChannel(lime::LMS7002M::ChB); + } + UpdateVisiblePanel(); +} + +void lms7002_mainPanel::OnEnableMIMOchecked(wxCommandEvent& event) +{ + auto ch = lmsControl->GetActiveChannel(); + bool enable = chkEnableMIMO->IsChecked(); + lmsControl->SetActiveChannel(LMS7002M::ChA); + lmsControl->Modify_SPI_Reg_bits(EN_NEXTRX_RFE, enable); + lmsControl->Modify_SPI_Reg_bits(EN_NEXTTX_TRF, enable); + lmsControl->Modify_SPI_Reg_bits(PD_RX_AFE1, 0); + lmsControl->Modify_SPI_Reg_bits(PD_RX_AFE2, 0); + lmsControl->Modify_SPI_Reg_bits(PD_TX_AFE1, 0); + lmsControl->Modify_SPI_Reg_bits(PD_TX_AFE2, 0); + lmsControl->Modify_SPI_Reg_bits(MIMO_SISO, 0); + lmsControl->SetActiveChannel(ch); + UpdateVisiblePanel(); +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_mainPanel.h limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_mainPanel.h --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_mainPanel.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_mainPanel.h 2016-08-25 18:57:42.000000000 +0000 @@ -32,6 +32,8 @@ void Onnotebook_modulesPageChanged( wxNotebookEvent& event ); void OnResetChip(wxCommandEvent& event); void OnReadTemperature(wxCommandEvent& event); + void OnSyncABchecked(wxCommandEvent& event); + void OnEnableMIMOchecked(wxCommandEvent& event); public: /** Constructor */ lms7002_mainPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlCalibrations_view.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlCalibrations_view.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlCalibrations_view.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlCalibrations_view.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -43,7 +43,6 @@ lmsControl->EnableCalibrationByMCU(false); useExtLoopback = true; } - lmsControl->EnableCalibrationByMCU(true); double bandwidth_MHz = 0; txtCalibrationBW->GetValue().ToDouble(&bandwidth_MHz); int status; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlRFE_view.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlRFE_view.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlRFE_view.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlRFE_view.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -178,11 +178,19 @@ cmbDCOFFQ_RFE->SetValue(dcvalue); //check if B channel is enabled - if (lmsControl->GetActiveChannel() >= LMS7002M::ChB) + auto ch = lmsControl->GetActiveChannel(); + if (ch >= LMS7002M::ChB) { + lmsControl->SetActiveChannel(LMS7002M::ChA); if (lmsControl->Get_SPI_Reg_bits(MIMO_SISO) != 0) wxMessageBox(_("MIMO channel B is disabled"), _("Warning")); + if (lmsControl->Get_SPI_Reg_bits(EN_NEXTRX_RFE) != 1) + wxMessageBox(_("Rx MIMO mode not enabled, EN_NEXTRX_RFE=0"), _("Warning")); + lmsControl->SetActiveChannel(ch); + chkEN_NEXTRX_RFE->Hide(); } + else + chkEN_NEXTRX_RFE->Show(); } void lms7002_pnlRFE_view::ParameterChangeHandler(wxSpinEvent& event) diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlRxTSP_view.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlRxTSP_view.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlRxTSP_view.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlRxTSP_view.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -370,7 +370,11 @@ { double freq_MHz; txtNCOinputs[i]->GetValue().ToDouble(&freq_MHz); - lmsControl->SetNCOFrequency(LMS7002M::Rx, i, freq_MHz * 1e6); + if(lmsControl->SetNCOFrequency(LMS7002M::Rx, i, freq_MHz * 1e6) != 0) + { + wxMessageBox(wxString::From8BitData(GetLastErrorMessage()), _("ERROR"), wxICON_ERROR | wxOK); + break; + } } long value; txtFCWPHOmodeAdditional->GetValue().ToLong(&value); @@ -387,7 +391,8 @@ } double freq_MHz; txtFCWPHOmodeAdditional->GetValue().ToDouble(&freq_MHz); - lmsControl->SetNCOFrequency(LMS7002M::Rx, 0, freq_MHz * 1e6); + if(lmsControl->SetNCOFrequency(LMS7002M::Rx, 0, freq_MHz * 1e6) != 0) + wxMessageBox(wxString::From8BitData(GetLastErrorMessage()), _("ERROR"), wxICON_ERROR | wxOK); } } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlTRF_view.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlTRF_view.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_pnlTRF_view.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_pnlTRF_view.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -159,9 +159,17 @@ cmbTXFEoutput->SetSelection(TXFEoutputValue); //check if B channel is enabled - if (lmsControl->GetActiveChannel() >= LMS7002M::ChB) + auto ch = lmsControl->GetActiveChannel(); + if (ch >= LMS7002M::ChB) { + lmsControl->SetActiveChannel(LMS7002M::ChA); if (lmsControl->Get_SPI_Reg_bits(MIMO_SISO) != 0) wxMessageBox(_("MIMO channel B is disabled"), _("Warning")); + if (lmsControl->Get_SPI_Reg_bits(EN_NEXTTX_TRF) != 1) + wxMessageBox(_("Tx MIMO mode not enabled, EN_NEXTTX_TRF=0"), _("Warning")); + lmsControl->SetActiveChannel(ch); + chkEN_NEXTTX_TRF->Hide(); } + else + chkEN_NEXTTX_TRF->Show(); } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -55,15 +55,15 @@ ID_BUTTON1 = new wxButton( this, wxID_ANY, wxT("New"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); ID_BUTTON1->SetDefault(); - fgSizer299->Add( ID_BUTTON1, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer299->Add( ID_BUTTON1, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); ID_BUTTON2 = new wxButton( this, wxID_ANY, wxT("Open"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); ID_BUTTON2->SetDefault(); - fgSizer299->Add( ID_BUTTON2, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer299->Add( ID_BUTTON2, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); ID_BUTTON3 = new wxButton( this, wxID_ANY, wxT("Save"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); ID_BUTTON3->SetDefault(); - fgSizer299->Add( ID_BUTTON3, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer299->Add( ID_BUTTON3, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); wxFlexGridSizer* fgSizer300; fgSizer300 = new wxFlexGridSizer( 0, 5, 0, 0 ); @@ -71,11 +71,30 @@ fgSizer300->SetFlexibleDirection( wxBOTH ); fgSizer300->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + wxFlexGridSizer* fgSizer248; + fgSizer248 = new wxFlexGridSizer( 0, 1, 0, 0 ); + fgSizer248->SetFlexibleDirection( wxBOTH ); + fgSizer248->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxFlexGridSizer* fgSizer249; + fgSizer249 = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizer249->SetFlexibleDirection( wxBOTH ); + fgSizer249->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + rbChannelA = new wxRadioButton( this, ID_BTN_CH_A, wxT("A CHANNEL"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer300->Add( rbChannelA, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer249->Add( rbChannelA, 0, wxEXPAND, 5 ); rbChannelB = new wxRadioButton( this, ID_BTN_CH_B, wxT("B CHANNEL"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer300->Add( rbChannelB, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + fgSizer249->Add( rbChannelB, 0, wxEXPAND, 5 ); + + + fgSizer248->Add( fgSizer249, 0, 0, 5 ); + + chkSyncAB = new wxCheckBox( this, wxID_ANY, wxT("Synchronize A to B"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer248->Add( chkSyncAB, 0, 0, 5 ); + + + fgSizer300->Add( fgSizer248, 1, wxEXPAND, 5 ); btnDownloadAll = new wxButton( this, ID_BTN_CHIP_TO_GUI, wxT("Chip-->GUI"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer300->Add( btnDownloadAll, 0, 0, 5 ); @@ -84,22 +103,45 @@ fgSizer300->Add( btnUploadAll, 0, 0, 5 ); btnResetChip = new wxButton( this, ID_BTN_RESET_CHIP, wxT("Reset"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer300->Add( btnResetChip, 0, wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer300->Add( btnResetChip, 0, 0, 5 ); + + wxFlexGridSizer* fgSizer247; + fgSizer247 = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizer247->SetFlexibleDirection( wxBOTH ); + fgSizer247->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer300->Add( fgSizer247, 1, wxEXPAND, 5 ); fgSizer299->Add( fgSizer300, 1, wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 10 ); + wxFlexGridSizer* fgSizer251; + fgSizer251 = new wxFlexGridSizer( 0, 1, 0, 0 ); + fgSizer251->SetFlexibleDirection( wxBOTH ); + fgSizer251->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + txtTemperature = new wxStaticText( this, wxID_ANY, wxT("Temperature: ?????"), wxDefaultPosition, wxDefaultSize, 0 ); txtTemperature->Wrap( -1 ); - fgSizer299->Add( txtTemperature, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer251->Add( txtTemperature, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + chkEnableMIMO = new wxCheckBox( this, wxID_ANY, wxT("Enable MIMO"), wxDefaultPosition, wxDefaultSize, 0 ); + chkEnableMIMO->SetToolTip( wxT("Enables required registers for MIMO mode") ); + + fgSizer251->Add( chkEnableMIMO, 0, 0, 5 ); + + + fgSizer299->Add( fgSizer251, 1, wxEXPAND, 5 ); btnReadTemperature = new wxButton( this, wxID_ANY, wxT("Read Temp"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer299->Add( btnReadTemperature, 0, 0, 5 ); - fgSizer298->Add( fgSizer299, 1, wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP|wxBOTTOM, 10 ); + fgSizer298->Add( fgSizer299, 1, wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM, 10 ); tabsNotebook = new wxNotebook( this, ID_TABS_NOTEBOOK, wxDefaultPosition, wxDefaultSize, 0 ); + tabsNotebook->SetMinSize( wxSize( 1050,-1 ) ); + mTabCalibrations = new lms7002_pnlCalibrations_view( tabsNotebook, ID_TAB_CALIBRATIONS, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); tabsNotebook->AddPage( mTabCalibrations, wxT("Calibrations"), true ); mTabRFE = new lms7002_pnlRFE_view( tabsNotebook, ID_TAB_RFE, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -150,9 +192,11 @@ ID_BUTTON3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnSaveProject ), NULL, this ); rbChannelA->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( mainPanel::OnSwitchToChannelA ), NULL, this ); rbChannelB->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( mainPanel::OnSwitchToChannelB ), NULL, this ); + chkSyncAB->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( mainPanel::OnSyncABchecked ), NULL, this ); btnDownloadAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnDownloadAll ), NULL, this ); btnUploadAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnUploadAll ), NULL, this ); btnResetChip->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnResetChip ), NULL, this ); + chkEnableMIMO->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( mainPanel::OnEnableMIMOchecked ), NULL, this ); btnReadTemperature->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnReadTemperature ), NULL, this ); tabsNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( mainPanel::Onnotebook_modulesPageChanged ), NULL, this ); } @@ -165,9 +209,11 @@ ID_BUTTON3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnSaveProject ), NULL, this ); rbChannelA->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( mainPanel::OnSwitchToChannelA ), NULL, this ); rbChannelB->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( mainPanel::OnSwitchToChannelB ), NULL, this ); + chkSyncAB->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( mainPanel::OnSyncABchecked ), NULL, this ); btnDownloadAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnDownloadAll ), NULL, this ); btnUploadAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnUploadAll ), NULL, this ); btnResetChip->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnResetChip ), NULL, this ); + chkEnableMIMO->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( mainPanel::OnEnableMIMOchecked ), NULL, this ); btnReadTemperature->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( mainPanel::OnReadTemperature ), NULL, this ); tabsNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( mainPanel::Onnotebook_modulesPageChanged ), NULL, this ); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.fbp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.fbp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.fbp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.fbp 2016-08-25 18:57:42.000000000 +0000 @@ -92,7 +92,7 @@ 0 10 - wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP|wxBOTTOM + wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM 1 7 @@ -108,7 +108,7 @@ 0 5 - wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_HORIZONTAL 1 1 @@ -196,7 +196,7 @@ 5 - wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_HORIZONTAL 1 1 @@ -284,7 +284,7 @@ 5 - wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_HORIZONTAL 1 1 @@ -386,11 +386,311 @@ none 0 0 + + 5 + wxEXPAND + 1 + + 1 + wxBOTH + + + 0 + + fgSizer248 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + + 0 + + 2 + wxBOTH + + + 0 + + fgSizer249 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_BTN_CH_A + A CHANNEL + + 0 + + + 0 + + 1 + rbChannelA + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + OnSwitchToChannelA + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_BTN_CH_B + B CHANNEL + + 0 + + + 0 + + 1 + rbChannelB + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + OnSwitchToChannelB + + + + + + + + + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Synchronize A to B + + 0 + + + 0 + + 1 + chkSyncAB + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnSyncABchecked + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 - + 1 1 1 @@ -407,6 +707,7 @@ 1 1 + 0 0 Dock 0 @@ -417,8 +718,8 @@ 0 0 - ID_BTN_CH_A - A CHANNEL + ID_BTN_CHIP_TO_GUI + Chip-->GUI 0 @@ -426,7 +727,7 @@ 0 1 - rbChannelA + btnDownloadAll 1 @@ -444,10 +745,10 @@ wxFILTER_NONE wxDefaultValidator - 0 + OnDownloadAll @@ -465,7 +766,6 @@ - OnSwitchToChannelA @@ -476,9 +776,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 - + 1 1 1 @@ -495,6 +795,7 @@ 1 1 + 0 0 Dock 0 @@ -505,8 +806,8 @@ 0 0 - ID_BTN_CH_B - B CHANNEL + wxID_ANY + GUI-->Chip 0 @@ -514,7 +815,7 @@ 0 1 - rbChannelB + btnUploadAll 1 @@ -532,10 +833,10 @@ wxFILTER_NONE wxDefaultValidator - 0 + OnUploadAll @@ -553,7 +854,6 @@ - OnSwitchToChannelB @@ -594,8 +894,8 @@ 0 0 - ID_BTN_CHIP_TO_GUI - Chip-->GUI + ID_BTN_RESET_CHIP + Reset 0 @@ -603,7 +903,7 @@ 0 1 - btnDownloadAll + btnResetChip 1 @@ -624,7 +924,7 @@ - OnDownloadAll + OnResetChip @@ -650,11 +950,47 @@ + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizer247 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + + + + + 5 + wxEXPAND + 1 + + 1 + wxBOTH + + + 0 + + fgSizer251 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 5 - + wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -671,7 +1007,6 @@ 1 1 - 0 0 Dock 0 @@ -683,7 +1018,7 @@ 0 0 wxID_ANY - GUI-->Chip + Temperature: ????? 0 @@ -691,7 +1026,7 @@ 0 1 - btnUploadAll + txtTemperature 1 @@ -705,14 +1040,10 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - - OnUploadAll + -1 @@ -738,11 +1069,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL + 0 - + 1 1 1 @@ -756,10 +1087,10 @@ 1 0 + 0 1 1 - 0 0 Dock 0 @@ -770,8 +1101,8 @@ 0 0 - ID_BTN_RESET_CHIP - Reset + wxID_ANY + Enable MIMO 0 @@ -779,7 +1110,7 @@ 0 1 - btnResetChip + chkEnableMIMO 1 @@ -792,7 +1123,7 @@ 0 - + Enables required registers for MIMO mode wxFILTER_NONE wxDefaultValidator @@ -800,8 +1131,8 @@ - OnResetChip + OnEnableMIMOchecked @@ -830,89 +1161,6 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Temperature: ????? - - 0 - - - 0 - - 1 - txtTemperature - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 0 @@ -1039,7 +1287,7 @@ 0 - + 1050,-1 1 tabsNotebook 1 diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.h limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.h --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/lms7002_wxgui.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/lms7002_wxgui.h 2016-08-25 18:57:42.000000000 +0000 @@ -37,13 +37,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -96,10 +96,12 @@ wxButton* ID_BUTTON3; wxRadioButton* rbChannelA; wxRadioButton* rbChannelB; + wxCheckBox* chkSyncAB; wxButton* btnDownloadAll; wxButton* btnUploadAll; wxButton* btnResetChip; wxStaticText* txtTemperature; + wxCheckBox* chkEnableMIMO; wxButton* btnReadTemperature; wxNotebook* tabsNotebook; @@ -109,9 +111,11 @@ virtual void OnSaveProject( wxCommandEvent& event ) { event.Skip(); } virtual void OnSwitchToChannelA( wxCommandEvent& event ) { event.Skip(); } virtual void OnSwitchToChannelB( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSyncABchecked( wxCommandEvent& event ) { event.Skip(); } virtual void OnDownloadAll( wxCommandEvent& event ) { event.Skip(); } virtual void OnUploadAll( wxCommandEvent& event ) { event.Skip(); } virtual void OnResetChip( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEnableMIMOchecked( wxCommandEvent& event ) { event.Skip(); } virtual void OnReadTemperature( wxCommandEvent& event ) { event.Skip(); } virtual void Onnotebook_modulesPageChanged( wxNotebookEvent& event ) { event.Skip(); } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/pnlBoardControls.cpp limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/pnlBoardControls.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7002_wxgui/pnlBoardControls.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7002_wxgui/pnlBoardControls.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -8,12 +8,14 @@ #endif //WX_PRECOMP #include "pnluLimeSDR.h" +#include "pnlLimeSDR.h" #include #include #include #include #include #include +#include "lms7suiteEvents.h" using namespace std; using namespace lime; @@ -288,6 +290,14 @@ wxMessageBox(_("Failes to write values"), _("Warning")); return; } + + if(additionalControls) + { + wxCommandEvent evt; + evt.SetEventType(WRITE_ALL_VALUES); + evt.SetId(additionalControls->GetId()); + wxPostEvent(additionalControls, evt); + } } void pnlBoardControls::Initialize(IConnection* controlPort) @@ -313,12 +323,20 @@ mADC_GUI_widgets[i]->value->SetLabel(wxString::Format(_("%i"), mADCparameters[i].value)); mADC_GUI_widgets[i]->units->SetLabelText(wxString::Format("%s", mADCparameters[i].units)); } + + if(additionalControls) + { + wxCommandEvent evt; + evt.SetEventType(READ_ALL_VALUES); + evt.SetId(additionalControls->GetId()); + wxPostEvent(additionalControls, evt); + } } std::vector pnlBoardControls::getBoardADCs(const string &boardID) { std::vector paramList; - if(boardID == GetDeviceName(LMS_DEV_LIMESDR) + if(boardID == GetDeviceName(LMS_DEV_LIMESDR) || boardID == GetDeviceName(LMS_DEV_LIMESDR_PCIE) || boardID == GetDeviceName(LMS_DEV_QSPARK)) { @@ -434,7 +452,15 @@ additionalControls = pnl; sizerAdditionalControls->Add(additionalControls); } + else if(boardID == GetDeviceName(LMS_DEV_LIMESDR)) + { + pnlLimeSDR* pnl = new pnlLimeSDR(this, wxNewId()); + pnl->Initialize(serPort); + additionalControls = pnl; + sizerAdditionalControls->Add(additionalControls); + } + Layout(); Fit(); } @@ -457,7 +483,7 @@ double value = mDACparameters[i].value; string units = mDACparameters[i].units; - if (serPort || serPort->IsOpen() == false) + if (serPort == nullptr || serPort->IsOpen() == false) return; int status = serPort->CustomParameterWrite(&ids, &value, 1, &units); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7suiteAppFrame.cpp limesuite-16.8.1.819.792.4165104/src/lms7suiteAppFrame.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7suiteAppFrame.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7suiteAppFrame.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -199,7 +199,7 @@ Layout(); Fit(); - SetMinSize(GetSize()); + SetMinSize(GetBestSize()); UpdateConnections(lms7controlPort, streamBoardPort); mnuCacheValues->Check(lmsControl->IsValuesCacheEnabled()); @@ -271,6 +271,21 @@ si5351gui->ModifyClocksGUI(info.deviceName); if (boardControlsGui) boardControlsGui->SetupControls(info.deviceName); + + /* + if(lmsControl->IsSynced() == false) + { + wxString choices[3] = {_("GUI->Chip"), _("Chip->GUI"), _("Do nothing")}; + wxSingleChoiceDialog dlg(this, _("GUI does not match Chip settings. Synchronize?"), _("Warning"), 3, choices, (void**)0); + if(dlg.ShowModal() == wxID_OK) + { + if(dlg.GetSelection() == 0) + lmsControl->UploadAll(); + else if(dlg.GetSelection() == 1) + lmsControl->DownloadAll(); + } + } + */ } else { @@ -586,7 +601,7 @@ void LMS7SuiteAppFrame::UpdateConnections(IConnection* lms7controlPort, IConnection* streamBoardPort) { if(lmsControl) - lmsControl->SetConnection(lms7controlPort); + lmsControl->SetConnection(lms7controlPort, 0, streamBoardPort); if(si5351module) si5351module->Initialize(lms7controlPort); if(fftviewer) diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7suiteEvents/lms7suiteEvents.cpp limesuite-16.8.1.819.792.4165104/src/lms7suiteEvents/lms7suiteEvents.cpp --- limesuite-16.6.6.818.730.60b8d25/src/lms7suiteEvents/lms7suiteEvents.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7suiteEvents/lms7suiteEvents.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -8,3 +8,5 @@ wxDEFINE_EVENT(LOG_MESSAGE, wxCommandEvent); wxDEFINE_EVENT(LMS7_TXBAND_CHANGED, wxCommandEvent); wxDEFINE_EVENT(LMS7_RXPATH_CHANGED, wxCommandEvent); +wxDEFINE_EVENT(READ_ALL_VALUES, wxCommandEvent); +wxDEFINE_EVENT(WRITE_ALL_VALUES, wxCommandEvent); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/lms7suiteEvents/lms7suiteEvents.h limesuite-16.8.1.819.792.4165104/src/lms7suiteEvents/lms7suiteEvents.h --- limesuite-16.6.6.818.730.60b8d25/src/lms7suiteEvents/lms7suiteEvents.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/lms7suiteEvents/lms7suiteEvents.h 2016-08-25 18:57:42.000000000 +0000 @@ -11,5 +11,7 @@ wxDECLARE_EVENT(LOG_MESSAGE, wxCommandEvent); wxDECLARE_EVENT(LMS7_TXBAND_CHANGED, wxCommandEvent); wxDECLARE_EVENT(LMS7_RXPATH_CHANGED, wxCommandEvent); +wxDECLARE_EVENT(READ_ALL_VALUES, wxCommandEvent); +wxDECLARE_EVENT(WRITE_ALL_VALUES, wxCommandEvent); #endif diff -Nru limesuite-16.6.6.818.730.60b8d25/src/LMS_Programing/LMS_Programing_wxgui.cpp limesuite-16.8.1.819.792.4165104/src/LMS_Programing/LMS_Programing_wxgui.cpp --- limesuite-16.6.6.818.730.60b8d25/src/LMS_Programing/LMS_Programing_wxgui.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/LMS_Programing/LMS_Programing_wxgui.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -44,7 +44,7 @@ wxFrame::Create(parent, id, title, wxDefaultPosition, wxDefaultSize, styles, _T("id")); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 5, 0); - FlexGridSizer2 = new wxFlexGridSizer(0, 2, 0, 0); + FlexGridSizer2 = new wxFlexGridSizer(0, 2, 5, 5); btnOpen = new wxButton(this, ID_BUTTON1, _T("Open"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); FlexGridSizer2->Add(btnOpen, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); FlexGridSizer6 = new wxFlexGridSizer(0, 2, 0, 0); @@ -54,14 +54,16 @@ FlexGridSizer6->Add(lblFilename, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2->Add(FlexGridSizer6, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); btnStartStop = new wxButton(this, ID_BUTTON2, _T("Program"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); - FlexGridSizer2->Add(btnStartStop, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + FlexGridSizer2->Add(btnStartStop, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer8 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer8->AddGrowableCol(0); lblProgressPercent = new wxStaticText(this, wxID_ANY, _T(""), wxDefaultPosition, wxSize(48, -1), 0, _T("ID_STATICTEXT5")); - FlexGridSizer8->Add(lblProgressPercent, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5); - progressBar = new wxGauge(this, ID_GAUGE1, 100, wxDefaultPosition, wxSize(-1, 21), 0, wxDefaultValidator, _T("ID_GAUGE1")); - FlexGridSizer8->Add(progressBar, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); - FlexGridSizer2->Add(FlexGridSizer8, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5); + + progressBar = new wxGauge(this, ID_GAUGE1, 100, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_GAUGE1")); + FlexGridSizer8->Add(progressBar, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0); + FlexGridSizer8->AddGrowableRow(0); + FlexGridSizer2->Add(FlexGridSizer8, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0); + FlexGridSizer2->Add(lblProgressPercent, 1, wxEXPAND | wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(FlexGridSizer2, 1, wxALIGN_LEFT | wxALIGN_TOP, 5); FlexGridSizer3 = new wxFlexGridSizer(0, 3, 0, 5); FlexGridSizer7 = new wxFlexGridSizer(0, 2, 0, 5); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/LMS_StreamBoard/LMS_StreamBoard.cpp limesuite-16.8.1.819.792.4165104/src/LMS_StreamBoard/LMS_StreamBoard.cpp --- limesuite-16.6.6.818.730.60b8d25/src/LMS_StreamBoard/LMS_StreamBoard.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/LMS_StreamBoard/LMS_StreamBoard.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -4,6 +4,8 @@ #include #include #include "kiss_fft.h" +#include +#include "windowFunction.h" using namespace std; using namespace lime; @@ -16,6 +18,10 @@ mTxFIFO = new LMS_StreamBoard_FIFO(1024*2); mStreamRunning.store(false); mTxCyclicRunning.store(false); + captureToFile = false; + samplesToCapture = 0; + captureFilename = ""; + windowFunction = 0; } LMS_StreamBoard::~LMS_StreamBoard() @@ -213,9 +219,18 @@ kiss_fft_cpx* m_fftCalcIn = new kiss_fft_cpx[fftSize]; kiss_fft_cpx* m_fftCalcOut = new kiss_fft_cpx[fftSize]; + vector capturedSamples; + bool captureToFile = pthis->captureToFile; + if(captureToFile) + capturedSamples.reserve(2*pthis->samplesToCapture); + const int framesInPacket = 16384; const int packetsCountForFFT = fftSize / framesInPacket + ((fftSize % framesInPacket) != 0); + vector wndFunc; + float ampCorr; + GenerateWindowCoefficients(pthis->windowFunction, fftSize, wndFunc, ampCorr); + SamplesPacket* pkt = new SamplesPacket[packetsCountForFFT]; while (pthis->stopProcessing.load() == false) { @@ -231,11 +246,22 @@ } } + if(captureToFile && capturedSamples.size() < pthis->samplesToCapture*2) + { + for(int i=0; isamplesToCapture*2; ++i) + { + capturedSamples.push_back(pkt[i / (2*framesInPacket)].iqdata[(2 * i) % (2*framesInPacket)]); //I + capturedSamples.push_back(pkt[i / (2*framesInPacket)].iqdata[(2 * i + 1) % (2*framesInPacket)]); //Q + } + } + unsigned int samplesUsed = 0; for (int i = 0; i < fftSize; ++i) { - localDataResults.samplesI[i] = m_fftCalcIn[i].r = pkt[i / (2*framesInPacket)].iqdata[(2 * i) % (2*framesInPacket)]; - localDataResults.samplesQ[i] = m_fftCalcIn[i].i = pkt[i / (2*framesInPacket)].iqdata[(2 * i + 1) % (2*framesInPacket)]; + localDataResults.samplesI[i] = pkt[i / (2*framesInPacket)].iqdata[(2 * i) % (2*framesInPacket)]; + localDataResults.samplesQ[i] = pkt[i / (2*framesInPacket)].iqdata[(2 * i + 1) % (2*framesInPacket)]; + m_fftCalcIn[i].r = localDataResults.samplesI[i] * wndFunc[i] * ampCorr; + m_fftCalcIn[i].i = localDataResults.samplesQ[i] * wndFunc[i] * ampCorr; } kiss_fft(m_fftCalcPlan, m_fftCalcIn, m_fftCalcOut); @@ -260,6 +286,15 @@ } delete[] pkt; + if(pthis->captureToFile) + { + std::ofstream fout; + fout.open(pthis->captureFilename.c_str()); + fout << "AI\tAQ" << endl; + int samplesCnt = capturedSamples.size(); + for(int i=0; i #include #include +#include #include "LMS_StreamBoard_FIFO.h" namespace lime{ @@ -70,6 +71,9 @@ Status Reg_write(uint16_t address, uint16_t data); uint16_t Reg_read(uint16_t address); + + void SetCaptureToFile(bool enable, const char* filename, uint32_t samplesCount); + void SetWidowFunction(int func); protected: static int FindFrameStart(const char* buffer, const int bufLen, const bool frameStart); std::mutex mLockIncomingPacket; @@ -102,6 +106,11 @@ std::atomic_bool mTxCyclicRunning; std::thread threadTxCyclic; std::atomic_bool stopTxCyclic; + + bool captureToFile; + uint32_t samplesToCapture; + std::string captureFilename; + int windowFunction; }; } #endif diff -Nru limesuite-16.6.6.818.730.60b8d25/src/LTEpackets/StreamerLTE.cpp limesuite-16.8.1.819.792.4165104/src/LTEpackets/StreamerLTE.cpp --- limesuite-16.6.6.818.730.60b8d25/src/LTEpackets/StreamerLTE.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/LTEpackets/StreamerLTE.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -5,7 +5,7 @@ #include #include #include "fifo.h" - +#include "windowFunction.h" #include "kiss_fft.h" using namespace std; @@ -19,6 +19,10 @@ mRxFIFO = new LMS_SamplesFIFO(1, 1); mTxFIFO = new LMS_SamplesFIFO(1, 1); mStreamRunning.store(false); + captureToFile = false; + samplesToCapture = 0; + captureFilename = ""; + windowFunction = 0; } StreamerLTE::~StreamerLTE() @@ -445,6 +449,7 @@ */ void StreamerLTE::ProcessPackets(StreamerLTE* pthis, const unsigned int fftSize, const int channelsCount, const StreamDataFormat format) { + const bool transmitReceivedSamples = false; if(pthis->mDataPort == nullptr) { #ifndef NDEBUG @@ -455,6 +460,10 @@ pthis->mRxFIFO->Reset(2*4096, channelsCount); pthis->mTxFIFO->Reset(2*4096, channelsCount); + vector wndFunc; + float ampCorr = 1; + GenerateWindowCoefficients(pthis->windowFunction, fftSize, wndFunc, ampCorr); + DataToGUI localDataResults; localDataResults.nyquist_Hz = 7.68e6; localDataResults.samplesI[0].resize(fftSize, 0); @@ -463,10 +472,17 @@ localDataResults.samplesQ[1].resize(fftSize, 0); localDataResults.fftBins_dbFS[0].resize(fftSize, 0); localDataResults.fftBins_dbFS[1].resize(fftSize, 0); + localDataResults.fftBins[0].resize(fftSize, 0); + localDataResults.fftBins[1].resize(fftSize, 0); kiss_fft_cfg m_fftCalcPlan = kiss_fft_alloc(fftSize, 0, 0, 0); kiss_fft_cpx* m_fftCalcIn = new kiss_fft_cpx[fftSize]; kiss_fft_cpx* m_fftCalcOut = new kiss_fft_cpx[fftSize]; + vector capturedSamples; + bool captureToFile = pthis->captureToFile; + if(captureToFile) + capturedSamples.reserve(2*pthis->samplesToCapture*channelsCount); + const int samplesToRead = fftSize; int16_t** buffers; buffers = new int16_t*[channelsCount]; @@ -524,12 +540,14 @@ if (format == STREAM_12_BIT_COMPRESSED) { threadRx = std::thread(ReceivePackets, threadRxArgs); - threadTx = std::thread(TransmitPackets, threadTxArgs); + if(transmitReceivedSamples) + threadTx = std::thread(TransmitPackets, threadTxArgs); } else { threadRx = std::thread(ReceivePacketsUncompressed, threadRxArgs); - threadTx = std::thread(TransmitPacketsUncompressed, threadTxArgs); + if(transmitReceivedSamples) + threadTx = std::thread(TransmitPacketsUncompressed, threadTxArgs); } int updateCounter = 0; @@ -537,9 +555,23 @@ while (pthis->stopProcessing.load() == false) { uint32_t samplesPopped = pthis->mRxFIFO->pop_samples((complex16_t**)buffers, samplesToRead, channelsCount, ×tamp, timeout_ms); + + if(captureToFile && capturedSamples.size() < pthis->samplesToCapture*2*channelsCount) + { + for(int i=0; isamplesToCapture*2*channelsCount; ++i) + { + for(int ch=0; chmTxFIFO->push_samples((const complex16_t**)buffers, samplesPopped, channelsCount, timestamp + 1024 * 1024, timeout_ms, STATUS_FLAG_TX_TIME); + if(transmitReceivedSamples) + uint32_t samplesPushed = pthis->mTxFIFO->push_samples((const complex16_t**)buffers, samplesPopped, channelsCount, timestamp + 1024 * 1024, timeout_ms, STATUS_FLAG_TX_TIME); if (updateCounter & 0x40) { @@ -548,8 +580,10 @@ { for (int i = 0; i < fftSize; ++i) { - localDataResults.samplesI[ch][i] = m_fftCalcIn[i].r = buffers[ch][2 * i]; - localDataResults.samplesQ[ch][i] = m_fftCalcIn[i].i = buffers[ch][2 * i + 1]; + localDataResults.samplesI[ch][i] = buffers[ch][2 * i]; + localDataResults.samplesQ[ch][i] = buffers[ch][2 * i + 1]; + m_fftCalcIn[i].r = buffers[ch][2 * i] * wndFunc[i] * ampCorr; + m_fftCalcIn[i].i = buffers[ch][2 * i + 1] * wndFunc[i] * ampCorr; } kiss_fft(m_fftCalcPlan, m_fftCalcIn, m_fftCalcOut); for (int i = 0; i < fftSize; ++i) @@ -561,9 +595,15 @@ int output_index = 0; for (int i = fftSize / 2 + 1; i < fftSize; ++i) - localDataResults.fftBins_dbFS[ch][output_index++] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + { + localDataResults.fftBins_dbFS[ch][output_index] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + localDataResults.fftBins[ch][output_index++] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + } for (int i = 0; i < fftSize / 2 + 1; ++i) - localDataResults.fftBins_dbFS[ch][output_index++] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + { + localDataResults.fftBins_dbFS[ch][output_index] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + localDataResults.fftBins[ch][output_index++] = sqrt(m_fftCalcOut[i].r * m_fftCalcOut[i].r + m_fftCalcOut[i].i * m_fftCalcOut[i].i); + } for (int s = 0; s < fftSize; ++s) localDataResults.fftBins_dbFS[ch][s] = (localDataResults.fftBins_dbFS[ch][s] != 0 ? (20 * log10(localDataResults.fftBins_dbFS[ch][s])) - 69.2369 : -300); } @@ -580,9 +620,10 @@ stopTx.store(true); stopRx.store(true); - threadTx.join(); + if(transmitReceivedSamples) + threadTx.join(); threadRx.join(); - + //stop Tx Rx if they were active interface_ctrl_000A = Reg_read(pthis->mDataPort, 0x000A); Reg_write(pthis->mDataPort, 0x000A, interface_ctrl_000A & ~0x3); @@ -592,6 +633,23 @@ for (int i = 0; i < channelsCount; ++i) delete[] buffers[i]; delete []buffers; + + if(captureToFile) + { + ofstream fout; + fout.open(pthis->captureFilename.c_str()); + fout << "AI\tAQ"; + if(channelsCount > 1) + fout << "\tBI\tBQ"; + fout << endl; + int samplesCnt = capturedSamples.size(); + for(int i=0; i> 8) & 0x0F | 0x10; + dataStart[b + 1 + 4 * ch] = ((outSamples[ch][samplesCollected].i >> 8) & 0x0F) | 0x10; //Q sample dataStart[b + 2 + 4 * ch] |= (outSamples[ch][samplesCollected].q ) & 0xFF; @@ -942,3 +1000,15 @@ else return 0; } + +void StreamerLTE::SetCaptureToFile(bool enable, const char* filename, uint32_t samplesCount) +{ + captureToFile = enable; + captureFilename = filename; + samplesToCapture = samplesCount; +} + +void StreamerLTE::SetWidowFunction(int func) +{ + windowFunction = func; +} diff -Nru limesuite-16.6.6.818.730.60b8d25/src/LTEpackets/StreamerLTE.h limesuite-16.8.1.819.792.4165104/src/LTEpackets/StreamerLTE.h --- limesuite-16.6.6.818.730.60b8d25/src/LTEpackets/StreamerLTE.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/LTEpackets/StreamerLTE.h 2016-08-25 18:57:42.000000000 +0000 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "dataTypes.h" @@ -68,6 +69,7 @@ std::vector samplesI[2]; std::vector samplesQ[2]; std::vector fftBins_dbFS[2]; + std::vector fftBins[2]; float nyquist_Hz; float rxDataRate_Bps; float txDataRate_Bps; @@ -85,6 +87,9 @@ this->fftBins_dbFS[ch].clear(); this->fftBins_dbFS[ch].reserve(src.fftBins_dbFS[ch].size()); this->fftBins_dbFS[ch] = src.fftBins_dbFS[ch]; + this->fftBins[ch].clear(); + this->fftBins[ch].reserve(src.fftBins[ch].size()); + this->fftBins[ch] = src.fftBins[ch]; this->nyquist_Hz = src.nyquist_Hz; this->rxDataRate_Bps = src.rxDataRate_Bps; this->txDataRate_Bps = src.txDataRate_Bps; @@ -117,6 +122,8 @@ DataToGUI GetIncomingData(); Stats GetStats(); + void SetCaptureToFile(bool enable, const char* filename, uint32_t samplesCount); + void SetWidowFunction(int func); protected: static STATUS Reg_write(IConnection* dataPort, uint16_t address, uint16_t data); static uint16_t Reg_read(IConnection* dataPort, uint16_t address); @@ -146,5 +153,10 @@ std::atomic mRxDataRate; std::atomic mTxDataRate; + + bool captureToFile; + uint32_t samplesToCapture; + std::string captureFilename; + int windowFunction; }; } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/oglGraph/dlgMarkers.cpp limesuite-16.8.1.819.792.4165104/src/oglGraph/dlgMarkers.cpp --- limesuite-16.6.6.818.730.60b8d25/src/oglGraph/dlgMarkers.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/oglGraph/dlgMarkers.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -30,7 +30,7 @@ dlgMarkers::dlgMarkers(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { initialized = false; - BuildContent(parent,id,pos,size); + BuildContent(parent,id,pos,size); } void dlgMarkers::BuildContent(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) @@ -78,25 +78,26 @@ chk = new wxCheckBox(pnl, markerId, "display"); FlexGridSizer3->Add(chk, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); shows.push_back(chk); - wxStaticText *StaticText2 = new wxStaticText(pnl, markerId, wxString::Format("Marker%i freq(MHz):", id), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); - FlexGridSizer3->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - wxTextCtrl *TextCtrl1 = new wxTextCtrl(pnl, markerId, _T("0.0"), wxDefaultPosition, wxSize(48,-1), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_TEXTCTRL1")); - freqs.push_back(TextCtrl1); - FlexGridSizer3->Add(TextCtrl1, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* StaticText3 = new wxStaticText(pnl, markerId, _T("value (dB):"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); - FlexGridSizer3->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* StaticText4 = new wxStaticText(pnl, markerId, _T("0.0"), wxDefaultPosition, wxSize(64,-1), 0, _T("ID_STATICTEXT4")); - labels.push_back(StaticText4); - marker_values.push_back(0); - FlexGridSizer3->Add(StaticText4, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); - Connect(markerId,wxEVT_CHECKBOX,(wxObjectEventFunction)&dlgMarkers::OnMarkerChange); - Connect(markerId,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&dlgMarkers::OnMarkerChange); - pnl->SetSizer(FlexGridSizer3); - sizerMarkerList->Add(pnl, 1, wxALIGN_LEFT|wxALIGN_TOP, 5); - pnl->Layout(); - FlexGridSizer1->Layout(); - Fit(); - parent_graph->markers[index].used = false; + wxStaticText *StaticText2 = new wxStaticText(pnl, markerId, wxString::Format("Marker%i freq(MHz):", id), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); + FlexGridSizer3->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxTextCtrl *TextCtrl1 = new wxTextCtrl(pnl, markerId, _T("0.0"), wxDefaultPosition, wxSize(48,-1), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_TEXTCTRL1")); + freqs.push_back(TextCtrl1); + FlexGridSizer3->Add(TextCtrl1, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxStaticText* StaticText3 = new wxStaticText(pnl, markerId, _T("value (dB):"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); + FlexGridSizer3->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxStaticText* StaticText4 = new wxStaticText(pnl, markerId, _T("0.0"), wxDefaultPosition, wxSize(168,-1), 0, _T("ID_STATICTEXT4")); + labels.push_back(StaticText4); + marker_valuesA.push_back(0); + marker_valuesB.push_back(0); + FlexGridSizer3->Add(StaticText4, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); + Connect(markerId,wxEVT_CHECKBOX,(wxObjectEventFunction)&dlgMarkers::OnMarkerChange); + Connect(markerId,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&dlgMarkers::OnMarkerChange); + pnl->SetSizer(FlexGridSizer3); + sizerMarkerList->Add(pnl, 1, wxALIGN_LEFT|wxALIGN_TOP, 5); + pnl->Layout(); + FlexGridSizer1->Layout(); + Fit(); + parent_graph->markers[index].used = false; } void dlgMarkers::AddDeltas() @@ -123,15 +124,15 @@ dsrc1->SetSelection(0); deltaSrc.push_back(dsrc1); FlexGridSizer3->Add(dsrc1, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* lblDelta0 = new wxStaticText(pnl, wxNewId(), _T("0.0 dB"), wxDefaultPosition, wxSize(74,-1), 0, _T("ID_STATICTEXT2")); + wxStaticText* lblDelta0 = new wxStaticText(pnl, wxNewId(), _T("0.0 dB"), wxDefaultPosition, wxSize(180,-1), 0, _T("ID_STATICTEXT2")); deltaValues.push_back(lblDelta0); FlexGridSizer3->Add(lblDelta0, 1, wxALL|wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 10); pnl->SetSizer(FlexGridSizer3); sizerDeltasList->Add(pnl, 1, wxALIGN_LEFT|wxALIGN_TOP, 5); pnl->Layout(); } - FlexGridSizer1->Layout(); - Fit(); + FlexGridSizer1->Layout(); + Fit(); } void dlgMarkers::OnbtnCloseClick(wxCommandEvent& event) @@ -157,21 +158,53 @@ { if(parent_graph == NULL) return; - double value = parent_graph->markers[i].posY; + if (!parent_graph->markers[i].used) + continue; + char text[128]; + double valueA = 0; + double valueB = 0; double freq = parent_graph->markers[i].posX/1000000; - labels[i]->SetLabel(wxString::Format("%3.1f", value)); - marker_values[i] = value; + int cnt=0; + + if(parent_graph->series[0]->size > 0 && parent_graph->series[0]->visible) + { + valueA = parent_graph->series[0]->values[parent_graph->markers[i].dataValueIndex+1]; + cnt = sprintf(text, "%3.1f (ChA) ; ",valueA); + } + + if(parent_graph->series[1]->size > 0 && parent_graph->series[1]->visible) + { + valueB = parent_graph->series[1]->values[parent_graph->markers[i].dataValueIndex+1]; + sprintf(text+cnt, "%3.1f (ChB) ;",valueB); + } + + labels[i]->SetLabel(wxString(text)); + marker_valuesA[i] = valueA; + marker_valuesB[i] = valueB; enables[i]->SetValue(parent_graph->markers[i].used); shows[i]->SetValue(parent_graph->markers[i].show); + freqs[i]->SetValue(wxString::Format("%3.2f", freq)); } for(int i=0; i<5; ++i) { - float deltaValue = 0; int src1 = deltaSrc[2*i]->GetSelection(); int src2 = deltaSrc[2*i+1]->GetSelection(); - deltaValue = marker_values[src1]-marker_values[src2]; - deltaValues[i]->SetLabel(wxString::Format("%.3f dB", deltaValue)); + char text[128]={0}; + int cnt = 0; + + if(parent_graph->series[0]->size > 0 && parent_graph->series[0]->visible) + { + float deltaValue = marker_valuesA[src1]-marker_valuesA[src2]; + cnt = sprintf(text, "%.3f (ChA) ; ",deltaValue); + } + + if(parent_graph->series[1]->size > 0 && parent_graph->series[1]->visible) + { + float deltaValue = marker_valuesB[src1]-marker_valuesB[src2]; + sprintf(text+cnt, "%.3f (ChB)",deltaValue); + } + deltaValues[i]->SetLabel(wxString(text)); } } } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/oglGraph/dlgMarkers.h limesuite-16.8.1.819.792.4165104/src/oglGraph/dlgMarkers.h --- limesuite-16.6.6.818.730.60b8d25/src/oglGraph/dlgMarkers.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/oglGraph/dlgMarkers.h 2016-08-25 18:57:42.000000000 +0000 @@ -27,9 +27,10 @@ dlgMarkers(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize); virtual ~dlgMarkers(); - OpenGLGraph* parent_graph; + OpenGLGraph* parent_graph; void AddMarker(int id); - std::vector marker_values; + std::vector marker_valuesA; + std::vector marker_valuesB; std::vector labels; std::vector freqs; std::vector enables; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/oglGraph/OpenGLGraph.cpp limesuite-16.8.1.819.792.4165104/src/oglGraph/OpenGLGraph.cpp --- limesuite-16.6.6.818.730.60b8d25/src/oglGraph/OpenGLGraph.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/oglGraph/OpenGLGraph.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -26,6 +26,13 @@ const unsigned int OpenGLGraph::mMarkerColors[] = {0x000000FF, 0x0000FFFF, 0xFF0000FF, 0xFF7F00FF, 0x007FFFFF, 0xFF00FFFF, 0x007F00FF, 0x00007FFF, 0x7F0000FF, 0x00FF00FF}; const long markers_timer_id = wxNewId(); +const int OpenGLGraph::GLCanvasAttributes[8] = { + WX_GL_RGBA, + WX_GL_DOUBLEBUFFER, + WX_GL_DEPTH_SIZE, 16, + WX_GL_STENCIL_SIZE, 0, + 0, 0 } ; + GLG_settings::GLG_settings() : title(""), titleXaxis(""), titleYaxis(""), xUnits(""), yUnits(""), @@ -53,8 +60,8 @@ OpenGLGraph::OpenGLGraph(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style=0, const wxString& name="GLCanvas", - int* args = 0) + long style=0, const wxString& name, + const int* args) : wxGLCanvas(parent, id, args, pos, size, wxNO_FULL_REPAINT_ON_RESIZE), initialDisplayArea(-100, 100, -100, 100), m_MouseCoord(0, 0, 0, 0), oglOk(true) { @@ -1260,28 +1267,35 @@ for(unsigned i=0; ivalues[markers[i].dataValueIndex+1]; - // X axis grid lines - posY = settings.marginBottom + ((series[0]->values[markers[i].dataValueIndex+1]-settings.visibleArea.y1)/pixelYvalue); - posX = settings.marginLeft + ((markers[i].posX-settings.visibleArea.x1)/pixelXvalue); - markers[i].iposX = posX; - markers[i].iposY = posY; - markers[i].size = 10; - if(posX >= settings.marginLeft && posX <= settings.windowWidth-settings.marginRight) - { - markers[i].color = mMarkerColors[i]; - glColor4f(markers[i].color.red, markers[i].color.green, markers[i].color.blue, markers[i].color.alpha); - if( posY >= settings.marginBottom && posY <= settings.windowHeight-settings.marginTop) - { - glVertex3f( posX, posY, 10); - glVertex3f( posX+markers[i].size, posY+markers[i].size, 10); - glVertex3f( posX-markers[i].size, posY+markers[i].size, 10); - } - glVertex3f( posX, settings.marginBottom+markers[i].size, 10); - glVertex3f( posX-markers[i].size, settings.marginBottom, 10); - glVertex3f( posX+markers[i].size, settings.marginBottom, 10); - } + continue; + for(unsigned int j=0; jsize > 0 && series[j]->visible) + { + markers[i].posY = series[j]->values[markers[i].dataValueIndex+1]; + // X axis grid lines + posY = settings.marginBottom + ((series[j]->values[markers[i].dataValueIndex+1]-settings.visibleArea.y1)/pixelYvalue); + posX = settings.marginLeft + ((markers[i].posX-settings.visibleArea.x1)/pixelXvalue); + markers[i].iposX = posX; + markers[i].iposY = posY; + markers[i].size = 10; + + if(posX >= settings.marginLeft && posX <= settings.windowWidth-settings.marginRight) + { + markers[i].color = mMarkerColors[i]; + glColor4f(markers[i].color.red, markers[i].color.green, markers[i].color.blue, markers[i].color.alpha); + if( posY >= settings.marginBottom && posY <= settings.windowHeight-settings.marginTop) + { + glVertex3f( posX, posY, 10); + glVertex3f( posX+markers[i].size, posY+markers[i].size, 10); + glVertex3f( posX-markers[i].size, posY+markers[i].size, 10); + } + glVertex3f( posX, settings.marginBottom+markers[i].size, 10); + glVertex3f( posX-markers[i].size, settings.marginBottom, 10); + glVertex3f( posX+markers[i].size, settings.marginBottom, 10); + } + } + } } glEnd(); glFlush(); @@ -1293,17 +1307,22 @@ for(unsigned i=0; ivalues[markers[i].dataValueIndex]/1000000, series[0]->values[markers[i].dataValueIndex+1]); - markers[i].posY = series[0]->values[markers[i].dataValueIndex+1]; - posX = settings.marginLeft; - posY = settings.windowHeight-settings.marginTop - hpos; - //glPrint(posX, posY, 0, textScale, "%s", text); - if(markers[i].show == false) - continue; - hpos += textScale*m_font->lineHeight(); - glRenderText(posX, posY, 0, textScale*m_font->lineHeight(), markers[i].color.getColor4b(), "%s", text); + continue; + glColor4f(markers[i].color.red, markers[i].color.green, markers[i].color.blue, markers[i].color.alpha); + int cnt = sprintf(text, "M%i: % .3f MHz ", i, series[0]->values[markers[i].dataValueIndex]/1000000); + + for(unsigned int j=0; jsize > 0 && series[j]->visible) + cnt += sprintf(text+cnt, "/ Ch %c: %#+3.1f dBFS ", 65+j, series[j]->values[markers[i].dataValueIndex+1]); + + markers[i].posY = series[0]->values[markers[i].dataValueIndex+1]; + posX = settings.marginLeft; + posY = settings.windowHeight-settings.marginTop - hpos; + //glPrint(posX, posY, 0, textScale, "%s", text); + if(markers[i].show == false) + continue; + hpos += textScale*m_font->lineHeight(); + glRenderText(posX, posY, 0, textScale*m_font->lineHeight(), markers[i].color.getColor4b(), "%s", text); } } } @@ -1322,12 +1341,26 @@ continue; if( X > markers[i].iposX-markers[i].size && X < markers[i].iposX+markers[i].size ) { - if( (Y > settings.marginBottom && Y < settings.marginBottom+markers[i].size) || - (Y > markers[i].iposY && Y < markers[i].iposY+markers[i].size) ) + if(Y > settings.marginBottom && Y < settings.marginBottom+markers[i].size) { printf("selected %i marker\n", i); - return i; - } + return i; + } + + for(unsigned int j=0; jsize > 0 && series[j]->visible) + { + float pixelYvalue = (settings.visibleArea.y2 - settings.visibleArea.y1)/ settings.dataViewHeight; + int posY = settings.marginBottom + ((series[j]->values[markers[i].dataValueIndex+1]-settings.visibleArea.y1)/pixelYvalue); + if(Y > posY && Y < posY+markers[i].size) + { + printf("selected %i marker\n", i); + return i; + } + } + } + } } return -1; @@ -1593,17 +1626,42 @@ bool OpenGLGraph::SearchPeak() { bool found = false; - //check if series have any data to mark - if(series[0]->size > 0) + double maxValue; + unsigned maxPos; + //Init max value + for(unsigned int i=0; isize; ++i) + if(series[i]->size > 0 && series[i]->visible) + { + maxValue = series[i]->values[1]; + found = true; + break; + } + } + //Find max position + for(unsigned int i=0; isize > 0 && series[i]->visible) { - if(series[0]->values[maxPos] < series[0]->values[2*i+1]) - maxPos = 2*i+1; + for(unsigned j=0; jsize; ++j) + { + if(maxValue < series[i]->values[2*j+1]) + { + maxValue = series[i]->values[2*j+1]; + maxPos = 2*j+1; + } + } + } + } + + //Mark max position + for(unsigned int i=0; isize > 0 && series[i]->visible) + { + AddMarkerAtValue(series[i]->values[maxPos-1]); + break; } - AddMarkerAtValue(series[0]->values[maxPos-1]); - found = true; } return found; } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/oglGraph/OpenGLGraph.h limesuite-16.8.1.819.792.4165104/src/oglGraph/OpenGLGraph.h --- limesuite-16.6.6.818.730.60b8d25/src/oglGraph/OpenGLGraph.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/oglGraph/OpenGLGraph.h 2016-08-25 18:57:42.000000000 +0000 @@ -282,7 +282,9 @@ { friend class dlgMarkers; public: - OpenGLGraph(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int* args); + static const int GLCanvasAttributes[8]; + + OpenGLGraph(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name = wxEmptyString, const int* args = GLCanvasAttributes); virtual ~OpenGLGraph(); bool Initialize(int width, int height); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/protocols/LMS64CProtocol.cpp limesuite-16.8.1.819.792.4165104/src/protocols/LMS64CProtocol.cpp --- limesuite-16.6.6.818.730.60b8d25/src/protocols/LMS64CProtocol.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/protocols/LMS64CProtocol.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -34,6 +34,7 @@ case STATUS_COMPLETED_CMD: return 0; case STATUS_UNKNOWN_CMD: return ReportError(EPROTONOSUPPORT, "unknown lms64c protocol command"); + default: break; } return ReportError(EPROTO, status2string(pkt.status)); } @@ -485,7 +486,7 @@ ParsePacket(pkt, inBuffer, inDataPos, protocol); } delete outBuffer; - delete inBuffer; + delete[] inBuffer; return status; } @@ -646,7 +647,10 @@ #ifndef NDEBUG auto t1 = std::chrono::high_resolution_clock::now(); #endif + //erasing FLASH can take up to 3 seconds before reply is received + const int progTimeout_ms = 5000; char progressMsg[128]; + sprintf(progressMsg, "in progress..."); bool abortProgramming = false; int bytesSent = 0; @@ -681,7 +685,7 @@ sprintf(progressMsg, "Programming failed! Target device not supported"); if(callback) abortProgramming = callback(bytesSent, length, progressMsg); - return ReportError(progressMsg); + return ReportError(ENOTSUP, progressMsg); } unsigned char ctrbuf[64]; @@ -722,13 +726,13 @@ { if(callback) callback(bytesSent, length, "Programming failed! Write operation failed"); - return ReportError("Programming failed! Write operation failed"); + return ReportError(EIO, "Programming failed! Write operation failed"); } - if(Read(inbuf, sizeof(inbuf)) != sizeof(ctrbuf)) + if(Read(inbuf, sizeof(inbuf), progTimeout_ms) != sizeof(ctrbuf)) { if(callback) callback(bytesSent, length, "Programming failed! Read operation failed"); - return ReportError("Programming failed! Read operation failed"); + return ReportError(EIO, "Programming failed! Read operation failed"); } data_left -= data_cnt; status = inbuf[1]; @@ -739,29 +743,19 @@ sprintf(progressMsg, "Programming failed! %s", status2string(status)); if(callback) abortProgramming = callback(bytesSent, length, progressMsg); -#ifndef NDEBUG - printf("\n%s\n", progressMsg); -#endif - return ReportError(EPROTO); + return ReportError(EPROTO, progressMsg); } if(needsData == false) //only one packet is needed to initiate bitstream from flash { bytesSent = length; break; } - sprintf(progressMsg, "programing: %6i/%i", portionNumber, portionsCount - 1); if(callback) abortProgramming = callback(bytesSent, length, progressMsg); -#ifndef NDEBUG - printf("%s\r", progressMsg); -#endif } if (abortProgramming == true) { sprintf(progressMsg, "programming: aborted by user"); -#ifndef NDEBUG - printf("\n%s\n", progressMsg); -#endif if(callback) callback(bytesSent, length, progressMsg); return ReportError(ECONNABORTED, "user aborted programming"); @@ -772,9 +766,9 @@ #ifndef NDEBUG auto t2 = std::chrono::high_resolution_clock::now(); if ((device == 2 && prog_mode == 2) == false) - printf("\nProgramming finished, %li bytes sent! %li ms\n", length, std::chrono::duration_cast(t2 - t1).count()); + printf("Programming finished, %li bytes sent! %li ms\n", length, std::chrono::duration_cast(t2 - t1).count()); else - printf("\nFPGA configuring initiated\n"); + printf("FPGA configuring initiated\n"); #endif return 0; } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.cpp limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.cpp --- limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.cpp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -35,10 +35,14 @@ m_staticText473->Wrap( -1 ); fgSizer212->Add( m_staticText473, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - mListLMS7ports = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( -1,150 ), 0, NULL, 0 ); + mListLMS7ports = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0, NULL, 0 ); + mListLMS7ports->SetMinSize( wxSize( 300,150 ) ); + fgSizer212->Add( mListLMS7ports, 0, wxALL|wxEXPAND, 5 ); mListStreamports = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + mListStreamports->SetMinSize( wxSize( 300,150 ) ); + fgSizer212->Add( mListStreamports, 0, wxALL|wxEXPAND, 5 ); @@ -53,16 +57,16 @@ fgSizer213->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); btnConnect = new wxButton( this, wxID_ANY, wxT("Connect"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer213->Add( btnConnect, 0, wxALL, 5 ); + fgSizer213->Add( btnConnect, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); btnCancel = new wxButton( this, wxID_ANY, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer213->Add( btnCancel, 0, wxALL, 5 ); + fgSizer213->Add( btnCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); btnDisconnect = new wxButton( this, wxID_ANY, wxT("Disconnect"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer213->Add( btnDisconnect, 0, wxALL, 5 ); + fgSizer213->Add( btnDisconnect, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - fgSizer211->Add( fgSizer213, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + fgSizer211->Add( fgSizer213, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); this->SetSizer( fgSizer211 ); diff -Nru limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.fbp limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.fbp --- limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.fbp 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.fbp 2016-08-25 18:57:42.000000000 +0000 @@ -45,7 +45,7 @@ dlgConnectionSettings_view - wxDEFAULT_DIALOG_STYLE + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Connection Settings @@ -320,7 +320,7 @@ 0 - + 300,150 1 mListLMS7ports 1 @@ -331,7 +331,7 @@ Resizable 1 - -1,150 + -1,-1 0 @@ -408,7 +408,7 @@ 0 - + 300,150 1 mListStreamports 1 @@ -462,7 +462,7 @@ 5 - wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL 1 3 @@ -478,7 +478,7 @@ 0 5 - wxALL + wxALL|wxALIGN_CENTER_HORIZONTAL 0 1 @@ -566,7 +566,7 @@ 5 - wxALL + wxALL|wxALIGN_CENTER_HORIZONTAL 0 1 @@ -654,7 +654,7 @@ 5 - wxALL + wxALL|wxALIGN_CENTER_HORIZONTAL 0 1 diff -Nru limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.h limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.h --- limesuite-16.6.6.818.730.60b8d25/src/utilities_gui/utilities_gui.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/utilities_gui/utilities_gui.h 2016-08-25 18:57:42.000000000 +0000 @@ -53,7 +53,7 @@ public: - dlgConnectionSettings_view( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Connection Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + dlgConnectionSettings_view( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Connection Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~dlgConnectionSettings_view(); }; diff -Nru limesuite-16.6.6.818.730.60b8d25/src/version.h limesuite-16.8.1.819.792.4165104/src/version.h --- limesuite-16.6.6.818.730.60b8d25/src/version.h 2016-06-26 16:26:16.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/version.h 2016-08-25 18:57:42.000000000 +0000 @@ -6,11 +6,11 @@ namespace AutoVersion { static const int year = 2016; - static const int month = 6; - static const int day = 6; + static const int month = 8; + static const int day = 23; static const int hour = 17; - static const int minutes = 12; - static const int seconds = 49; - static const int buildsCounter = 818; + static const int minutes = 0; + static const int seconds = 27; + static const int buildsCounter = 819; static const char branchName[] = ""; } diff -Nru limesuite-16.6.6.818.730.60b8d25/src/windowFunction.cpp limesuite-16.8.1.819.792.4165104/src/windowFunction.cpp --- limesuite-16.6.6.818.730.60b8d25/src/windowFunction.cpp 1970-01-01 00:00:00.000000000 +0000 +++ limesuite-16.8.1.819.792.4165104/src/windowFunction.cpp 2016-08-25 18:57:42.000000000 +0000 @@ -0,0 +1,50 @@ +#include "windowFunction.h" +#include + +void GenerateWindowCoefficients(int func, int coefCount, std::vector &windowFcoefs, float &litudeCorrection) +{ + windowFcoefs.clear(); + + windowFcoefs.resize(coefCount); + float a0 = 0.35875; + float a1 = 0.48829; + float a2 = 0.14128; + float a3 = 0.01168; + float a4 = 1; + int N = coefCount; + float PI = 3.14159265359; + switch(func) + { + case 1: //blackman-harris + for (int i = 0; i + +void GenerateWindowCoefficients(int func, int fftsize, std::vector &windowFcoefs, float &litudeCorrection); + +#endif \ No newline at end of file