Commit d3ec497e authored by David Košenina's avatar David Košenina

holdoff

parent ec80a4c8
......@@ -1566,7 +1566,7 @@ void OsciloskopOsciloskop::m_textCtrlTriggerPreOnTextEnter(wxCommandEvent& event
void OsciloskopOsciloskop::m_sliderTriggerPreOnScroll(wxScrollEvent& event)
{
// TODO: Implement m_sliderTriggerPreOnScroll
pOsciloscope->window.trigger.Percent = max(m_sliderTriggerPre->GetValue(), 0);
pOsciloscope->window.trigger.Percent = max<int>(m_sliderTriggerPre->GetValue(), 0);
pOsciloscope->control.setTriggerPre(m_sliderTriggerPre->GetValue());
pOsciloscope->control.transferData();
pOsciloscope->window.measure.data.pickX0.updateUI = true;
......@@ -1577,21 +1577,25 @@ void OsciloskopOsciloskop::m_sliderTriggerPreOnScroll(wxScrollEvent& event)
void OsciloskopOsciloskop::m_textCtrlTriggerHoldoffOnTextEnter(wxCommandEvent& event)
{
// TODO: Implement m_textCtrlTriggerHoldoffOnTextEnter
pOsciloscope->window.trigger.Holdoff = pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data());
pOsciloscope->control.setHoldoff(pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()));
uint newHoldOff = max<int>(0,pFormat->stringToInteger(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()));
pOsciloscope->control.setHoldoff(newHoldOff);
newHoldOff = pOsciloscope->control.getHoldoff();
pOsciloscope->window.trigger.Holdoff = newHoldOff;
pOsciloscope->control.transferData();
//
m_sliderTriggerHoldoff->SetValue(pOsciloscope->window.trigger.Holdoff);
m_sliderTriggerHoldoff->SetValue(newHoldOff);
m_textCtrlTriggerHoldoff->SetValue(wxString::FromAscii(pFormat->integerToString(newHoldOff)));
}
void OsciloskopOsciloskop::m_sliderTriggerHoldoffOnScroll(wxScrollEvent& event)
{
// TODO: Implement m_sliderTriggerHoldoffOnScroll
pOsciloscope->window.trigger.Holdoff = m_sliderTriggerHoldoff->GetValue();
pOsciloscope->control.setHoldoff(m_sliderTriggerHoldoff->GetValue());
uint newHoldOff = max(0,m_sliderTriggerHoldoff->GetValue());
pOsciloscope->control.setHoldoff(newHoldOff);
newHoldOff = pOsciloscope->control.getHoldoff();
pOsciloscope->window.trigger.Holdoff = newHoldOff;
pOsciloscope->control.transferData();
//
m_textCtrlTriggerHoldoff->SetValue(wxString::FromAscii(pFormat->doubleToString(pOsciloscope->window.trigger.Holdoff)));
m_sliderTriggerHoldoff->SetValue(newHoldOff);
m_textCtrlTriggerHoldoff->SetValue(wxString::FromAscii(pFormat->integerToString(newHoldOff)));
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -3337,22 +3341,24 @@ void OsciloskopOsciloskop::m_spinBtnTrigPreOnSpinDown(wxSpinEvent& event)
void OsciloskopOsciloskop::m_spinBtnTrigHoldoffOnSpinUp(wxSpinEvent& event)
{
double Hstep = 1000 * double(NANO);
pOsciloscope->window.trigger.Holdoff = pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()) + Hstep;
pOsciloscope->control.setHoldoff(pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()));
uint newHoldOff = max<int>(0,pOsciloscope->control.getHoldoff() + 1);
pOsciloscope->control.setHoldoff(newHoldOff);
newHoldOff = pOsciloscope->control.getHoldoff();
pOsciloscope->window.trigger.Holdoff = newHoldOff;
pOsciloscope->control.transferData();
m_sliderTriggerHoldoff->SetValue(pOsciloscope->window.trigger.Holdoff);
m_textCtrlTriggerHoldoff->SetValue(pFormat->doubleToString(pOsciloscope->window.trigger.Holdoff));
m_sliderTriggerHoldoff->SetValue(newHoldOff);
m_textCtrlTriggerHoldoff->SetValue(pFormat->integerToString(newHoldOff));
}
void OsciloskopOsciloskop::m_spinBtnTrigHoldoffOnSpinDown(wxSpinEvent& event)
{
double Hstep = 1000 * double(NANO);
pOsciloscope->window.trigger.Holdoff = pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()) - Hstep;
pOsciloscope->control.setHoldoff(pFormat->stringToDouble(m_textCtrlTriggerHoldoff->GetValue().ToAscii().data()));
uint newHoldOff = max<int>(0,pOsciloscope->control.getHoldoff() - 1);
pOsciloscope->control.setHoldoff(newHoldOff);
newHoldOff = pOsciloscope->control.getHoldoff();
pOsciloscope->window.trigger.Holdoff = newHoldOff;
pOsciloscope->control.transferData();
m_sliderTriggerHoldoff->SetValue(pOsciloscope->window.trigger.Holdoff);
m_textCtrlTriggerHoldoff->SetValue(pFormat->doubleToString(pOsciloscope->window.trigger.Holdoff));
m_sliderTriggerHoldoff->SetValue(newHoldOff);
m_textCtrlTriggerHoldoff->SetValue(pFormat->integerToString(newHoldOff));
}
void OsciloskopOsciloskop::RecalculateTriggerPosition(double oldTriggerVoltagePerStep, double newTriggerVoltagePerStep)
......
......@@ -1354,7 +1354,7 @@ Osciloskop::Osciloskop( wxWindow* parent, wxWindowID id, const wxString& title,
m_spinBtnTrigHoldoff = new wxSpinButton( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL );
bSizer43->Add( m_spinBtnTrigHoldoff, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_sliderTriggerHoldoff = new wxSlider( m_panel3, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
m_sliderTriggerHoldoff = new wxSlider( m_panel3, wxID_ANY, 0, 0, 400000000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
bSizer43->Add( m_sliderTriggerHoldoff, 8, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
......
......@@ -12854,7 +12854,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maxValue">100</property>
<property name="maxValue">400000000</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -12881,7 +12881,7 @@
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">50</property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -287,12 +287,10 @@ void OsciloscopeControl1::setTriggerLevel(int perc)
triggerLevel = perc;
}
void OsciloscopeControl1::setHoldoff(double holdoff)
void OsciloscopeControl1::setHoldoff(uint holdoff)
{
double N = double(holdoff) * double(NANO) / 10.0;
uint value = uint(N);
holdoffH = (value & 0xFFFF0000) >> 16;
holdoffL = value & 0x0000FFFF;
holdoffH = (holdoff & 0xFFFF0000) >> 16;
holdoffL = holdoff & 0x0000FFFF;
}
///////////////////////////////////////////////////////////////////////
......@@ -787,11 +785,10 @@ uint OsciloscopeControl1::getSampleSize()
return sampleSize;
}
double OsciloscopeControl1::getHoldoff()
uint OsciloscopeControl1::getHoldoff()
{
uint holdOffInt = uint(holdoffL) | (uint(holdoffH) << 16);
double value = double(holdOffInt) * 10.0 / double(NANO);
return value;
return holdOffInt;
}
int OsciloscopeControl1::getDigitalStart()
......@@ -1342,12 +1339,10 @@ void OsciloscopeControl2::setTriggerLevel(int perc)
triggerLevel = perc;
}
void OsciloscopeControl2::setHoldoff(double holdoff)
void OsciloscopeControl2::setHoldoff(uint holdoff)
{
double N = double(holdoff) * double(NANO) / 10.0;
uint value = uint(N);
holdoffH = (value & 0xFFFF0000) >> 16;
holdoffL = value & 0x0000FFFF;
holdoffH = (holdoff & 0xFFFF0000) >> 16;
holdoffL = holdoff & 0x0000FFFF;
}
///////////////////////////////////////////////////////////////////////
......@@ -1845,11 +1840,10 @@ uint OsciloscopeControl2::getSampleSize()
return sampleSize;
}
double OsciloscopeControl2::getHoldoff()
uint OsciloscopeControl2::getHoldoff()
{
uint holdOffInt = uint(holdoffL) | (uint(holdoffH) << 16);
double value = double(holdOffInt) * 10.0 / double(NANO);
return value;
return holdOffInt;
}
int OsciloscopeControl2::getDigitalStart()
......@@ -2577,7 +2571,7 @@ void OsciloscopeMainControl::setSampleSize(uint frameSize)
pControl->setSampleSize(frameSize);
}
void OsciloscopeMainControl::setHoldoff(double holdoff)
void OsciloscopeMainControl::setHoldoff(uint holdoff)
{
pControl->setHoldoff(holdoff);
}
......@@ -2756,7 +2750,7 @@ ishort OsciloscopeMainControl::getXRange()
{
return pControl->getXRange();
}
double OsciloscopeMainControl::getHoldoff()
uint OsciloscopeMainControl::getHoldoff()
{
return pControl->getHoldoff();
}
......
......@@ -165,7 +165,7 @@ public:
public:
virtual void setXRange(ishort range) = 0;
virtual void setSampleSize(uint frameSize) = 0;
virtual void setHoldoff(double holdoff) = 0;
virtual void setHoldoff(uint holdoff) = 0;
public:
virtual void setDigitalStart(int start) = 0;
virtual void setDigitalMode(int mode) = 0;
......@@ -215,7 +215,7 @@ public:
public:
virtual uint getSampleSize() = 0;
virtual ishort getXRange() = 0;
virtual double getHoldoff() = 0;
virtual uint getHoldoff() = 0;
public:
virtual int getDigitalStart() = 0;
virtual int getDigitalMode() = 0;
......@@ -342,7 +342,7 @@ public:
public:
void setXRange(ishort range);
void setSampleSize(uint frameSize);
void setHoldoff(double holdoff);
void setHoldoff(uint holdoff);
public:
virtual void setDigitalStart(int start);
virtual void setDigitalMode(int mode);
......@@ -394,7 +394,7 @@ public:
virtual uint getSampleSize();
public:
virtual ishort getXRange();
virtual double getHoldoff();
virtual uint getHoldoff();
public:
virtual int getDigitalStart();
virtual int getDigitalMode();
......@@ -540,7 +540,7 @@ public:
public:
virtual void setXRange(ishort range);
virtual void setSampleSize(uint frameSize);
virtual void setHoldoff(double holdoff);
virtual void setHoldoff(uint holdoff);
public:
virtual void setDigitalStart(int start);
virtual void setDigitalMode(int mode);
......@@ -592,7 +592,7 @@ public:
virtual uint getSampleSize();
public:
virtual ishort getXRange();
virtual double getHoldoff();
virtual uint getHoldoff();
public:
virtual int getDigitalStart();
virtual int getDigitalMode();
......@@ -690,7 +690,7 @@ public:
public:
virtual void setXRange(ishort range);
virtual void setSampleSize(uint frameSize);
virtual void setHoldoff(double holdoff);
virtual void setHoldoff(uint holdoff);
public:
virtual void setDigitalStart(int start);
virtual void setDigitalMode(int mode);
......@@ -740,7 +740,7 @@ public:
public:
virtual uint getSampleSize();
virtual ishort getXRange();
virtual double getHoldoff();
virtual uint getHoldoff();
public:
virtual int getDigitalStart();
virtual int getDigitalMode();
......
......@@ -121,7 +121,7 @@ public:
int Level;
int His;
double Percent;
double Holdoff;
uint Holdoff;
public:
int stage;
int stageStart;
......
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