Skip to content

Commit 38978cb

Browse files
committed
small fix
1 parent a5f08c6 commit 38978cb

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

examples/leonardo_cdc/leonardo_cdc/leonardo_cdc.ino

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ const int INT_PIN = 3;
1414
CanHackerLineReader *lineReader = NULL;
1515
CanHacker *canHacker = NULL;
1616

17-
void handleError(const CanHacker::ERROR error);
18-
1917
void setup() {
2018
Serial.begin(115200);
2119
SPI.begin();
@@ -25,7 +23,7 @@ void setup() {
2523

2624

2725
canHacker = new CanHacker(interfaceStream, debugStream, SPI_CS_PIN);
28-
canHacker->enableLoopback();
26+
canHacker->enableLoopback(); // Enable Loopback mode for offline tests
2927
lineReader = new CanHackerLineReader(canHacker);
3028

3129
pinMode(INT_PIN, INPUT);
@@ -34,34 +32,9 @@ void setup() {
3432
void loop() {
3533
if (digitalRead(INT_PIN) == LOW) {
3634
CanHacker::ERROR error = canHacker->processInterrupt();
37-
handleError(error);
3835
}
3936
if (Serial.available()) {
4037
CanHacker::ERROR error = lineReader->process();
41-
handleError(error);
4238
}
4339
}
4440

45-
46-
void handleError(const CanHacker::ERROR error) {
47-
48-
switch (error) {
49-
case CanHacker::ERROR_OK:
50-
case CanHacker::ERROR_UNKNOWN_COMMAND:
51-
case CanHacker::ERROR_NOT_CONNECTED:
52-
case CanHacker::ERROR_MCP2515_ERRIF:
53-
case CanHacker::ERROR_INVALID_COMMAND:
54-
return;
55-
56-
default:
57-
break;
58-
}
59-
60-
Serial.print("Failure (code ");
61-
Serial.print((int)error);
62-
Serial.println(")");
63-
64-
while (1) {
65-
delay(2000);
66-
} ;
67-
}

0 commit comments

Comments
 (0)