Skip to content

Commit

Permalink
IMMediate trigger delay
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jan 14, 2020
1 parent 2852daa commit 3f767e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 1 addition & 6 deletions src/eez/modules/psu/gui/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,12 +1329,7 @@ void channelToggleOutput() {
void channelInitiateTrigger() {
popPage();
int err = trigger::initiate();
if (err == SCPI_RES_OK) {
if (!trigger::isInitiated()) {
Channel &channel = Channel::get(g_toggleOutputWidgetCursor.cursor.i >= 0 ? g_toggleOutputWidgetCursor.cursor.i : 0);
channel_dispatcher::outputEnable(channel, true);
}
} else {
if (err != SCPI_RES_OK) {
psuErrorMessage(g_toggleOutputWidgetCursor.cursor, data::MakeScpiErrorValue(err));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/scpi/trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static scpi_choice_def_t sourceChoice[] = { { "BUS", trigger::SOURCE_BUS },

scpi_result_t scpi_cmd_triggerSequenceImmediate(scpi_t *context) {
// TODO migrate to generic firmware
int result = trigger::startImmediately();
int result = trigger::generateTrigger(trigger::SOURCE_IMMEDIATE);
if (result != SCPI_RES_OK) {
SCPI_ErrorPush(context, result);
return SCPI_RES_ERR;
Expand Down
16 changes: 9 additions & 7 deletions src/eez/modules/psu/trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,17 @@ int startImmediately() {
}

int initiate() {
int err = checkTrigger();
if (err) {
return err;
}

setState(STATE_INITIATED);

if (persist_conf::devConf.triggerSource == SOURCE_IMMEDIATE) {
return startImmediately();
} else {
int err = checkTrigger();
if (err) {
return err;
}
setState(STATE_INITIATED);
return trigger::generateTrigger(trigger::SOURCE_IMMEDIATE);
}

return SCPI_RES_OK;
}

Expand Down

0 comments on commit 3f767e7

Please sign in to comment.