[SX126x] Added missing OCP range check
This commit is contained in:
parent
362dde44b0
commit
f336922013
1 changed files with 5 additions and 0 deletions
|
@ -662,6 +662,11 @@ int16_t SX126x::setSyncWord(uint8_t syncWord, uint8_t controlBits) {
|
|||
}
|
||||
|
||||
int16_t SX126x::setCurrentLimit(float currentLimit) {
|
||||
// check allowed range
|
||||
if(!((currentLimit >= 0) && (currentLimit <= 140))) {
|
||||
return(ERR_INVALID_CURRENT_LIMIT);
|
||||
}
|
||||
|
||||
// calculate raw value
|
||||
uint8_t rawLimit = (uint8_t)(currentLimit / 2.5);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue