Skip to content

Commit

Permalink
MCP230xx - Fix millisecond counter reset placement
Browse files Browse the repository at this point in the history
  • Loading branch information
andrethomas committed Sep 15, 2018
1 parent 1c23907 commit 98cfb00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sonoff/xsns_29_mcp230xx.ino
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ void MCP230xx_CheckForInterrupt(void) {
if (report_int) {
bool int_tele = false;
bool int_event = false;
unsigned long millis_since_last_int = millis() - int_millis[intp+(mcp230xx_port*8)];
unsigned long millis_now = millis();
unsigned long millis_since_last_int = millis_now - int_millis[intp+(mcp230xx_port*8)];
int_millis[intp+(mcp230xx_port*8)]=millis_now;
switch (Settings.mcp230xx_config[intp+(mcp230xx_port*8)].int_report_mode) {
case 0:
int_tele=true;
Expand All @@ -304,7 +306,6 @@ void MCP230xx_CheckForInterrupt(void) {
sprintf(command,"event MCPINT_D%i=%i",intp+(mcp230xx_port*8),((mcp230xx_intcap >> intp) & 0x01));
ExecuteCommand(command, SRC_RULE);
}
int_millis[intp+(mcp230xx_port*8)]=millis();
}
}
}
Expand Down

0 comments on commit 98cfb00

Please sign in to comment.