Commit 2eacdc95 authored by David Košenina's avatar David Košenina

pre-trigger

parent 0961b5e1
......@@ -1022,12 +1022,14 @@ void OsciloskopOsciloskop::m_textCtrlTimeFrameSizeOnTextEnter(wxCommandEvent& ev
if(version == 1)
{
pOsciloscope->control.setSampleSize(frameSize);
pOsciloscope->control.setTriggerPre( pOsciloscope->control.getTriggerPre() );
pOsciloscope->window.horizontal.FrameSize = pOsciloscope->control.getSampleSize();
data = pOsciloscope->window.horizontal.FrameSize * 6;
}
else
{
pOsciloscope->control.setSampleSize(frameSize);
pOsciloscope->control.setTriggerPre( pOsciloscope->control.getTriggerPre() );
pOsciloscope->window.horizontal.FrameSize = pOsciloscope->control.getSampleSize();
data = pOsciloscope->window.horizontal.FrameSize * 4;
}
......
......@@ -272,7 +272,9 @@ void OsciloscopeControl1::setTriggerSlope(int value)
void OsciloscopeControl1::setTriggerPre(float perc)
{
triggerPercent = (perc / 100.f) * float(NUM_SAMPLES - 1);
uint sampleSize = getSampleSize();
triggerPercent = (perc / 100.f) * float(sampleSize - 1);
triggerPercent = (triggerPercent / 4);
}
void OsciloscopeControl1::setTriggerHis(int perc)
......@@ -762,7 +764,7 @@ ushort OsciloscopeControl1::getTriggerSlope()
float OsciloscopeControl1::getTriggerPre()
{
return 100.f * (float(triggerPercent) / float(NUM_SAMPLES - 1));
return 100.f * (float(triggerPercent * 4) / float(getSampleSize() - 1));
}
int OsciloscopeControl1::getTriggerHis()
......@@ -1325,8 +1327,10 @@ void OsciloscopeControl2::setTriggerSlope(int value)
void OsciloscopeControl2::setTriggerPre(float perc)
{
triggerPercent = (perc / 100.f) * float(NUM_SAMPLES - 1);
}
uint sampleSize = getSampleSize();
triggerPercent = (perc / 100.f) * float(sampleSize - 1);
triggerPercent = ( triggerPercent / 4 );
}
void OsciloscopeControl2::setTriggerHis(int perc)
{
......@@ -1815,7 +1819,7 @@ ushort OsciloscopeControl2::getTriggerSlope()
float OsciloscopeControl2::getTriggerPre()
{
return 100.f * (float(triggerPercent) / float(NUM_SAMPLES - 1));
return 100.f * (float(triggerPercent * 4) / float(getSampleSize() - 1));
}
int OsciloscopeControl2::getTriggerHis()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment