Skip to content

Commit

Permalink
DP AUTO mode removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Dec 16, 2019
1 parent 139c262 commit b2bb882
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/eez/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ enum AdcDataType {

enum DprogState {
DPROG_STATE_OFF = 0,
DPROG_STATE_ON = 1,
DPROG_STATE_AUTO = 2
DPROG_STATE_ON = 1
};

enum ChannelFeatures {
Expand Down
16 changes: 7 additions & 9 deletions src/eez/modules/dcpX05/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ struct Channel : ChannelInterface {
adc.init();
dac.init();

dprogState = DPROG_STATE_AUTO;
dprogState = DPROG_STATE_ON;
}

void onPowerDown(int subchannelIndex) {
}

void reset(int subchannelIndex) {
uSet = 0;
dprogState = DPROG_STATE_AUTO;
dprogState = DPROG_STATE_ON;
dpOn = false;
uBeforeBalancing = NAN;
iBeforeBalancing = NAN;
Expand Down Expand Up @@ -239,9 +239,9 @@ struct Channel : ChannelInterface {
}

if (channel.params.features & CH_FEATURE_DPROG) {
if (dprogState == DPROG_STATE_AUTO) {
if (dprogState == DPROG_STATE_ON) {
// turn off DP after delay
if (delayed_dp_off && (micros() - delayed_dp_off_start) >= DP_OFF_DELAY_PERIOD * 1000000L) {
if (delayed_dp_off && (millis() - delayed_dp_off_start) >= DP_OFF_DELAY_PERIOD) {
delayed_dp_off = false;
setDpEnable(false);
}
Expand Down Expand Up @@ -422,7 +422,7 @@ struct Channel : ChannelInterface {

if (enable) {
if (channel.params.features & CH_FEATURE_DPROG) {
if (dprogState == DPROG_STATE_AUTO) {
if (dprogState == DPROG_STATE_ON) {
// enable DP
dpNegMonitoringTime = micros();
delayed_dp_off = false;
Expand Down Expand Up @@ -464,10 +464,10 @@ struct Channel : ChannelInterface {
setCurrentRange(subchannelIndex);

if (channel.params.features & CH_FEATURE_DPROG) {
if (dprogState == DPROG_STATE_AUTO) {
if (dprogState == DPROG_STATE_ON) {
// turn off DP after some delay
delayed_dp_off = true;
delayed_dp_off_start = micros();
delayed_dp_off_start = millis();
}
}
}
Expand Down Expand Up @@ -515,8 +515,6 @@ struct Channel : ChannelInterface {

if (dprogState == DPROG_STATE_OFF) {
setDpEnable(false);
} else if (dprogState == DPROG_STATE_ON) {
setDpEnable(true);
} else {
setDpEnable(channel.isOutputEnabled());
}
Expand Down
4 changes: 2 additions & 2 deletions src/eez/modules/psu/conf_advanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@

/// This is the delay period, after the channel output went OFF,
/// after which we shall turn DP off.
/// Value is given in seconds.
#define DP_OFF_DELAY_PERIOD 1
/// Value is given in milliseconds.
#define DP_OFF_DELAY_PERIOD 10

/// Text returned by the SYStem:CAPability command
#define STR_SYST_CAP "DCSUPPLY WITH (MEASURE|MULTIPLE|TRIGGER)"
Expand Down
2 changes: 0 additions & 2 deletions src/eez/modules/psu/gui/page_ch_settings_adv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ void ChSettingsAdvOptionsPage::toggleProgramming() {
void ChSettingsAdvOptionsPage::toggleDprog() {
if (g_channel->getDprogState() == DPROG_STATE_OFF) {
g_channel->setDprogState(DPROG_STATE_ON);
} else if (g_channel->getDprogState() == DPROG_STATE_ON) {
g_channel->setDprogState(DPROG_STATE_AUTO);
} else {
g_channel->setDprogState(DPROG_STATE_OFF);
}
Expand Down
8 changes: 7 additions & 1 deletion src/eez/modules/psu/profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ void recallChannelsFromProfile(Parameters *profile, int location) {
channel.flags.currentRangeSelectionMode = profile->channels[i].flags.currentRangeSelectionMode;
channel.flags.autoSelectCurrentRange = profile->channels[i].flags.autoSelectCurrentRange;

channel.setDprogState((DprogState)profile->channels[i].flags.dprogState);
DprogState dprogState = (DprogState)profile->channels[i].flags.dprogState;
if (dprogState == DPROG_STATE_OFF) {
channel.setDprogState(DPROG_STATE_OFF);
} else {
channel.setDprogState(DPROG_STATE_ON);
}

channel.flags.trackingEnabled = profile->channels[i].flags.trackingEnabled;

#if OPTION_SD_CARD
Expand Down
1 change: 0 additions & 1 deletion src/eez/modules/psu/scpi/outp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ scpi_result_t scpi_cmd_outputStateTriggeredQ(scpi_t *context) {
scpi_choice_def_t dprogStateChoice[] = {
{ "ON", DPROG_STATE_ON },
{ "OFF", DPROG_STATE_OFF },
{ "AUTO", DPROG_STATE_AUTO },
SCPI_CHOICE_LIST_END /* termination of option list */
};

Expand Down

0 comments on commit b2bb882

Please sign in to comment.