Skip to content

Commit 6bc8c96

Browse files
committed
Error handling improvements
1 parent d0f9914 commit 6bc8c96

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

CanHacker.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ CanHacker::ERROR CanHacker::processInterrupt() {
215215
return ERROR_NOT_CONNECTED;
216216
}
217217

218-
uint8_t irq = mcp2515->getInterrupts();
219-
220218
if (irq & MCP2515::CANINTF_ERRIF) {
221219
// reset RXnOVR errors
222220
mcp2515->clearRXnOVR();
@@ -238,19 +236,28 @@ CanHacker::ERROR CanHacker::processInterrupt() {
238236

239237
/*if (irq & (MCP2515::CANINTF_TX0IF | MCP2515::CANINTF_TX1IF | MCP2515::CANINTF_TX2IF)) {
240238
_debugStream->print("MCP_TXxIF\r\n");
241-
stopAndBlink(1);
239+
//stopAndBlink(1);
242240
}*/
243241

244242

245243

246-
/*if (irq & MCP2515::CANINTF_WAKIF) {
244+
if (irq & MCP2515::CANINTF_WAKIF) {
247245
_debugStream->print("MCP_WAKIF\r\n");
248-
stopAndBlink(3);
249-
}*/
246+
//stopAndBlink(3);
247+
}
248+
249+
if (irq & MCP2515::CANINTF_ERRIF) {
250+
_debugStream->print("ERRIF\r\n");
251+
252+
//return ERROR_MCP2515_MERRF;
253+
mcp2515->clearMERR();
254+
}
250255

251256
if (irq & MCP2515::CANINTF_MERRF) {
252-
_debugStream->print("MCP_MERRF\r\n");
253-
return ERROR_MCP2515_MERRF;
257+
_debugStream->print("MERRF\r\n");
258+
259+
//return ERROR_MCP2515_MERRF;
260+
mcp2515->clearInterrupts();
254261
}
255262

256263
return ERROR_OK;

0 commit comments

Comments
 (0)