Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to set the TxPower #15

Open
TRudolphi opened this issue May 5, 2021 · 0 comments
Open

Possibility to set the TxPower #15

TRudolphi opened this issue May 5, 2021 · 0 comments

Comments

@TRudolphi
Copy link

I wanted to have the possibility to set the TxPower of my sensors so nearby nodes can be set to a lower power to save the batteries. I changed in my local copy of LoRaNow the following to add this (the sf was already in the lib, but I set it in the text for orientation):

LoRaNow.h:
#define LORANOW_DEFAULT_SF 7
#define LORANOW_DEFAULT_POWER 10

class LoRaNowClass : public Stream
{
private:
uint8_t sf = LORANOW_DEFAULT_SF;
uint8_t txpower = LORANOW_DEFAULT_POWER;

void setSpreadingFactor(int _sf);
void setTxPower(uint8_t _power );

LoRaNow.cpp:
void LoRaNowClass::setSpreadingFactor(int _sf)
{
sf = _sf;
}

void LoRaNowClass::setTxPower(uint8_t _power )
{
txpower = _power;
}

void LoRaNowClass::txMode()
{
LORANOW_DEBUG_PRINT(millis());LORANOW_DEBUG_PRINTLN("[ln] txMode");
LoRa.idle();
LoRa.setFrequency(frequency);
LoRa.setSpreadingFactor(sf);
LoRa.setTxPower(txpower);

==
Maybe this addition is also handy for other users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant