@@ -1364,6 +1364,9 @@ void StreamBrowserDialog::renderInstrumentNode(shared_ptr<Instrument> instrument
13641364
13651365 if (instIsOpen)
13661366 {
1367+ vector<Oscilloscope::DigitalBank> digitalBanks;
1368+ vector<size_t > analogChannels;
1369+ vector<size_t > otherChannels;
13671370 size_t lastEnabledChannelIndex = 0 ;
13681371 if (scope)
13691372 {
@@ -1381,17 +1384,58 @@ void StreamBrowserDialog::renderInstrumentNode(shared_ptr<Instrument> instrument
13811384 ImGui::TreePop ();
13821385 }
13831386
1387+ digitalBanks = scope->GetDigitalBanks ();
1388+
13841389 for (size_t i = 0 ; i<channelCount; i++)
13851390 {
13861391 if (scope->IsChannelEnabled (i))
13871392 lastEnabledChannelIndex = i;
1393+ auto scopechan = scope->GetChannel (i);
1394+ auto streamType = scopechan->GetType (0 );
1395+ if (streamType != Stream::STREAM_TYPE_DIGITAL )
1396+ {
1397+ if (streamType == Stream::STREAM_TYPE_ANALOG )
1398+ analogChannels.push_back (i);
1399+ else
1400+ otherChannels.push_back (i);
1401+ }
13881402 }
13891403 }
13901404
1391- for (size_t i=0 ; i<channelCount; i++)
1392- {
1393- // Iterate on each channel
1394- renderChannelNode (instrument,i,(i == lastEnabledChannelIndex));
1405+ if (digitalBanks.size () > 0 )
1406+ { // If digital banks are avaialble, gather digital channels in banks
1407+ for (size_t i : analogChannels)
1408+ { // Iterate on analog channel first
1409+ renderChannelNode (instrument,i,(i == lastEnabledChannelIndex));
1410+ }
1411+ int bankNumber = 1 ;
1412+ for (auto bank : digitalBanks)
1413+ { // Iterate on digital banks
1414+ string nodeName = " Digital Bank " + to_string (bankNumber);
1415+ if (ImGui::TreeNodeEx (nodeName.c_str ()))
1416+ {
1417+ ImGui::Unindent (ImGui::GetTreeNodeToLabelSpacing ());
1418+ for (auto channel : bank)
1419+ { // Iterate on bank's channel
1420+ size_t i = channel->GetIndex ();
1421+ renderChannelNode (instrument,i,(i == lastEnabledChannelIndex));
1422+ }
1423+ ImGui::Indent (ImGui::GetTreeNodeToLabelSpacing ());
1424+ ImGui::TreePop ();
1425+ }
1426+ bankNumber++;
1427+ }
1428+ for (size_t i : otherChannels)
1429+ { // Finally iterate on other channels
1430+ renderChannelNode (instrument,i,(i == lastEnabledChannelIndex));
1431+ }
1432+ }
1433+ else
1434+ { // Display all channels if no digital bank is available
1435+ for (size_t i=0 ; i<channelCount; i++)
1436+ { // Iterate on each channel
1437+ renderChannelNode (instrument,i,(i == lastEnabledChannelIndex));
1438+ }
13951439 }
13961440
13971441 ImGui::TreePop ();
0 commit comments