mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	New scope: fixed trigger projector initialization and delete
This commit is contained in:
		
							parent
							
								
									b8e3d60110
								
							
						
					
					
						commit
						f1b5b08fa0
					
				@ -31,7 +31,6 @@ MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message)
 | 
				
			|||||||
const uint ScopeVisNG::m_traceChunkSize = 4800;
 | 
					const uint ScopeVisNG::m_traceChunkSize = 4800;
 | 
				
			||||||
const Real ScopeVisNG::ProjectorMagDB::mult = (10.0f / log2f(10.0f));
 | 
					const Real ScopeVisNG::ProjectorMagDB::mult = (10.0f / log2f(10.0f));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
ScopeVisNG::ScopeVisNG(GLScopeNG* glScope) :
 | 
					ScopeVisNG::ScopeVisNG(GLScopeNG* glScope) :
 | 
				
			||||||
    m_glScope(glScope),
 | 
					    m_glScope(glScope),
 | 
				
			||||||
    m_preTriggerDelay(0),
 | 
					    m_preTriggerDelay(0),
 | 
				
			||||||
@ -479,7 +478,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        MsgScopeVisNGAddTrigger& conf = (MsgScopeVisNGAddTrigger&) message;
 | 
					        MsgScopeVisNGAddTrigger& conf = (MsgScopeVisNGAddTrigger&) message;
 | 
				
			||||||
        m_triggerConditions.push_back(TriggerCondition(conf.getTriggerData()));
 | 
					        m_triggerConditions.push_back(TriggerCondition(conf.getTriggerData()));
 | 
				
			||||||
        m_triggerConditions.back().init();
 | 
					        m_triggerConditions.back().initProjector();
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (MsgScopeVisNGChangeTrigger::match(message))
 | 
					    else if (MsgScopeVisNGChangeTrigger::match(message))
 | 
				
			||||||
