-
Notifications
You must be signed in to change notification settings - Fork 26
Bugfix and add Low Power Mode #12
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
Bugfix and add Low Power Mode #12
Conversation
hallard
commented
Feb 12, 2018
- Created Low Power Battery Monitor example enabling lora module sleep mode
- Added Hard reset of Lora module at startup (with IO pin)
- Fixed issue The Things Node button release does not provide time pressed #9
- Enable Low Power of Lora Module of other examples sketches
- Added Hardware Reset of lora module at startup - Fixed push button duration bug - Set IRQ var to be volatile
This new pull request #12 should fix your issue, just let me know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hallard !! Looks good. Few changes, mostly styling. I'd like to keep this repository clean and consistent.
library.properties
Outdated
@@ -1,5 +1,5 @@ | |||
name=TheThingsNode | |||
version=2.0.2 | |||
version=2.0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're bumping versions in the master
branch after merging – sometimes we combine PRs in a version
src/TheThingsNode.cpp
Outdated
@@ -72,9 +73,12 @@ void TTN_BUTTON_FN() | |||
uint8_t trigger = getPinChangeInterruptTrigger(digitalPinToPCINT(TTN_BUTTON)); | |||
if (trigger == FALLING) | |||
{ | |||
//Serial.println(F("IPRESS")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove if not used
src/TheThingsNode.cpp
Outdated
// Don't go to sleep mode while button is still pressed | ||
// because if so, timer of ms will be stopped and duration | ||
// of pressed button will not work | ||
if ( this->buttonPressed ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting (spaces)
src/TheThingsNode.cpp
Outdated
@@ -737,6 +749,15 @@ TheThingsNode::TheThingsNode() | |||
pinMode(TTN_BLUE_LED, OUTPUT); | |||
setColor(TTN_BLACK); | |||
|
|||
// set pin mode every time to avoid constraining the user about when the pin is initialized | |||
#ifdef TTN_LORA_RESET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting (indentation)
docs/TheThingsNode.md
Outdated
@@ -81,6 +81,9 @@ void sleep() { | |||
} | |||
``` | |||
|
|||
Pay attention, this internal sleep method of the library does not put the Lora module (RN2483) into sleep mode and thus your node may consume 3mA even in sleep mode. You need to manually set the lora module to sleep and wake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lora -> LoRa
lora -> LoRa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RN2483 can also be RN2903
examples/Basic/Basic.ino
Outdated
@@ -140,4 +143,11 @@ void sendData(uint8_t port) | |||
payload[5] = bytes[0]; | |||
|
|||
ttn.sendBytes(payload, sizeof(payload), port); | |||
|
|||
// Set RN2483 to sleep mode | |||
ttn.sleep( 60000 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting (spaces)
ttn.sendBytes(lpp.getBuffer(), lpp.getSize(), port); | ||
|
||
// Set RN2483 to sleep mode | ||
ttn.sleep( (uint32_t) (CONFIG_INTERVAL*1000) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting (spaces)
@@ -0,0 +1,172 @@ | |||
// ********************************************************************************** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although useful, we're not using these headers in examples.
Please add the concerning comments in code, if necessary.
@@ -122,7 +122,7 @@ void sendData(uint8_t port, uint32_t value) | |||
ttn.sendBytes(lpp.getBuffer(), lpp.getSize(), port); | |||
|
|||
// Set RN2483 to sleep mode | |||
ttn.sleep( (uint32_t) (CONFIG_INTERVAL*1000) ); | |||
ttn.sleep( CONFIG_INTERVAL*1000 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to say no spaces in the parentheses 😊
Can you also fix the CI? |
I've done all modifications, travis should be fine on next check |
@hallard you're using the Please change .travis.yml#L14 to version |
It's done, sorry wrong comments |
Thanks, this is now part of https://github.com/TheThingsNetwork/arduino-node-lib/releases/tag/v2.0.5 |