From df41211a11c77c248c4a42b4568d0a6db55f5d30 Mon Sep 17 00:00:00 2001 From: LX3JL Date: Tue, 22 Oct 2019 19:45:20 +0200 Subject: [PATCH] ambed 1.3.4 Solved issue when pairing a 3003 with a 3000. Solved issue when aggregating more than 2 devices --- ambed/cstream.cpp | 0 ambed/cvocodecs.cpp | 60 +++++++++++++++++++++++++++++++++++++-------- ambed/main.h | 2 +- ambed/readme | 4 +-- 4 files changed, 53 insertions(+), 13 deletions(-) mode change 100755 => 100644 ambed/cstream.cpp mode change 100755 => 100644 ambed/main.h diff --git a/ambed/cstream.cpp b/ambed/cstream.cpp old mode 100755 new mode 100644 diff --git a/ambed/cvocodecs.cpp b/ambed/cvocodecs.cpp index aa28707..c89e416 100644 --- a/ambed/cvocodecs.cpp +++ b/ambed/cvocodecs.cpp @@ -117,11 +117,12 @@ bool CVocodecs::Init(void) { descr2 = m_FtdiDeviceDescrs[j]; found = (!descr2->IsUsed() && (descr2->GetNbChannels() == 1)); + j++; } // found one ? if ( found ) { - // yes, create and pairboth interfaces + // yes, create and pair both interfaces iNbCh += CFtdiDeviceDescr::CreateInterfacePair(descr1, descr2, &PairsOf3000DevicesChs); // and flag as used descr1->SetUsed(true); @@ -138,24 +139,54 @@ bool CVocodecs::Init(void) CFtdiDeviceDescr *descr2 = NULL; if ( !descr1->IsUsed() && (descr1->GetNbChannels() == 3) ) { - // any other odd channel device to pair with ? - // any other single channel device to pair with ? + // any other 3 channel device to pair with ? bool found = false; int j = i+1; while ( !found && (j < m_FtdiDeviceDescrs.size()) ) { descr2 = m_FtdiDeviceDescrs[j]; - found = (!descr2->IsUsed() && IsOdd(descr2->GetNbChannels())); + found = (!descr2->IsUsed() && (descr2->GetNbChannels() == 3)); + j++; } // found one ? if ( found ) { - // yes, create and pairboth interfaces + // yes, create and pair both interfaces iNbCh += CFtdiDeviceDescr::CreateInterfacePair(descr1, descr2, &Multi3003DevicesChs); // and flag as used descr1->SetUsed(true); descr2->SetUsed(true); } + } + } + // at this point we should have only remaining an unique 3 channels + // and or a unique single channel + std::vector Combined3003And3000DeviceChannels; + for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) + { + CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i]; + CFtdiDeviceDescr *descr2 = NULL; + // Any 3003 ? + if ( !descr1->IsUsed() && (descr1->GetNbChannels() == 3) ) + { + // any single channel device to pair with ? + bool found = false; + int j = 0; + while ( !found && (j < m_FtdiDeviceDescrs.size()) ) + { + descr2 = m_FtdiDeviceDescrs[j]; + found = ((descr1 != descr2) && !descr2->IsUsed() && (descr2->GetNbChannels() == 1)); + j++; + } + // found one ? + if ( found ) + { + // yes, create and pair both interfaces + iNbCh += CFtdiDeviceDescr::CreateInterfacePair(descr1, descr2, &Combined3003And3000DeviceChannels); + // and flag as used + descr1->SetUsed(true); + descr2->SetUsed(true); + } else { // no, just create a standalone 3003 interface @@ -165,10 +196,11 @@ bool CVocodecs::Init(void) } } } - + // at this point we should possible only have unique 3003 remaining + // now agregate channels by order of priority // for proper load sharing - // pairs of 300 devices first + // pairs of 3000 devices first { for ( int i = 0; i < PairsOf3000DevicesChs.size(); i++ ) { @@ -184,11 +216,11 @@ bool CVocodecs::Init(void) } Single3003DeviceChannels.clear(); } - // and finally interlace multi-3003 and pairs of 3003 devices which always + // finally interlace multi-3003 and pairs of 3003 devices which always // results to 6 channels per pair of 3003 { int n = (int)Multi3003DevicesChs.size() / 6; - for ( int i = 0; i < 6; i++ ) + for ( int i = 0; (i < 6) && (n != 0); i++ ) { for ( int j = 0; j < n; j++ ) { @@ -197,7 +229,15 @@ bool CVocodecs::Init(void) } Multi3003DevicesChs.clear(); } - + // and finaly the hybrid combination of 3003 / 3000 + { + for ( int i = 0; i < Combined3003And3000DeviceChannels.size(); i++ ) + { + m_Channels.push_back(Combined3003And3000DeviceChannels.at(i)); + } + Combined3003And3000DeviceChannels.clear(); + } + // done if ( ok ) diff --git a/ambed/main.h b/ambed/main.h old mode 100755 new mode 100644 index 4d0baad..931badc --- a/ambed/main.h +++ b/ambed/main.h @@ -49,7 +49,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 -#define VERSION_REVISION 3 +#define VERSION_REVISION 4 // global ------------------------------------------------------ diff --git a/ambed/readme b/ambed/readme index bfd8583..04e5be8 100644 --- a/ambed/readme +++ b/ambed/readme @@ -22,7 +22,7 @@ // along with Foobar. If not, see . // ---------------------------------------------------------------------------- -VERSION: 1.3.2 +VERSION: 1.3.4 Hardware compatibility. ====================== @@ -44,7 +44,7 @@ device DMR->DSTAR DSTAR->DMR Nb Of concurrent channels 3000(pair) 1 1 2 3003 1 1 2 3003(pair) 3 3 4 -3003-3000(pair) 2 2 not tested +3003-3000(pair) 2 2 4 3006 3 3 6 3012 6 6 12