Skip to content

Commit

Permalink
survive mode updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Dec 9, 2020
1 parent 2a4a0f1 commit 5502c6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/eez/modules/dib-dcp405/ioexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,20 @@ void IOExpander::tick(uint32_t tick_usec) {

uint8_t iodira = read(REG_IODIRA);
if (iodira == 0xFF || (gpio & gpioOutputPinsMask) != gpioWritten) {
#if !CONF_SURVIVE_MODE
if (iodira == 0xFF) {
#if CONF_SURVIVE_MODE
DebugTrace("IOEXP reset detected on channel %d\n", channel.channelIndex + 1);
#else
event_queue::pushChannelEvent(event_queue::EVENT_ERROR_CH_IOEXP_RESET_DETECTED, channel.channelIndex);
#endif
} else {
DebugTrace("IOEXP read: 0x%04X, expected: 0x%04X\n", (int)(gpio & gpioOutputPinsMask), (int)gpioWritten);
#if CONF_SURVIVE_MODE
DebugTrace("IOEXP fault match detected on channel %d\n", channel.channelIndex + 1);
#else
event_queue::pushChannelEvent(event_queue::EVENT_ERROR_CH_IOEXP_FAULT_MATCH_DETECTED, channel.channelIndex);
#endif
}
#endif

reinit();
readGpio();
Expand Down

0 comments on commit 5502c6a

Please sign in to comment.