Commit 382e052e authored by David Košenina's avatar David Košenina

callibration working, 500mhz minor fix

parent 260a6c4c
......@@ -21,10 +21,10 @@
"invertCh0": 0,
"invertCh1": 0,
"framesPerCapture": 2,
"maxIterations": 128,
"maxIterations": 64,
"exitPercentage": 0.024414,
"offsetMax": 400,
"offsetMin": -400,
"offsetMax": 200,
"offsetMin": -200,
"generatorReference": 0,
"generatorMax": 95,
"generatorMin": -95,
......@@ -42,14 +42,14 @@
"mili10": 2650
},
"gainVoltage": {
"volt2": 2,
"volt1": 2,
"mili500": 1.250000,
"mili200": 0.400000,
"mili100": 0.250000,
"mili50": 0.125000,
"mili20": 0.050000,
"mili10": 0.025000
"volt2": 200,
"volt1": 200,
"mili500": 125.000000,
"mili200": 40.000000,
"mili100": 25.000000,
"mili50": 12.500000,
"mili20": 5.000000,
"mili10": 2.500000
},
"gainMin": {
"volt2": 0,
......@@ -84,134 +84,134 @@
},
"callibratedNormal": {
"offsetsCh0": {
"volt2": -35,
"volt1": -35,
"mili500": -35,
"mili200": -35,
"mili100": -35,
"mili50": -35,
"mili20": -35,
"mili10": -35
"volt2": -38,
"volt1": -38,
"mili500": -34,
"mili200": -27,
"mili100": -38,
"mili50": -38,
"mili20": -34,
"mili10": -27
},
"offsetsCh1": {
"volt2": -35,
"volt1": -35,
"mili500": -35,
"mili200": -11,
"mili100": -35,
"mili50": -35,
"mili20": -35,
"mili10": -11
"volt2": -31,
"volt1": -30,
"mili500": -27,
"mili200": -19,
"mili100": -31,
"mili50": -30,
"mili20": -24,
"mili10": -19
},
"voltageStepCh0": {
"volt2": -0.012286,
"volt1": -0.006733,
"mili500": -0.004094,
"mili200": -0.004215,
"mili100": -0.000614,
"mili50": -0.000335,
"mili20": -0.000173,
"mili10": -0.000130
"volt2": -1.484064,
"volt1": -0.685386,
"mili500": -0.305459,
"mili200": -0.086674,
"mili100": -0.074290,
"mili50": -0.034310,
"mili20": -0.011113,
"mili10": -0.004231
},
"voltageStepCh1": {
"volt2": -0.011888,
"volt1": -0.006495,
"mili500": -0.003883,
"mili200": -0.002286,
"mili100": -0.000594,
"mili50": -0.000324,
"mili20": -0.000162,
"mili10": -0.000114
"volt2": -1.495630,
"volt1": -0.702031,
"mili500": -0.319975,
"mili200": -0.097510,
"mili100": -0.074794,
"mili50": -0.035039,
"mili20": -0.011694,
"mili10": -0.004480
},
"gainValueCh0": {
"volt2": 1599,
"volt1": 1935,
"mili500": 2287,
"mili200": 3071,
"mili100": 1583,
"mili50": 1919,
"mili20": 2383,
"mili10": 2719
"volt2": 1437,
"volt1": 1791,
"mili500": 2141,
"mili200": 2601,
"mili100": 1431,
"mili50": 1788,
"mili20": 2254,
"mili10": 2618
},
"gainValueCh1": {
"volt2": 1022,
"volt1": 1927,
"mili500": 2271,
"mili200": 4094,
"mili100": 1022,
"mili50": 1919,
"mili20": 2367,
"mili10": 3071
"volt2": 1435,
"volt1": 1787,
"mili500": 2140,
"mili200": 2599,
"mili100": 1433,
"mili50": 1795,
"mili20": 2281,
"mili10": 2672
},
"offsetsGenerator": {
"channel0": 2,
"channel1": 3
"channel0": -2,
"channel1": -2
}
},
"callibrated500Mhz": {
"offsetsCh0": {
"volt2": -11,
"volt1": 58,
"mili500": 152,
"mili200": 410,
"mili100": -11,
"mili50": 58,
"volt2": -2,
"volt1": 50,
"mili500": 153,
"mili200": 400,
"mili100": -2,
"mili50": 50,
"mili20": 199,
"mili10": 410
"mili10": 400
},
"offsetsCh1": {
"volt2": -11,
"volt1": 35,
"mili500": 128,
"mili200": 316,
"mili100": -11,
"mili50": 35,
"mili20": 175,
"mili10": 316
"volt2": -2,
"volt1": 39,
"mili500": 124,
"mili200": 335,
"mili100": -2,
"mili50": 40,
"mili20": 166,
"mili10": 336
},
"voltageStepCh0": {
"volt2": -0.011828,
"volt1": -0.005849,
"mili500": -0.002991,
"mili200": -0.001191,
"mili100": -0.000593,
"mili50": -0.000292,
"mili20": -0.000119,
"mili10": -0.000059
"volt2": -1.577741,
"volt1": -0.799764,
"mili500": -0.407954,
"mili200": -0.156636,
"mili100": -0.079036,
"mili50": -0.040064,
"mili20": -0.016126,
"mili10": -0.007736
},
"voltageStepCh1": {
"volt2": -0.011811,
"volt1": -0.005911,
"mili500": -0.002967,
"mili200": -0.001184,
"mili100": -0.000592,
"mili50": -0.000295,
"mili20": -0.000117,
"mili10": -0.000059
"volt2": -1.570359,
"volt1": -0.790299,
"mili500": -0.401794,
"mili200": -0.155768,
"mili100": -0.078667,
"mili50": -0.039614,
"mili20": -0.015945,
"mili10": -0.007724
},
"gainValueCh0": {
"volt2": 1523,
"volt1": 1903,
"mili500": 2239,
"mili200": 2735,
"mili100": 1535,
"mili50": 1895,
"mili20": 2343,
"mili10": 2719
"volt2": 1438,
"volt1": 1789,
"mili500": 2146,
"mili200": 2611,
"mili100": 1420,
"mili50": 1783,
"mili20": 2256,
"mili10": 2619
},
"gainValueCh1": {
"volt2": 1527,
"volt1": 1895,
"mili500": 2247,
"mili200": 2743,
"mili100": 1543,
"mili50": 1887,
"mili20": 2359,
"mili10": 2735
"volt2": 1443,
"volt1": 1789,
"mili500": 2149,
"mili200": 2631,
"mili100": 1423,
"mili50": 1785,
"mili20": 2262,
"mili10": 2642
},
"offsetsGenerator": {
"channel0": 2,
"channel1": 3
"channel0": -2,
"channel1": -2
}
}
}
\ No newline at end of file
......@@ -259,6 +259,48 @@ wxBEGIN_EVENT_TABLE(OsciloskopOsciloskop, wxFrame)
EVT_TIMER(TIMER_ID, OsciloskopOsciloskop::OnTimer)
wxEND_EVENT_TABLE()
void _setYDisplay(float& volt, uint& unit, VoltageCapture selected)
{
switch (selected)
{
case vc2Volt:
volt = 2.f;
unit = (uint)vVolt;
break;
case vc1Volt:
volt = 1.f;
unit = (uint)vVolt;
break;
case vc500Mili:
volt = 500.f;
unit = (uint)vMili;
break;
case vc200Mili:
volt = 200.f;
unit = (uint)vMili;
break;
case vc100Mili:
volt = 100.f;
unit = (uint)vMili;
break;
case vc50Mili:
volt = 50.f;
unit = (uint)vMili;
break;
case vc20Mili:
volt = 20.f;
unit = (uint)vMili;
break;
case vc10Mili:
volt = 10.f;
unit = (uint)vMili;
break;
default:
CORE_ERROR("invalid volt value", 0);
};
}
OsciloskopOsciloskop::OsciloskopOsciloskop(wxWindow* parent) : Osciloskop(parent), m_timer(this, TIMER_ID)
{
userinterfaceupdate = 1;
......@@ -928,8 +970,41 @@ void OsciloskopOsciloskop::m_menuItemTestsOnMenuSelection(wxCommandEvent& event)
///////////////////////////////////////////////////////////////////////////////////////////////////////
void OsciloskopOsciloskop::m_comboBoxTimeCaptureOnCombobox(wxCommandEvent& event)
{
pOsciloscope->window.horizontal.Capture = captureTimeFromEnum(m_comboBoxTimeCapture->GetSelection());
if (captureTimeFromValue(pOsciloscope->window.horizontal.Capture) == t2c2ns)
{
// 500 Mhz help
m_comboBoxCh1Capture->SetSelection(m_comboBoxCh0Capture->GetSelection());
double oldTriggerVoltagePerStep = pOsciloscope->getTriggerVoltagePerStep();
pOsciloscope->window.channel02.Capture = captureVoltFromEnum(m_comboBoxCh0Capture->GetSelection());
pOsciloscope->window.channel02.Scale = pFormat->stringToFloat(m_textCtrlCh0Scale->GetValue().ToAscii().data());
pOsciloscope->window.channel02.Display = pOsciloscope->window.channel02.Capture;
pOsciloscope->control.setYRangeScaleB(m_comboBoxCh0Capture->GetSelection(), pOsciloscope->window.channel02.Scale);
// 500 Mhz help
m_sliderCh1Position->SetValue(m_sliderCh0Position->GetValue());
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.setYPositionB(-m_sliderCh1Position->GetValue() + pOsciloscope->settings.getHardware()->getAnalogOffset(time, 1, capture));
// voltage
pOsciloscope->window.channel02.YPosition = double(-m_sliderCh0Position->GetValue()) * pOsciloscope->settings.getHardware()->getAnalogStep(time, 1, capture);
m_textCtrlCh1Position->SetValue(pFormat->doubleToString(pOsciloscope->window.channel02.YPosition));
float volt;
uint unit;
_setYDisplay(volt, unit, (VoltageCapture)m_comboBoxCh1Capture->GetSelection());
//
m_textCtrlCh1Display->SetValue(wxString::FromAscii(pFormat->floatToString(volt)));
m_comboBoxCh1Display->SetSelection(unit);
//
double newTriggerVoltagePerStep = pOsciloscope->getTriggerVoltagePerStep();
RecalculateTriggerPosition(oldTriggerVoltagePerStep, newTriggerVoltagePerStep);
}
// TODO: Implement m_comboBoxTimeCaptureOnCombobox
pOsciloscope->window.horizontal.Capture = captureTimeFromEnum(m_comboBoxTimeCapture->GetSelection());
pOsciloscope->control.setXRange(m_comboBoxTimeCapture->GetSelection());
pOsciloscope->control.transferData();
//
......@@ -1089,47 +1164,6 @@ void OsciloskopOsciloskop::m_radioBoxTimeModeOnRadioBox(wxCommandEvent& event)
// Channel 0
//
///////////////////////////////////////////////////////////////////////////////////////////////////////
void _setYDisplay(float& volt, uint& unit, VoltageCapture selected)
{
switch(selected)
{
case vc2Volt :
volt = 2.f;
unit = (uint)vVolt;
break;
case vc1Volt :
volt = 1.f;
unit = (uint)vVolt;
break;
case vc500Mili:
volt = 500.f;
unit = (uint)vMili;
break;
case vc200Mili:
volt = 200.f;
unit = (uint)vMili;
break;
case vc100Mili:
volt = 100.f;
unit = (uint)vMili;
break;
case vc50Mili :
volt = 50.f;
unit = (uint)vMili;
break;
case vc20Mili :
volt = 20.f;
unit = (uint)vMili;
break;
case vc10Mili :
volt = 10.f;
unit = (uint)vMili;
break;
default:
CORE_ERROR("invalid volt value", 0);
};
}
void OsciloskopOsciloskop::m_comboBoxCh0CaptureOnCombobox(wxCommandEvent& event)
{
// TODO: Implement m_comboBoxCh0CaptureOnCombobox
......@@ -1138,10 +1172,11 @@ void OsciloskopOsciloskop::m_comboBoxCh0CaptureOnCombobox(wxCommandEvent& event)
// 500 Mhz help
m_comboBoxCh1Capture->SetSelection(m_comboBoxCh0Capture->GetSelection());
double oldTriggerVoltagePerStep = pOsciloscope->getTriggerVoltagePerStep();
pOsciloscope->window.channel02.Capture = captureVoltFromEnum(m_comboBoxCh1Capture->GetSelection());
pOsciloscope->window.channel02.Scale = pFormat->stringToFloat(m_textCtrlCh1Scale->GetValue().ToAscii().data());
pOsciloscope->window.channel02.Display = pOsciloscope->window.channel02.Capture;
pOsciloscope->control.setYRangeScaleB(m_comboBoxCh1Capture->GetSelection(), pOsciloscope->window.channel02.Scale);
//pOsciloscope->window.channel02.Capture = captureVoltFromEnum(m_comboBoxCh0Capture->GetSelection());
//pOsciloscope->window.channel02.Scale = pFormat->stringToFloat(m_textCtrlCh0Scale->GetValue().ToAscii().data());
//pOsciloscope->window.channel02.Display = pOsciloscope->window.channel02.Capture;
//pOsciloscope->control.setYRangeScaleB(m_comboBoxCh0Capture->GetSelection(), pOsciloscope->window.channel02.Scale);
m_comboBoxCh1CaptureOnCombobox(event);
//
float volt;
uint unit;
......@@ -3529,6 +3564,9 @@ void OsciloskopOsciloskop::m_spinBtnCh0YPosOnSpinDown(wxSpinEvent& event)
{
if (captureTimeFromValue(pOsciloscope->window.horizontal.Capture) == t2c2ns)
{
// 500 Mhz help
m_spinBtnCh1YPosOnSpinDown(event);
// 500 Mhz help
int ypos = pOsciloscope->control.getYPositionA();
pOsciloscope->control.setYPositionB(ypos + 1);
......
This diff is collapsed.
......@@ -463,6 +463,7 @@ public:
double offsetMax;
double offsetMin;
double offset;
double offsetMeasured;
public:
double generatorMax;
double generatorMin;
......@@ -483,6 +484,8 @@ public:
double stepReference;
double stepVoltage;
double stepValue;
double stepMeasuredOffsetVoltage;
double stepMeasuredOffsetValue;
public:
AutoCallibration()
{
......@@ -506,6 +509,7 @@ public:
offsetMax = 0;
offsetMin = 0;
offset = 0;
offsetMeasured = 0;
generatorMax = 0;
generatorMin = 0;
generatorOffset = 0;
......@@ -514,6 +518,8 @@ public:
gainVoltageUp = 0;
gainVoltageDown = 0;
gainMode = 0;
stepMeasuredOffsetVoltage = 0;
stepMeasuredOffsetValue = 0;
}
};
......
......@@ -141,35 +141,35 @@ void VoltageFromJson(cJSON* json, double* output)
cJSON* mili10 = cJSON_GetObjectItem(json, "mili10");
if(volt2)
{
output[vc2Volt] = jsonToDouble(volt2);
output[vc2Volt] = jsonToDouble(volt2)/100;
}
if(volt1)
{
output[vc1Volt] = jsonToDouble(volt1);
output[vc1Volt] = jsonToDouble(volt1) / 100;
}
if(mili500)
{
output[vc500Mili] = jsonToDouble(mili500);
output[vc500Mili] = jsonToDouble(mili500) / 100;
}
if(mili200)
{
output[vc200Mili] = jsonToDouble(mili200);
output[vc200Mili] = jsonToDouble(mili200) / 100;
}
if(mili100)
{
output[vc100Mili] = jsonToDouble(mili100);
output[vc100Mili] = jsonToDouble(mili100) / 100;
}
if(mili50)
{
output[vc50Mili] = jsonToDouble(mili50);
output[vc50Mili] = jsonToDouble(mili50) / 100;
}
if(mili20)
{
output[vc20Mili] = jsonToDouble(mili20);
output[vc20Mili] = jsonToDouble(mili20) / 100;
}
if(mili10)
{
output[vc10Mili] = jsonToDouble(mili10);
output[vc10Mili] = jsonToDouble(mili10) / 100;
}
}
}
......@@ -241,14 +241,14 @@ void VoltageToJson(cJSON* json, double* input)
{
if(json && input)
{
cJSON_AddItemToObject(json, "volt2", cJSON_CreateNumber(input[vc2Volt]));
cJSON_AddItemToObject(json, "volt1", cJSON_CreateNumber(input[vc1Volt]));
cJSON_AddItemToObject(json, "mili500", cJSON_CreateNumber(input[vc500Mili]));
cJSON_AddItemToObject(json, "mili200", cJSON_CreateNumber(input[vc200Mili]));
cJSON_AddItemToObject(json, "mili100", cJSON_CreateNumber(input[vc100Mili]));
cJSON_AddItemToObject(json, "mili50", cJSON_CreateNumber(input[vc50Mili]));
cJSON_AddItemToObject(json, "mili20", cJSON_CreateNumber(input[vc20Mili]));
cJSON_AddItemToObject(json, "mili10", cJSON_CreateNumber(input[vc10Mili]));
cJSON_AddItemToObject(json, "volt2", cJSON_CreateNumber(100 * input[vc2Volt]));
cJSON_AddItemToObject(json, "volt1", cJSON_CreateNumber(100 * input[vc1Volt]));
cJSON_AddItemToObject(json, "mili500", cJSON_CreateNumber(100 * input[vc500Mili]));
cJSON_AddItemToObject(json, "mili200", cJSON_CreateNumber(100 * input[vc200Mili]));
cJSON_AddItemToObject(json, "mili100", cJSON_CreateNumber(100 * input[vc100Mili]));
cJSON_AddItemToObject(json, "mili50", cJSON_CreateNumber(100 * input[vc50Mili]));
cJSON_AddItemToObject(json, "mili20", cJSON_CreateNumber(100 * input[vc20Mili]));
cJSON_AddItemToObject(json, "mili10", cJSON_CreateNumber(100 * input[vc10Mili]));
}
}
......
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