Commit 48f29b62 authored by David Košenina's avatar David Košenina

generator offsets, open usb eeprom fix

parent b34600bc
......@@ -152,7 +152,7 @@ void OsciloskopHardwareGenerator::m_sliderOffsetOnScroll(wxScrollEvent& event)
// TODO: Implement m_sliderOffsetOnScroll
float voltage = double(m_sliderOffset->GetValue()) * pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep;
pOsciloscope->window.hardwareGenerator.offset0 = m_sliderOffset->GetValue();
pOsciloscope->control.setGeneratorOffset0(m_sliderOffset->GetValue() + pOsciloscope->settings.getHardware()->getGeneratorOffset(0, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset0(m_sliderOffset->GetValue() + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,0));
pOsciloscope->control.transferData();
m_textCtrlOffset0->SetValue(pFormat->floatToString(voltage));
}
......@@ -254,7 +254,7 @@ void OsciloskopHardwareGenerator::m_spinBtnCh0OffsetOnSpinUp(wxSpinEvent& event)
pOsciloscope->window.hardwareGenerator.offset0 = min(pOsciloscope->window.hardwareGenerator.offset0, 2048);
m_textCtrlOffset0->SetValue(pFormat->floatToString(double(pOsciloscope->window.hardwareGenerator.offset0)*pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep));
m_sliderOffset->SetValue(pOsciloscope->window.hardwareGenerator.offset0);
pOsciloscope->control.setGeneratorOffset0(pOsciloscope->window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(0, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset0(pOsciloscope->window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,0));
pOsciloscope->control.transferData();
}
......@@ -264,7 +264,7 @@ void OsciloskopHardwareGenerator::m_spinBtnCh0OffsetOnSpinDown(wxSpinEvent& even
pOsciloscope->window.hardwareGenerator.offset0 = max(pOsciloscope->window.hardwareGenerator.offset0, -2048);
m_textCtrlOffset0->SetValue(pFormat->floatToString(double(pOsciloscope->window.hardwareGenerator.offset0)*pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep));
m_sliderOffset->SetValue(pOsciloscope->window.hardwareGenerator.offset0);
pOsciloscope->control.setGeneratorOffset0(pOsciloscope->window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(0, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset0(pOsciloscope->window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,0));
pOsciloscope->control.transferData();
}
......@@ -336,7 +336,7 @@ void OsciloskopHardwareGenerator::m_textCtrlOffset1OnTextEnter(wxCommandEvent& e
{
// TODO: Implement m_textCtrlOffset1OnTextEnter
pOsciloscope->window.hardwareGenerator.offset1 = pFormat->stringToFloat(m_textCtrlOffset1->GetValue().ToAscii().data()) / pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep;
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(1, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,1));
pOsciloscope->control.transferData();
m_sliderOffset1->SetValue(pOsciloscope->window.hardwareGenerator.offset1);
}
......@@ -346,7 +346,7 @@ void OsciloskopHardwareGenerator::m_sliderOffset1OnScroll(wxScrollEvent& event)
// TODO: Implement m_sliderOffset1OnScroll
float voltage = double(m_sliderOffset1->GetValue()) * pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep;
pOsciloscope->window.hardwareGenerator.offset1 = m_sliderOffset1->GetValue();
pOsciloscope->control.setGeneratorOffset1(m_sliderOffset1->GetValue() + pOsciloscope->settings.getHardware()->getGeneratorOffset(1, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset1(m_sliderOffset1->GetValue() + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,1));
pOsciloscope->control.transferData();
m_textCtrlOffset1->SetValue(pFormat->floatToString(voltage));
}
......@@ -451,7 +451,7 @@ void OsciloskopHardwareGenerator::m_spinBtnCh1OffsetOnSpinUp(wxSpinEvent& event)
pOsciloscope->window.hardwareGenerator.offset1 = min(pOsciloscope->window.hardwareGenerator.offset1, 2048);
m_textCtrlOffset1->SetValue(pFormat->floatToString(double(pOsciloscope->window.hardwareGenerator.offset1)*pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep));
m_sliderOffset1->SetValue(pOsciloscope->window.hardwareGenerator.offset1);
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(1, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,1));
pOsciloscope->control.transferData();
}
......@@ -461,7 +461,7 @@ void OsciloskopHardwareGenerator::m_spinBtnCh1OffsetOnSpinDown(wxSpinEvent& even
pOsciloscope->window.hardwareGenerator.offset1 = max(pOsciloscope->window.hardwareGenerator.offset1, -2048);
m_textCtrlOffset1->SetValue(pFormat->floatToString(double(pOsciloscope->window.hardwareGenerator.offset1)*pOsciloscope->settings.getHardware()->referenceGeneratorVoltagePerStep));
m_sliderOffset1->SetValue(pOsciloscope->window.hardwareGenerator.offset1);
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(1, pOsciloscope->window.horizontal.Capture));
pOsciloscope->control.setGeneratorOffset1(pOsciloscope->window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(pOsciloscope->window.horizontal.Capture,1));
pOsciloscope->control.transferData();
}
......
......@@ -2322,9 +2322,7 @@ void OsciloskopOsciloskop::m_menuItemResetEEPROMOnMenuSelection(wxCommandEvent&
void OsciloskopOsciloskop::m_buttonConnectOnButtonClick(wxCommandEvent& event)
{
SUsb usb = pOsciloscope->settings.getHardware()->getUSB();
pOsciloscope->thread.setUSB(&usb);
pOsciloscope->thread.function(afOpenUsb);
pOsciloscope->thread.openUSB(pOsciloscope->settings.getHardware());
}
void OsciloskopOsciloskop::m_buttonDisconnectOnButtonClick(wxCommandEvent& event)
......
......@@ -2466,7 +2466,7 @@ void OsciloscopeMainControl::setWindow(WndMain& window)
window.hardwareGenerator.onOff0 = getGeneratorOn0();
window.hardwareGenerator.sawSlopePositive0 = getGeneratorSlope0();
window.hardwareGenerator.voltage0 = getGeneratorVoltage0();
window.hardwareGenerator.offset0 = getGeneratorOffset0() - pOsciloscope->settings.getHardware()->getGeneratorOffset(0, window.horizontal.Capture);
window.hardwareGenerator.offset0 = getGeneratorOffset0() - pOsciloscope->settings.getHardware()->getGeneratorOffset(window.horizontal.Capture,0);
window.hardwareGenerator.frequency0 = getGeneratorFrequency0(pOsciloscope->settings.getHardware()->generatorFs);
window.hardwareGenerator.squareDuty0 = getGeneratorSquareDuty0();
// generator B
......@@ -2474,7 +2474,7 @@ void OsciloscopeMainControl::setWindow(WndMain& window)
window.hardwareGenerator.onOff1 = getGeneratorOn1();
window.hardwareGenerator.sawSlopePositive1 = getGeneratorSlope1();
window.hardwareGenerator.voltage1 = getGeneratorVoltage1();
window.hardwareGenerator.offset1 = getGeneratorOffset1() - pOsciloscope->settings.getHardware()->getGeneratorOffset(1, window.horizontal.Capture);
window.hardwareGenerator.offset1 = getGeneratorOffset1() - pOsciloscope->settings.getHardware()->getGeneratorOffset(window.horizontal.Capture,1);
window.hardwareGenerator.frequency1 = getGeneratorFrequency1(pOsciloscope->settings.getHardware()->generatorFs);
window.hardwareGenerator.squareDuty1 = getGeneratorSquareDuty1();
}
......
......@@ -2710,7 +2710,7 @@ void OsciloscopeManager::onCallibrateFrameCaptured(OsciloscopeFrame& frame, int
case acGeneratorStart:
{
callibrate.gainMode = 0;
callibrate.voltage = vc100Mili;
callibrate.voltage = vc20Mili;
window.hardwareGenerator.type0 = GENERATOR_DC;
window.hardwareGenerator.type1 = GENERATOR_DC;
window.hardwareGenerator.onOff0 = 1;
......@@ -3449,14 +3449,14 @@ void OsciloscopeManager::setupControl(WndMain window)
control.setGeneratorOn0(window.hardwareGenerator.onOff0);
control.setGeneratorSlope0(window.hardwareGenerator.sawSlopePositive0);
control.setGeneratorVoltage0(window.hardwareGenerator.voltage0);
control.setGeneratorOffset0(window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(0, window.horizontal.Capture));
control.setGeneratorOffset0(window.hardwareGenerator.offset0 + pOsciloscope->settings.getHardware()->getGeneratorOffset(window.horizontal.Capture,0));
control.setGeneratorFrequency0(window.hardwareGenerator.frequency0, pOsciloscope->settings.getHardware()->generatorFs);
control.setGeneratorSquareDuty0(window.hardwareGenerator.squareDuty0);
control.setGeneratorType1((GeneratorType)window.hardwareGenerator.type1);
control.setGeneratorOn1(window.hardwareGenerator.onOff1);
control.setGeneratorSlope1(window.hardwareGenerator.sawSlopePositive1);
control.setGeneratorVoltage1(window.hardwareGenerator.voltage1);
control.setGeneratorOffset1(window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(1, window.horizontal.Capture));
control.setGeneratorOffset1(window.hardwareGenerator.offset1 + pOsciloscope->settings.getHardware()->getGeneratorOffset(window.horizontal.Capture,1));
control.setGeneratorFrequency1(window.hardwareGenerator.frequency1, pOsciloscope->settings.getHardware()->generatorFs);
control.setGeneratorSquareDuty1(window.hardwareGenerator.squareDuty1);
control.setDigitalVoltage(window.digitalSetup.voltage);
......
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