Commit 238cca71 authored by David Košenina's avatar David Košenina

y position + generator delta

parent d3ec497e
......@@ -1134,7 +1134,6 @@ void OsciloskopOsciloskop::m_comboBoxCh0CaptureOnCombobox(wxCommandEvent& event)
m_comboBoxCh0Display->SetSelection(unit);
double newTriggerVoltagePerStep = pOsciloscope->getTriggerVoltagePerStep();
RecalculateTriggerPosition(oldTriggerVoltagePerSteps, newTriggerVoltagePerStep);
pOsciloscope->control.setYPositionA(pOsciloscope->window.channel01.YPosition + pOsciloscope->settings.getHardware()->getAnalogOffset(pOsciloscope->window.horizontal.Capture, 0, pOsciloscope->window.channel01.Capture));
// transfer
pOsciloscope->control.transferData();
pOsciloscope->window.measure.ClearCapture();
......@@ -1212,10 +1211,10 @@ void OsciloskopOsciloskop::m_sliderCh0PositionOnScroll(wxScrollEvent& event)
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel01.Capture;
// steps
pOsciloscope->control.setYPositionA(m_sliderCh0Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture));
pOsciloscope->control.setYPositionA(-m_sliderCh0Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture));
pOsciloscope->control.transferData();
// voltage
pOsciloscope->window.channel01.YPosition = double(m_sliderCh0Position->GetValue()) * pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
pOsciloscope->window.channel01.YPosition = double(-m_sliderCh0Position->GetValue()) * pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
m_textCtrlCh0Position->SetValue(pFormat->doubleToString(pOsciloscope->window.channel01.YPosition));
}
......@@ -1242,7 +1241,6 @@ void OsciloskopOsciloskop::m_comboBoxCh1CaptureOnCombobox(wxCommandEvent& event)
//
double newTriggerVoltagePerStep = pOsciloscope->getTriggerVoltagePerStep();
RecalculateTriggerPosition(oldTriggerVoltagePerStep, newTriggerVoltagePerStep);
pOsciloscope->control.setYPositionB(pOsciloscope->window.channel02.YPosition + pOsciloscope->settings.getHardware()->getAnalogOffset(pOsciloscope->window.horizontal.Capture, 1, pOsciloscope->window.channel02.Capture));
pOsciloscope->control.transferData();
pOsciloscope->window.measure.ClearCapture();
}
......@@ -1319,10 +1317,10 @@ void OsciloskopOsciloskop::m_sliderCh1PositionOnScroll(wxScrollEvent& event)
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel02.Capture;
// steps
pOsciloscope->control.setYPositionB(m_sliderCh1Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture));
pOsciloscope->control.setYPositionB(-m_sliderCh1Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture));
pOsciloscope->control.transferData();
// voltage
pOsciloscope->window.channel02.YPosition = double(m_sliderCh1Position->GetValue()) * pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
pOsciloscope->window.channel02.YPosition = double(-m_sliderCh1Position->GetValue()) * pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
m_textCtrlCh1Position->SetValue(pFormat->doubleToString(pOsciloscope->window.channel02.YPosition));
}
......@@ -3185,62 +3183,78 @@ void OsciloskopOsciloskop::m_spinBtnFrameHistoryOnSpinDown(wxSpinEvent& event)
void OsciloskopOsciloskop::m_spinBtnCh0YPosOnSpinUp(wxSpinEvent& event)
{
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel01.Capture;
// step
double steps = m_sliderCh0Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
pOsciloscope->control.setYPositionA(steps + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture));
// transfer
// position
int ypos = pOsciloscope->control.getYPositionA();
pOsciloscope->control.setYPositionA( ypos - 1);
pOsciloscope->control.transferData();
// update text box
m_textCtrlCh0Position->SetValue(pFormat->doubleToString(steps * pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture)));
wxCommandEvent e;
m_textCtrlCh0PositionOnTextEnter(e);
// ypos, step and offset
ypos = pOsciloscope->control.getYPositionA();
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel01.Capture;
double step = pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
int offset = pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture);
// update ui
m_sliderCh0Position->SetValue( ypos - offset );
m_textCtrlCh0Position->SetValue( pFormat->doubleToString( step*double(ypos - offset) ) );
}
void OsciloskopOsciloskop::m_spinBtnCh0YPosOnSpinDown(wxSpinEvent& event)
{
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel01.Capture;
// step
double steps = m_sliderCh0Position->GetValue() - pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
pOsciloscope->control.setYPositionA(steps + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture));
// transfer
// position
int ypos = pOsciloscope->control.getYPositionA();
pOsciloscope->control.setYPositionA( ypos + 1);
pOsciloscope->control.transferData();
// update text box
m_textCtrlCh0Position->SetValue(pFormat->doubleToString(steps * pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture)));
wxCommandEvent e;
m_textCtrlCh0PositionOnTextEnter(e);
// ypos, step and offset
ypos = pOsciloscope->control.getYPositionA();
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel01.Capture;
double step = pOsciloscope->settings.getHardware()->getAnalogStep(time, 0, capture);
int offset = pOsciloscope->settings.getHardware()->getAnalogOffset(time, 0, capture);
// update ui
m_sliderCh0Position->SetValue( ypos - offset );
m_textCtrlCh0Position->SetValue( pFormat->doubleToString( step*double(ypos - offset) ) );
}
void OsciloskopOsciloskop::m_spinBtnCh1YPosOnSpinUp(wxSpinEvent& event)
{
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel02.Capture;
// step
double steps = m_sliderCh1Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
pOsciloscope->control.setYPositionB(steps + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture));
// transfer
// position
int ypos = pOsciloscope->control.getYPositionB();
pOsciloscope->control.setYPositionB( ypos - 1);
pOsciloscope->control.transferData();
// update text box
m_textCtrlCh1Position->SetValue(pFormat->doubleToString(steps * pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture)));
wxCommandEvent e;
m_textCtrlCh1PositionOnTextEnter(e);
// ypos, step and offset
ypos = pOsciloscope->control.getYPositionB();
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel02.Capture;
double step = pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
int offset = pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture);
// update ui
m_sliderCh1Position->SetValue( ypos - offset );
m_textCtrlCh1Position->SetValue( pFormat->doubleToString( step*double(ypos - offset) ) );
}
void OsciloskopOsciloskop::m_spinBtnCh1YPosOnSpinDown(wxSpinEvent& event)
{
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel02.Capture;
// step
double steps = m_sliderCh1Position->GetValue() - pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
pOsciloscope->control.setYPositionB(steps + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture));
// transfer
// position
int ypos = pOsciloscope->control.getYPositionB();
pOsciloscope->control.setYPositionB( ypos + 1);
pOsciloscope->control.transferData();
// update text box
m_textCtrlCh1Position->SetValue(pFormat->doubleToString(steps * pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture)));
wxCommandEvent e;
m_textCtrlCh1PositionOnTextEnter(e);
// ypos, step and offset
ypos = pOsciloscope->control.getYPositionB();
float time = pOsciloscope->window.horizontal.Capture;
float capture = pOsciloscope->window.channel02.Capture;
double step = pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
int offset = pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture);
// update ui
m_sliderCh1Position->SetValue( ypos - offset );
m_textCtrlCh1Position->SetValue( pFormat->doubleToString( step*double(ypos - offset) ) );
}
void OsciloskopOsciloskop::m_spinBtnDigVoltageOnSpinUp(wxSpinEvent& event)
......
......@@ -1683,11 +1683,11 @@ void OsciloscopeControl2::setGeneratorFrequency1(float freq, float fs)
case GENERATOR_DELTA:
case GENERATOR_DC:
case GENERATOR_NOISE:
delta = 8192.0 * double(freq) / double(fs);
delta = 65536.0 * double(freq) / double(fs);
break;
};
//
uint gDelta = uint(delta * 1048575.0);
uint gDelta = uint(delta * 131071.0);
generatorDeltaH1 = (gDelta & 0xFFFF0000) >> 16;
generatorDeltaL1 = gDelta & 0x0000FFFF;
}
......@@ -1781,6 +1781,7 @@ float OsciloscopeControl2::getYScaleA()
}
int OsciloscopeControl2::getYPositionA()
{
if( offseta > 1500 ) return -int(65536-offseta);
return (int)offseta;
}
......@@ -1794,6 +1795,7 @@ float OsciloscopeControl2::getYScaleB()
}
int OsciloscopeControl2::getYPositionB()
{
if( offsetb > 1500 ) return -int(65536-offsetb);
return (int)offsetb;
}
......
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