mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Avoid negative _claims
This commit is contained in:
parent
063f5056f2
commit
39fb2902ec
1 changed files with 3 additions and 2 deletions
|
|
@ -22,10 +22,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void release() {
|
void release() {
|
||||||
|
if (_claims == 0) return; // avoid negative _claims
|
||||||
|
|
||||||
|
_claims--;
|
||||||
if (_claims == 0) {
|
if (_claims == 0) {
|
||||||
digitalWrite(_pin, !_active);
|
digitalWrite(_pin, !_active);
|
||||||
} else {
|
|
||||||
_claims--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue