Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
carllocos authored and tolauwae committed Nov 22, 2021
1 parent 4d9d799 commit edfd5de
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,14 @@ def_prim(subscribe_interrupt, threeToNoneU32) {
def_prim(unsubscribe_interrupt, oneToNoneU32) {
uint8_t pin = arg0.uint32;

handlers.erase(std::remove_if(handlers.begin(), handlers.end(),
[pin](Interrupt *handler) {
return handler->pin == pin;
}),
handlers.end());
auto it = std::remove_if(
handlers.begin(), handlers.end(),
[pin](Interrupt *handler) { return handler->pin == pin; });

if (it != handlers.end()) {
handlers.erase(it, handlers.end());
detachInterrupt(digitalPinToInterrupt(pin));
}

pop_args(1);
return true;
Expand Down

0 comments on commit edfd5de

Please sign in to comment.