Skip to content

Commit 2e8e95a

Browse files
committed
check also return of FspTimer::get_available_timer()
1 parent 013e818 commit 2e8e95a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

+9-7
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,15 @@ class ArduinoLEDMatrix
173173
bool rv = true;
174174
uint8_t type;
175175
uint8_t ch = FspTimer::get_available_timer(type);
176-
// TODO: avoid passing "this" argument to remove autoscroll
177-
rv &= _ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this);
178-
rv &= _ledTimer.setup_overflow_irq();
179-
rv &= _ledTimer.open();
180-
rv &= _ledTimer.start();
181-
182-
return rv;
176+
if(ch != -1) {
177+
// TODO: avoid passing "this" argument to remove autoscroll
178+
rv &= _ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this);
179+
rv &= _ledTimer.setup_overflow_irq();
180+
rv &= _ledTimer.open();
181+
rv &= _ledTimer.start();
182+
return rv;
183+
}
184+
return false;
183185
}
184186
void next() {
185187
uint32_t frame[3];

0 commit comments

Comments
 (0)