"powersequences gefixed, commentaar en buttons enabled/disabled

This commit is contained in:
Wesley Hofman
2025-09-19 15:10:49 +02:00
parent 46ad1a708c
commit e806c2fbfa
3 changed files with 205 additions and 252 deletions

View File

@@ -104,13 +104,15 @@ namespace HTOLHAST
//InitializeDataTablePowerSupplySettings();
//InitializeDgvPowerSupplySettings();
//KeithleyValidationOfMethods();
InitializeButtons();
InitializeButtons(false);
InitDgvPowersupply();
InitDgvHeaderSetting();
InitDgvMeasurements();
InitDgvPowerSequences();
InitSwitchMatrix();
InitializePowerupSequence();
InitializePowerDownSequence();
InitDgvPowerSequences();
}
@@ -119,18 +121,21 @@ namespace HTOLHAST
// Bind powerup sequences to datagridviews
bindingSourcePowerUpSequence.DataSource = powerUpSequences;
dgvPowerUpSequence.DataSource = bindingSourcePowerUpSequence;
dgvPowerUpSequence.Refresh();
bindingSourcePowerDownSequence.DataSource = powerDownSequences;
dgvPowerDownSequence.DataSource = bindingSourcePowerDownSequence;
dgvPowerDownSequence.DataSource = bindingSourcePowerDownSequence;
dgvPowerDownSequence.Refresh();
}
#region INITIALIZATION
private void InitializeButtons()
private void InitializeButtons( bool state)
{
btnClear.Enabled = false;
btnMeasure.Enabled = false;
btnNextPosition.Enabled = false;
btnClear.Enabled = state;
btnMeasure.Enabled = state;
btnNextPosition.Enabled = state;
btnSendPsuSettings.Enabled = false;
btnSendPsuSettings.Enabled = state;
}
private void InitDgvMeasurements()
{
@@ -236,19 +241,21 @@ namespace HTOLHAST
{
// Mandatory instruments:
Task.Run(() => InitializePSU1(tbResourceStringPSU1.Text));
Task.Run(() => InitializeDAQ(tbResourceStringDAQ.Text));
InitializePSU1(tbResourceStringPSU1.Text);
InitializeDAQ(tbResourceStringDAQ.Text);
// Optional Instruments check if to be used
if (cbPSU2Enabled.Checked)
{
Task.Run(() => InitializePSU2(tbResourceStringPSU2.Text));
InitializePSU2(tbResourceStringPSU2.Text);
}
if (cbPAMEnabled.Checked)
{
Task.Run(() => InitializePAM(tbResourceStringPAM.Text));
InitializePAM(tbResourceStringPAM.Text);
}
InitializeButtons(true);
}
public void InitializePSU1(string resourceString)
{
@@ -395,6 +402,8 @@ namespace HTOLHAST
private void btnInitializeInstruments_Click(object sender, EventArgs e)
{
InitializeInstruments();
}
#endregion
@@ -441,7 +450,7 @@ namespace HTOLHAST
MeasurePSUVoltage();
MeasureHeaderVoltage();
MeasureCurrent();
PowerDownPSU(powerUpSequences);
PowerDownPSU(powerDownSequences);
// Timestamp, Position, Device, Measurement, Voltage, Current
// 2025-01-09, 1, HAMEG1, CH1, 1.0, 0.1
@@ -544,6 +553,7 @@ namespace HTOLHAST
{
if (powersupply.Channel <= 4)
{
// Meet eerst de stroom met de HAMEG
HMP4040Sample current = (HMP4040Sample) PSU1.MeasureCurrent(powersupply.Channel);
if (PAM == null) { return; }