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

SX1278 Low Battery Action #925

Closed
Brynod opened this issue Jan 11, 2024 · 3 comments
Closed

SX1278 Low Battery Action #925

Brynod opened this issue Jan 11, 2024 · 3 comments
Labels
enhancement New feature or request resolved Issue was resolved (e.g. bug fixed, or feature implemented)

Comments

@Brynod
Copy link

Brynod commented Jan 11, 2024

Good evening,

First of all, many thanks for your excellent work with this library! The extensive examples have made this library a pleasure to use.

Looking at the datasheet for the SX1278, it appears that it is possible to set an action for "LOW BATTERY" warning. I have looked through the library and searched the wiki, but i can find no relevance to any kind of "SET_DIO_ACTION" for this event.

Has this feature been implemented in this library? If not, is there a way in which I can write a register to enable DIO0 to change state when this low battery condition is reached?

Apologies if this has already been answered...

Many thanks in advance.

Regards
Brynod

@jgromes
Copy link
Owner

jgromes commented Jan 12, 2024

At the moment, this is not implemented - simply because there was no such request. Although it may be a good idea to add this, since other modules like SX126x implement some sort of low battery indicator interrupt as well if I recall correctly.

is there a way in which I can write a register to enable DIO0 to change state

Yes, RadioLib has a godmode which can be enabled by defining RADIOLIB_GODMODE e.g. in src/BuildOptUser.h. When enabled, it will allow you access to all low-level functions including raw register writes, using something like this:

Module* mod = radio.getMod();
mod->SPIsetRegValue(address, value); // see Module class documentation for details

@jgromes jgromes added the enhancement New feature or request label Jan 12, 2024
@Brynod
Copy link
Author

Brynod commented Jan 12, 2024

Many thanks for the reply sir! I will give this a try over the weekend and report back with my findings

Thanks again for the excellent library!

@jgromes
Copy link
Owner

jgromes commented Jan 13, 2024

@Brynod FYI I added this as setLowBatteryThrehold(level, pin). Example usage: radio.setLowBatteryThrehold(RADIOLIB_SX127X_LOW_BAT_THRESHOLD_2_045_V, 0); to enable 2.045 V detector at pin DIO0. One caveat: the datasheet is not entirely clear whether this functionality is only available for FSK modem. Please let me know if there are any issues.

@jgromes jgromes closed this as completed Jan 13, 2024
@jgromes jgromes added the resolved Issue was resolved (e.g. bug fixed, or feature implemented) label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resolved Issue was resolved (e.g. bug fixed, or feature implemented)
Projects
None yet
Development

No branches or pull requests

2 participants