@ -499,6 +498,7 @@ bool ScopeVisNG::handleMessage(const Message& message)
 | 
				
			|||||||
        int triggerIndex = conf.getTriggerIndex();
 | 
					        int triggerIndex = conf.getTriggerIndex();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (triggerIndex < m_triggerConditions.size()) {
 | 
					        if (triggerIndex < m_triggerConditions.size()) {
 | 
				
			||||||
 | 
					            m_triggerConditions[triggerIndex].releaseProjector();
 | 
				
			||||||
            m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
 | 
					            m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -360,17 +360,6 @@ private:
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return dPhi;
 | 
					            return dPhi;
 | 
				
			||||||
 | 
					 | 
				
			||||||
//            Real dPhi = curArg - m_prevArg;
 | 
					 | 
				
			||||||
//            m_prevArg = curArg;
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//            if (dPhi < -M_PI) {
 | 
					 | 
				
			||||||
//                dPhi += 2.0 * M_PI;
 | 
					 | 
				
			||||||
//            } else if (dPhi > M_PI) {
 | 
					 | 
				
			||||||
//                dPhi -= 2.0 * M_PI;
 | 
					 | 
				
			||||||
//            }
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//            return dPhi/M_PI;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
@ -430,14 +419,18 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        ~TriggerCondition()
 | 
					        ~TriggerCondition()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (m_projector) delete m_projector;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void init()
 | 
					        void initProjector()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_projector = createProjector(m_triggerData.m_projectionType);
 | 
					            m_projector = createProjector(m_triggerData.m_projectionType);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void releaseProjector()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            delete m_projector;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void setData(const TriggerData& triggerData)
 | 
					        void setData(const TriggerData& triggerData)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_triggerData = triggerData;
 | 
					            m_triggerData = triggerData;
 | 
				
			||||||
 | 
				
			|||||||
@ -257,6 +257,31 @@ void GLScopeNGGUI::on_traceLen_valueChanged(int value)
 | 
				
			|||||||
    setTimeOfsDisplay();
 | 
					    setTimeOfsDisplay();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GLScopeNGGUI::on_trig_valueChanged(int value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ui->trigText->setText(tr("%1").arg(value));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GLScopeNGGUI::on_trigAdd_clicked(bool checked)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (ui->trig->maximum() < 9)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ScopeVisNG::TriggerData triggerData;
 | 
				
			||||||
 | 
					        fillTriggerData(triggerData);
 | 
				
			||||||
 | 
					        m_scopeVis->addTrigger(triggerData);
 | 
				
			||||||
 | 
					        ui->trig->setMaximum(ui->trig->maximum() + 1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GLScopeNGGUI::on_trigDel_clicked(bool checked)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (ui->trig->maximum() > 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        m_scopeVis->removeTrigger(ui->trig->value());
 | 
				
			||||||
 | 
					        ui->trig->setMaximum(ui->trig->maximum() - 1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GLScopeNGGUI::on_traceMode_currentIndexChanged(int index)
 | 
					void GLScopeNGGUI::on_traceMode_currentIndexChanged(int index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    setAmpScaleDisplay();
 | 
					    setAmpScaleDisplay();
 | 
				
			||||||
@ -656,6 +681,11 @@ void GLScopeNGGUI::fillTriggerData(ScopeVisNG::TriggerData& triggerData)
 | 
				
			|||||||
    triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVisNG::m_traceChunkSize * delayMult);
 | 
					    triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVisNG::m_traceChunkSize * delayMult);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GLScopeNGGUI::setTriggerUI(ScopeVisNG::TriggerData& triggerData)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GLScopeNGGUI::applySettings()
 | 
					void GLScopeNGGUI::applySettings()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,7 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void fillTraceData(ScopeVisNG::TraceData& traceData);
 | 
					    void fillTraceData(ScopeVisNG::TraceData& traceData);
 | 
				
			||||||
    void fillTriggerData(ScopeVisNG::TriggerData& triggerData);
 | 
					    void fillTriggerData(ScopeVisNG::TriggerData& triggerData);
 | 
				
			||||||
 | 
					    void setTriggerUI(ScopeVisNG::TriggerData& triggerData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void fillProjectionCombo(QComboBox* comboBox);
 | 
					    void fillProjectionCombo(QComboBox* comboBox);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -106,6 +107,9 @@ private slots:
 | 
				
			|||||||
    void on_ofsFine_valueChanged(int value);
 | 
					    void on_ofsFine_valueChanged(int value);
 | 
				
			||||||
    void on_traceDelay_valueChanged(int value);
 | 
					    void on_traceDelay_valueChanged(int value);
 | 
				
			||||||
    // Third row
 | 
					    // Third row
 | 
				
			||||||
 | 
					    void on_trig_valueChanged(int value);
 | 
				
			||||||
 | 
					    void on_trigAdd_clicked(bool checked);
 | 
				
			||||||
 | 
					    void on_trigDel_clicked(bool checked);
 | 
				
			||||||
    void on_trigMode_currentIndexChanged(int index);
 | 
					    void on_trigMode_currentIndexChanged(int index);
 | 
				
			||||||
    void on_trigCount_valueChanged(int value);
 | 
					    void on_trigCount_valueChanged(int value);
 | 
				
			||||||
    void on_trigPos_toggled(bool checked);
 | 
					    void on_trigPos_toggled(bool checked);
 | 
				
			||||||
 | 
				
			|||||||
@ -700,7 +700,7 @@ kS/s</string>
 | 
				
			|||||||
      <widget class="QLabel" name="ampText">
 | 
					      <widget class="QLabel" name="ampText">
 | 
				
			||||||
       <property name="minimumSize">
 | 
					       <property name="minimumSize">
 | 
				
			||||||
        <size>
 | 
					        <size>
 | 
				
			||||||
         <width>32</width>
 | 
					         <width>36</width>
 | 
				
			||||||
         <height>0</height>
 | 
					         <height>0</height>
 | 
				
			||||||
        </size>
 | 
					        </size>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
@ -749,7 +749,7 @@ kS/s</string>
 | 
				
			|||||||
      <widget class="QLabel" name="ofsText">
 | 
					      <widget class="QLabel" name="ofsText">
 | 
				
			||||||
       <property name="minimumSize">
 | 
					       <property name="minimumSize">
 | 
				
			||||||
        <size>
 | 
					        <size>
 | 
				
			||||||
         <width>32</width>
 | 
					         <width>36</width>
 | 
				
			||||||
         <height>0</height>
 | 
					         <height>0</height>
 | 
				
			||||||
        </size>
 | 
					        </size>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
@ -1292,7 +1292,7 @@ kS/s</string>
 | 
				
			|||||||
      <widget class="QLabel" name="trigLevelText">
 | 
					      <widget class="QLabel" name="trigLevelText">
 | 
				
			||||||
       <property name="minimumSize">
 | 
					       <property name="minimumSize">
 | 
				
			||||||
        <size>
 | 
					        <size>
 | 
				
			||||||
         <width>32</width>
 | 
					         <width>36</width>
 | 
				
			||||||
         <height>0</height>
 | 
					         <height>0</height>
 | 
				
			||||||
        </size>
 | 
					        </size>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user