Open
Conversation
- Added Hardware Reset of lora module at startup - Fixed push button duration bug - Set IRQ var to be volatile
Moved #include definition here Added wakeStatus to wakeCallback to get what waked us Added pointer to TheThingsNetwork object to enable Lora module sleep/wake up
removed #include definition (in .h now) Added wakeStatus bit field to wakeCallback to get what waked us Added pointer to TheThingsNetwork object to enable Lora module sleep/wake up Added IRQ for INT2 (Lora Serial Module) Added new configInterval method Optimized Light Sensor Changed deepSleep to support wake by lora module
johanstokking
requested changes
Mar 2, 2018
Member
johanstokking
left a comment
There was a problem hiding this comment.
Nice, thanks very much! Mostly code style issues.
Also looping in @laurensslats for testing
| void wake() { | ||
| node->setColor(TTN_GREEN); | ||
| void wake(uint8_t wakeReason) { | ||
| debugSerial.print(F("Wake Reason:0x")); |
| debugSerial.print(F("Wake Reason:0x")); | ||
| debugSerial.println(wakeReason,HEX); | ||
|
|
||
| if (wakeReason&TTN_WAKE_WATCHDOG) { |
Member
There was a problem hiding this comment.
Spacing; wakeReason & TTN_WAKE_WATCHDOG
| node->setColor(TTN_GREEN); | ||
| void wake(uint8_t wakeReason) { | ||
| debugSerial.print(F("Wake Reason:0x")); | ||
| debugSerial.println(wakeReason,HEX); |
| ``` | ||
|
|
||
| - `bool enabled`: Enable or disable the interval callback. Enabled automatically by `onInterval()`, but you can use this method to temporarily disable it. Defaults to `false`. | ||
| - `TheThingsNetwork * pttn`: This enable the interval callback but in this mode, the interval is passed to RN2483 or RN2903 module (this is why we need to pass pointer to object) with the command `sys sleep ms` and then it's the LoRa module that wake up the node. This is the most advanced Low Power Mode. In this mode, the watchdog is disabled and consuption again reduced. |
| debugSerial.print(timepressed); | ||
| debugSerial.println(F(" ms")); | ||
| snprintf_P(buf, sizeof(buf), PSTR("-- SEND: BUTTON %d ms"), timepressed); | ||
| debugSerial.println(buf); |
Member
There was a problem hiding this comment.
Build the string here with print/println calls for consistency
| value = readADCLowNoise(true); | ||
|
|
||
| // Vcc reference in millivolts | ||
| vcc = ( 1023L * 1100L) / value ; |
|
|
||
| // Operating range of ATMega | ||
| if (vcc < 1800 ) vcc = 1800 ; | ||
| if (vcc > 5500 ) vcc = 5500 ; |
| if (vcc > 5500 ) vcc = 5500 ; | ||
|
|
||
| // Vcc in millivolts | ||
| return ( vcc ); |
|
|
||
| // hardware reset of LoRa module, so module is reset on sketch upload | ||
| #ifdef TTN_LORA_RESET | ||
| // reset RN2483 module, this allow to reset module on sketch upload also |
| cli(); | ||
| bitSet(EIFR,INTF2); // clear any pending interrupts for serial RX pin (INT2 D0) | ||
| sei(); | ||
|
|
Contributor
Author
|
@johanstokking you want me to remove any use of printf, sprintf and snprintf, correct? |
Contributor
Author
|
Requested changes are done |
Member
|
@hallard we try to keep dynamic memory allocations to a minimum, at least that's a goal! |
Contributor
Author
|
removing printf is not a bad idea, I think it also save same pgm space (as soon as it's not used anywhere else in any lib) |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.