diff --git a/src/eez/gui/app_context.cpp b/src/eez/gui/app_context.cpp index 6d3894c75..72796d7af 100644 --- a/src/eez/gui/app_context.cpp +++ b/src/eez/gui/app_context.cpp @@ -45,7 +45,6 @@ #include #define CONF_GUI_TOAST_DURATION_MS 2000L -#define CONF_GUI_TOAST_WITH_ACTION_DURATION_MS 5000L namespace eez { namespace gui { @@ -83,7 +82,7 @@ void AppContext::stateManagment() { uint32_t inactivityPeriod = psu::idle::getGuiAndEncoderInactivityPeriod(); if (getActivePageId() == INTERNAL_PAGE_ID_TOAST_MESSAGE) { ToastMessagePage *page = (ToastMessagePage *)getActivePage(); - if ((page->hasAction() && inactivityPeriod >= CONF_GUI_TOAST_WITH_ACTION_DURATION_MS) || (!page->hasAction() && inactivityPeriod >= CONF_GUI_TOAST_DURATION_MS)) { + if (!page->hasAction() && inactivityPeriod >= CONF_GUI_TOAST_DURATION_MS) { popPage(); return; } diff --git a/src/eez/gui/widget.cpp b/src/eez/gui/widget.cpp index 0648cf364..e134590aa 100644 --- a/src/eez/gui/widget.cpp +++ b/src/eez/gui/widget.cpp @@ -269,7 +269,10 @@ void enumWidgets(WidgetCursor &widgetCursor, EnumWidgetsCallback callback) { } // pass click through if active page is toast page and clicked outside - bool passThrough = g_appContext->getActivePageId() == INTERNAL_PAGE_ID_TOAST_MESSAGE; + bool passThrough = + g_appContext->getActivePageId() == INTERNAL_PAGE_ID_TOAST_MESSAGE && + !((ToastMessagePage *)g_appContext->getActivePage())->hasAction(); + // clicked outside internal page, close internal page popPage(); @@ -361,7 +364,9 @@ WidgetCursor findWidget(int16_t x, int16_t y) { if (!widgetCursor) { // clicked outside internal page, close internal page - bool passThrough = g_appContext->getActivePageId() == INTERNAL_PAGE_ID_TOAST_MESSAGE; + bool passThrough = + g_appContext->getActivePageId() == INTERNAL_PAGE_ID_TOAST_MESSAGE && + !((ToastMessagePage *)g_appContext->getActivePage())->hasAction(); popPage(); diff --git a/src/eez/modules/psu/channel.cpp b/src/eez/modules/psu/channel.cpp index 8c16b3f61..f6c63d71a 100644 --- a/src/eez/modules/psu/channel.cpp +++ b/src/eez/modules/psu/channel.cpp @@ -1148,6 +1148,9 @@ bool Channel::isRemoteSensingEnabled() { void Channel::remoteProgrammingEnable(bool enable) { if (enable != flags.rprogEnabled) { + if (list::isActive(*this)) { + trigger::abort(); + } doRemoteProgrammingEnable(enable); event_queue::pushEvent((enable ? event_queue::EVENT_INFO_CH1_REMOTE_PROG_ENABLED : event_queue::EVENT_INFO_CH1_REMOTE_PROG_DISABLED) + channelIndex); profile::save(); diff --git a/src/eez/modules/psu/channel_dispatcher.cpp b/src/eez/modules/psu/channel_dispatcher.cpp index 9e25975f6..35e8fd287 100644 --- a/src/eez/modules/psu/channel_dispatcher.cpp +++ b/src/eez/modules/psu/channel_dispatcher.cpp @@ -1290,22 +1290,6 @@ void remoteSensingEnable(Channel &channel, bool enable) { } } -void remoteProgrammingEnable(Channel &channel, bool enable) { - if (channel.channelIndex < 2 && (g_couplingType == COUPLING_TYPE_SERIES || g_couplingType == COUPLING_TYPE_PARALLEL)) { - Channel::get(0).remoteProgrammingEnable(enable); - Channel::get(1).remoteProgrammingEnable(enable); - } else if (channel.flags.trackingEnabled) { - for (int i = 0; i < CH_NUM; ++i) { - Channel &trackingChannel = Channel::get(i); - if (trackingChannel.flags.trackingEnabled) { - trackingChannel.remoteProgrammingEnable(enable); - } - } - } else { - channel.remoteProgrammingEnable(enable); - } -} - bool isTripped(Channel &channel) { if (channel.channelIndex < 2 && (g_couplingType == COUPLING_TYPE_SERIES || g_couplingType == COUPLING_TYPE_PARALLEL)) { return Channel::get(0).isTripped() || Channel::get(1).isTripped(); diff --git a/src/eez/modules/psu/channel_dispatcher.h b/src/eez/modules/psu/channel_dispatcher.h index 8f5214dc6..1ea2f4057 100644 --- a/src/eez/modules/psu/channel_dispatcher.h +++ b/src/eez/modules/psu/channel_dispatcher.h @@ -115,7 +115,6 @@ bool outputEnable(Channel &channel, bool enable, int *err); void disableOutputForAllChannels(); void remoteSensingEnable(Channel &channel, bool enable); -void remoteProgrammingEnable(Channel &channel, bool enable); bool isTripped(Channel &channel); void clearProtection(Channel &channel); diff --git a/src/eez/modules/psu/gui/psu.cpp b/src/eez/modules/psu/gui/psu.cpp index d307c574a..b690b5cb3 100644 --- a/src/eez/modules/psu/gui/psu.cpp +++ b/src/eez/modules/psu/gui/psu.cpp @@ -1299,8 +1299,8 @@ void channelToggleOutput() { errorMessage("Channel is tripped!"); } else { bool triggerModeEnabled = - channel_dispatcher::getVoltageTriggerMode(channel) != TRIGGER_MODE_FIXED || - channel_dispatcher::getCurrentTriggerMode(channel) != TRIGGER_MODE_FIXED; + (channel_dispatcher::getVoltageTriggerMode(channel) != TRIGGER_MODE_FIXED || + channel_dispatcher::getCurrentTriggerMode(channel) != TRIGGER_MODE_FIXED) && !channel.isRemoteProgrammingEnabled(); if (channel.isOutputEnabled()) { if (triggerModeEnabled) { diff --git a/src/eez/modules/psu/list_program.h b/src/eez/modules/psu/list_program.h index 8a57c02c8..9b2a788a2 100644 --- a/src/eez/modules/psu/list_program.h +++ b/src/eez/modules/psu/list_program.h @@ -67,6 +67,7 @@ bool setListValue(Channel &channel, int16_t it, int *err); void tick(uint32_t tick_usec); bool isActive(); +bool isActive(Channel &channel); extern int g_numChannelsWithVisibleCounters; extern int g_channelsWithVisibleCounters[CH_MAX]; diff --git a/src/eez/modules/psu/psu.cpp b/src/eez/modules/psu/psu.cpp index 73a3c844a..fa0edb771 100644 --- a/src/eez/modules/psu/psu.cpp +++ b/src/eez/modules/psu/psu.cpp @@ -457,6 +457,9 @@ static bool psuReset() { Channel::get(i).reset(); } + // + channel_dispatcher::setTrackingChannels(0); + // trigger::reset();