Skip to content

Commit

Permalink
fixed list execution problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jan 16, 2020
1 parent 20c02ee commit 3601e3b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/eez/gui/app_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <eez/system.h>

#define CONF_GUI_TOAST_DURATION_MS 2000L
#define CONF_GUI_TOAST_WITH_ACTION_DURATION_MS 5000L

namespace eez {
namespace gui {
Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 7 additions & 2 deletions src/eez/gui/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions src/eez/modules/psu/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 0 additions & 16 deletions src/eez/modules/psu/channel_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/eez/modules/psu/channel_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/eez/modules/psu/gui/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/eez/modules/psu/list_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
3 changes: 3 additions & 0 deletions src/eez/modules/psu/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ static bool psuReset() {
Channel::get(i).reset();
}

//
channel_dispatcher::setTrackingChannels(0);

//
trigger::reset();

Expand Down

0 comments on commit 3601e3b

Please sign in to comment.