limit max power on rf95 to 17 (rather than 20, because 20 can...

burn up parts if you exceed 1% duty cycle)
This commit is contained in:
geeksville 2020-05-02 19:52:37 -07:00
parent 80268ea56a
commit 79c61cf0e0

View File

@ -3,6 +3,9 @@
#include "RadioLibRF95.h"
#include <configuration.h>
#define MAX_POWER 17
// if we use 20 we are limited to 1% duty cycle or hw might overheat. For continuous operation set a limit of 17
RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi)
: RadioLibInterface(cs, irq, rst, 0, spi)
{
@ -17,8 +20,8 @@ bool RF95Interface::init()
RadioLibInterface::init();
applyModemConfig();
if (power > 20) // This chip has lower power limits than some
power = 20;
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;
iface = lora = new RadioLibRF95(&module);
int res = lora->begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength);
@ -67,8 +70,8 @@ bool RF95Interface::reconfigure()
err = lora->setFrequency(freq);
assert(err == ERR_NONE);
if (power > 20) // This chip has lower power limits than some
power = 20;
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;
err = lora->setOutputPower(power);
assert(err == ERR_NONE);