Skip to content

Commit

Permalink
remember inhibit by user flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Feb 20, 2020
1 parent 2415c2b commit dc661ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/eez/modules/psu/io_pins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ static uint32_t g_toutputPulseStartTickCount;

static bool g_pinState[NUM_IO_PINS] = { false, false, false, false };

static bool g_isInhibitedByUser;

#if defined EEZ_PLATFORM_STM32

int ioPinRead(int pin) {
Expand Down Expand Up @@ -181,7 +179,7 @@ void tick(uint32_t tickCount) {
int inputPin2Value = ioPinRead(EXT_TRIG2);
bool inputPin2State = (inputPin2Value && inputPin2.polarity == io_pins::POLARITY_POSITIVE) || (!inputPin2Value && inputPin2.polarity == io_pins::POLARITY_NEGATIVE);

unsigned inhibited = g_isInhibitedByUser;
unsigned inhibited = persist_conf::devConf.isInhibitedByUser;

if (!inhibited) {
if (inputPin1.function == io_pins::FUNCTION_INHIBIT) {
Expand Down Expand Up @@ -295,11 +293,11 @@ void refresh() {
}

bool getIsInhibitedByUser() {
return g_isInhibitedByUser;
return persist_conf::devConf.isInhibitedByUser;
}

void setIsInhibitedByUser(bool isInhibitedByUser) {
g_isInhibitedByUser = isInhibitedByUser;
persist_conf::setIsInhibitedByUser(isInhibitedByUser);
}

bool isInhibited() {
Expand Down
4 changes: 4 additions & 0 deletions src/eez/modules/psu/persist_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,10 @@ void setEventQueueFilter(int eventQueueFilter) {
g_devConf.eventQueueFilter = eventQueueFilter;
}

void setIsInhibitedByUser(int isInhibitedByUser) {
g_devConf.isInhibitedByUser = isInhibitedByUser;
}

////////////////////////////////////////////////////////////////////////////////

static const uint16_t MODULE_PERSIST_CONF_BLOCK_MODULE_CONFIGURATION_ADDRESS = 64;
Expand Down
3 changes: 3 additions & 0 deletions src/eez/modules/psu/persist_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ struct DeviceConfiguration {
unsigned channelsViewMode : 3;
unsigned maxChannel : 3; // 0: default view, 1: Ch1 maxed, 2: Ch2 maxed, ...
unsigned channelsViewModeInMax : 3;
unsigned isInhibitedByUser : 1;

// block 7
UserSwitchAction userSwitchAction;
Expand Down Expand Up @@ -315,6 +316,8 @@ void setSortFilesOption(SortFilesOption sortFilesOption);

void setEventQueueFilter(int eventQueueFilter);

void setIsInhibitedByUser(int isInhibitedByUser);

////////////////////////////////////////////////////////////////////////////////

struct ModuleConfiguration {
Expand Down

0 comments on commit dc661ba

Please sign in to comment.