diff --git a/src/eez/modules/psu/gui/psu.cpp b/src/eez/modules/psu/gui/psu.cpp index 649d76b7e..d307c574a 100644 --- a/src/eez/modules/psu/gui/psu.cpp +++ b/src/eez/modules/psu/gui/psu.cpp @@ -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)); } } diff --git a/src/eez/modules/psu/scpi/trigger.cpp b/src/eez/modules/psu/scpi/trigger.cpp index 277745dd3..d76664f54 100644 --- a/src/eez/modules/psu/scpi/trigger.cpp +++ b/src/eez/modules/psu/scpi/trigger.cpp @@ -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; diff --git a/src/eez/modules/psu/trigger.cpp b/src/eez/modules/psu/trigger.cpp index 5cdda2f75..e44c276e6 100644 --- a/src/eez/modules/psu/trigger.cpp +++ b/src/eez/modules/psu/trigger.cpp @@ -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; }