diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c819939..c3a85ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: # Put git hash in startup message sed -i "s/Loading.../$(date +%Y%m%d)-$(git rev-parse --short HEAD)/g" src/userinterface.cpp # https://github.com/rsta2/circle/discussions/427#discussioncomment-11198505 - sed -i -e 's|TTLShort = 120|TTLShort = 15|g' circle-stdlib/libs/circle/include/circle/net/mdnspublisher.h + # sed -i -e 's|TTLShort = 120|TTLShort = 15|g' circle-stdlib/libs/circle/include/circle/net/mdnspublisher.h - name: Install toolchains run: | set -ex diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 3c2a183..64ad2cf 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -62,8 +62,9 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, m_WLAN(WLANFirmwarePath), m_WPASupplicant(WLANConfigFile), m_bNetworkReady(false), + m_bNetworkInit(false), m_UDPMIDI (this, pConfig, &m_UI), - m_pmDNSPublisher (), + //m_pmDNSPublisher (nullptr), m_bSavePerformance (false), m_bSavePerformanceNewFile (false), m_bSetNewPerformance (false), @@ -367,12 +368,14 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) CScheduler* const pScheduler = CScheduler::Get(); #ifndef ARM_ALLOW_MULTI_CORE ProcessSound (); + pScheduler->Yield(); #endif for (unsigned i = 0; i < CConfig::MaxUSBMIDIDevices; i++) { assert (m_pMIDIKeyboard[i]); m_pMIDIKeyboard[i]->Process (bPlugAndPlayUpdated); + pScheduler->Yield(); } m_PCKeyboard.Process (bPlugAndPlayUpdated); @@ -380,6 +383,7 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) if (m_bUseSerial) { m_SerialMIDI.Process (); + pScheduler->Yield(); } m_UI.Process (); @@ -389,12 +393,14 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) DoSavePerformance (); m_bSavePerformance = false; + pScheduler->Yield(); } if (m_bSavePerformanceNewFile) { DoSavePerformanceNewFile (); m_bSavePerformanceNewFile = false; + pScheduler->Yield(); } if (m_bSetNewPerformanceBank && !m_bLoadPerformanceBusy && !m_bLoadPerformanceBankBusy) @@ -412,6 +418,7 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) { DoSetFirstPerformance(); } + pScheduler->Yield(); } if (m_bSetNewPerformance && !m_bSetNewPerformanceBank && !m_bLoadPerformanceBusy && !m_bLoadPerformanceBankBusy) @@ -421,17 +428,20 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) { m_bSetNewPerformance = false; } + pScheduler->Yield(); } if(m_bDeletePerformance) { DoDeletePerformance (); m_bDeletePerformance = false; + pScheduler->Yield(); } if (m_bProfileEnabled) { m_GetChunkTimer.Dump (); + pScheduler->Yield(); } UpdateNetwork(); // Allow other tasks to run @@ -2190,16 +2200,17 @@ void CMiniDexed::UpdateNetwork() if (!m_pNet) return; + //add wired network check as well //add wired network check as well bool bNetIsRunning = m_pNet->IsRunning(); - if ((strcmp(m_pConfig->GetNetworkType(), "ethernet") == 0)) + if (m_pNetDevice->GetType() == NetDeviceTypeEthernet) bNetIsRunning &= m_pNetDevice->IsLinkUp(); - else if ((strcmp(m_pConfig->GetNetworkType(), "wifi") == 0)) + else if (m_pNetDevice->GetType() == NetDeviceTypeWLAN) bNetIsRunning &= m_WPASupplicant.IsConnected(); - if (!m_bNetworkReady && (m_pNet->IsRunning())) + if (!m_bNetworkInit) { - m_bNetworkReady = true; + m_bNetworkInit = true; CString IPString; m_pNet->GetConfig()->GetIPAddress()->Format(&IPString); @@ -2219,39 +2230,37 @@ void CMiniDexed::UpdateNetwork() { LOGNOTE("FTP daemon initialized"); } - m_UI.DisplayWrite ("IP", "Network", IPString, 0, 1); - CmDNSPublisher *pmDNSPublisher = new CmDNSPublisher (m_pNet); - assert (pmDNSPublisher); - static const char ServiceName[] = "MiniDexed"; - static const char *ppText[] = {"RTP-MIDI Receiver", nullptr}; // TXT record strings - if (!pmDNSPublisher->PublishService (ServiceName, CmDNSPublisher::ServiceTypeAppleMIDI, - 5004, ppText)) - { - LOGPANIC ("Cannot publish mdns service"); - } - static const char *ppText2[] = {"FTP Server", nullptr}; // TXT record strings - static constexpr const char *ServiceTypeFTP = "_ftp._tcp"; - if (!pmDNSPublisher->PublishService (ServiceName, ServiceTypeFTP, - 21, ppText2)) + /*m_pmDNSPublisher = new CmDNSPublisher (m_pNet); + assert (m_pmDNSPublisher); + + //static const char *ppText[] = {"RTP-MIDI Receiver", nullptr}; // dont bother adding additional data + if (!m_pmDNSPublisher->PublishService (MDNSSERVICENAME, CmDNSPublisher::ServiceTypeAppleMIDI, + 5004)) { LOGPANIC ("Cannot publish mdns service"); } + */ + m_bNetworkReady = true; } - else if (m_bNetworkReady && !bNetIsRunning) + + if (m_bNetworkReady && !bNetIsRunning) { - //m_bNetworkReady = false; - m_pmDNSPublisher->UnpublishService (MDNSSERVICENAME); + m_bNetworkReady = false; + //m_pmDNSPublisher->UnpublishService (MDNSSERVICENAME); LOGNOTE("Network disconnected."); } - else if (m_bNetworkReady && bNetIsRunning) + else if (!m_bNetworkReady && bNetIsRunning) { + m_bNetworkReady = true; + /* if (!m_pmDNSPublisher->PublishService (MDNSSERVICENAME, CmDNSPublisher::ServiceTypeAppleMIDI, 5004)) { LOGPANIC ("Cannot publish mdns service"); } + */ LOGNOTE("Network connection reestablished."); } diff --git a/src/minidexed.h b/src/minidexed.h index 7a691c4..0c29978 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -43,7 +43,7 @@ #include #include #include -#include +//#include #include #include "common.h" #include "effect_mixer.hpp" @@ -338,9 +338,10 @@ private: CBcm4343Device m_WLAN; CWPASupplicant m_WPASupplicant; bool m_bNetworkReady; + bool m_bNetworkInit; CUDPMIDIDevice m_UDPMIDI; CFTPDaemon* m_pFTPDaemon; - CmDNSPublisher *m_pmDNSPublisher; + //CmDNSPublisher *m_pmDNSPublisher; bool m_bSavePerformance; bool m_bSavePerformanceNewFile; diff --git a/src/net/applemidi.cpp b/src/net/applemidi.cpp index 3c96629..e14b216 100644 --- a/src/net/applemidi.cpp +++ b/src/net/applemidi.cpp @@ -803,7 +803,7 @@ bool CAppleMIDIParticipant::SendAcceptInvitationPacket(CSocket* pSocket, CIPAddr }; // TODO: configurable name - strncpy(AcceptPacket.Name, "minidexed", sizeof(AcceptPacket.Name)); + strncpy(AcceptPacket.Name, "MiniDexed", sizeof(AcceptPacket.Name)); #ifdef APPLEMIDI_DEBUG LOGNOTE("--> Accept invitation"); diff --git a/src/net/ftpworker.cpp b/src/net/ftpworker.cpp index f61b07b..f7438ce 100644 --- a/src/net/ftpworker.cpp +++ b/src/net/ftpworker.cpp @@ -61,6 +61,7 @@ struct TDirectoryListEntry u32 nSize; u16 nLastModifedDate; u16 nLastModifedTime; + //bool bHid; }; using TCommandHandler = bool (CFTPWorker::*)(const char* pArgs); @@ -422,6 +423,7 @@ const TDirectoryListEntry* CFTPWorker::BuildDirectoryList(size_t& nOutEntries) c { Entry.Type = TDirectoryListEntryType::File; Entry.nSize = FileInfo.fsize; + //Entry.bHid = (FileInfo.fattrib & AM_HID) ? true : false; } Entry.nLastModifedDate = FileInfo.fdate; @@ -984,7 +986,10 @@ bool CFTPWorker::ListFileNames(const char* pArgs) const TDirectoryListEntry& Entry = pDirEntries[i]; if (Entry.Type == TDirectoryListEntryType::Directory) continue; - + /*if (Entry.Name == "wpa_supplicant.conf") + { + continue; + }*/ const int nLength = snprintf(Buffer, sizeof(Buffer), "%s\r\n", Entry.Name); if (pDataSocket->Send(Buffer, nLength, 0) < 0) { diff --git a/src/rtpmididevice.cpp b/src/rtpmididevice.cpp deleted file mode 100644 index 572a5c9..0000000 --- a/src/rtpmididevice.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// serialmididevice.cpp -// -// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi -// Copyright (C) 2022 The MiniDexed Team -// -// Original author of this class: -// R. Stange -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -#include -#include -#include "rtpmididevice.h" -#include - -#define VIRTUALCABLE 24 - -LOGMODULE("rtpmididevice"); - -CRTPMIDIDevice::CRTPMIDIDevice (CMiniDexed *pSynthesizer, - CConfig *pConfig, CUserInterface *pUI) -: CMIDIDevice (pSynthesizer, pConfig, pUI), - m_pConfig (pConfig) -{ - AddDevice ("rtpdummy"); -} - -CRTPMIDIDevice::~CRTPMIDIDevice (void) -{ - -} - -boolean CRTPMIDIDevice::Initialize (void) -{ - m_pAppleMIDIParticipant = new CAppleMIDIParticipant(&m_Random, this); - if (!m_pAppleMIDIParticipant->Initialize()) - { - LOGERR("Failed to init RTP listener"); - return false; //continue without rtp midi - } - else - LOGNOTE("RTP Listener initialized"); - return true; -} - -// Methods to handle MIDI events - -void CRTPMIDIDevice::OnAppleMIDIDataReceived(const u8* pData, size_t nSize) -{ - MIDIMessageHandler(pData, nSize, VIRTUALCABLE); -} - -void CRTPMIDIDevice::OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName) -{ - LOGNOTE("RTP Device connected"); -} - -void CRTPMIDIDevice::OnAppleMIDIDisconnect(const CIPAddress* pIPAddress, const char* pName) -{ - // RemoveRTPDevice -} diff --git a/src/rtpmididevice.h b/src/rtpmididevice.h deleted file mode 100644 index 870301b..0000000 --- a/src/rtpmididevice.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// .h -// -// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi -// Copyright (C) 2022 The MiniDexed Team -// -// Original author of this class: -// R. Stange -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -#ifndef _rtpmididevice_h -#define _rtpmididevice_h - -#include "mididevice.h" -#include "config.h" -#include "net/applemidi.h" - -class CMiniDexed; - -class CRTPMIDIDevice : CAppleMIDIHandler, CMIDIDevice -{ -public: - CRTPMIDIDevice (CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInterface *pUI); - ~CRTPMIDIDevice (void); - - boolean Initialize (void); - virtual void OnAppleMIDIDataReceived(const u8* pData, size_t nSize) override; - virtual void OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName) override; - virtual void OnAppleMIDIDisconnect(const CIPAddress* pIPAddress, const char* pName) override; - -private: - CConfig *m_pConfig; - CBcmRandomNumberGenerator m_Random; - CAppleMIDIParticipant* m_pAppleMIDIParticipant; -}; - -#endif diff --git a/src/udpmididevice.cpp b/src/udpmididevice.cpp index 6080132..4b0d1c7 100644 --- a/src/udpmididevice.cpp +++ b/src/udpmididevice.cpp @@ -28,7 +28,7 @@ #define VIRTUALCABLE 24 -LOGMODULE("rtpmididevice"); +LOGMODULE("udpmididevice"); CUDPMIDIDevice::CUDPMIDIDevice (CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInterface *pUI) @@ -50,11 +50,11 @@ boolean CUDPMIDIDevice::Initialize (void) if (!m_pAppleMIDIParticipant->Initialize()) { LOGERR("Failed to init RTP listener"); - return false; //continue without rtp midi + delete m_pAppleMIDIParticipant; + m_pAppleMIDIParticipant = nullptr; } else LOGNOTE("RTP Listener initialized"); - return true; m_pUDPMIDIReceiver = new CUDPMIDIReceiver(this); if (!m_pUDPMIDIReceiver->Initialize()) { @@ -64,6 +64,7 @@ boolean CUDPMIDIDevice::Initialize (void) } else LOGNOTE("UDP MIDI receiver initialized"); + return true; } // Methods to handle MIDI events diff --git a/src/udpmididevice.h b/src/udpmididevice.h index 55bc7a2..de50172 100644 --- a/src/udpmididevice.h +++ b/src/udpmididevice.h @@ -22,8 +22,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . // -#ifndef _rtpmididevice_h -#define _rtpmididevice_h +#ifndef _udpmididevice_h +#define _udpmididevice_h #include "mididevice.h" #include "config.h" @@ -50,7 +50,6 @@ private: CBcmRandomNumberGenerator m_Random; CAppleMIDIParticipant* m_pAppleMIDIParticipant; // AppleMIDI participant instance CUDPMIDIReceiver* m_pUDPMIDIReceiver; - }; #endif diff --git a/submod.sh b/submod.sh index 78531dc..03bd0f0 100755 --- a/submod.sh +++ b/submod.sh @@ -6,13 +6,13 @@ git submodule update --init --recursive # # Use fixed master branch of circle-stdlib then re-update cd circle-stdlib/ -git checkout 3bd135d +git checkout tags/v16.5 git submodule update --init --recursive cd - # # Optional update submodules explicitly cd circle-stdlib/libs/circle -git checkout c243194 +git checkout tags/Step47 cd - cd circle-stdlib/libs/circle-newlib #git checkout develop