-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
To support lightsleep for Heltec V3/v4 repeater to achieve 9mA power consumption #1107
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
Changes from 18 commits
a4d59d4
2d9077b
6988834
9e9b280
c16102b
d0c342f
1f9806c
b54028e
0e77f9e
56df774
3599a26
c33cd2b
d86f596
d8954fa
adae43b
745566e
e636996
f94412b
97d7eeb
822c249
20ab10f
acee014
b97fb20
dd18ae7
4bc4d5a
79be9ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| #include <rom/rtc.h> | ||
| #include <sys/time.h> | ||
| #include <Wire.h> | ||
| #include <WiFi.h> | ||
|
|
||
| class ESP32Board : public mesh::MainBoard { | ||
| protected: | ||
|
|
@@ -42,6 +43,23 @@ class ESP32Board : public mesh::MainBoard { | |
| #endif | ||
| } | ||
|
|
||
| void enterLightSleep (uint32_t secs) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A better solution would be to use the GPIO wakeup source GPIO Wakeup (Light-sleep Only) Should be like this Then at the top you gotta add.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zjs81 I see. These boards will have issues if required to deepsleep as the wakeup pins without PULL UP/DOWN will be floating in deepsleep.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zjs81 Let me use and test your GPIO wakeup to maximize the compability for any ESP32-based board.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zjs81 I tested. Dio1 of sx1262 will have short rising HIGH. In my experience, I always use ext0 and ext1 for dio1 of sx1262. |
||
| esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); | ||
| esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // To wake up when receiving a LoRa packet | ||
|
|
||
| if (secs > 0) { | ||
| esp_sleep_enable_timer_wakeup(secs * 1000000); // To wake up every hour to do periodically jobs | ||
| } | ||
|
|
||
| esp_light_sleep_start(); // CPU enters light sleep | ||
| } | ||
|
|
||
| void sleep(uint32_t secs) override { | ||
| if (WiFi.getMode() == WIFI_MODE_NULL) { // WiFi is off ~ No active OTA, safe to go to sleep | ||
| enterLightSleep(secs); // To wake up after "secs" seconds or when receiving a LoRa packet | ||
| } | ||
| } | ||
|
|
||
| uint8_t getStartupReason() const override { return startup_reason; } | ||
|
|
||
| #if defined(P_LORA_TX_LED) | ||
|
|
@@ -78,6 +96,8 @@ class ESP32Board : public mesh::MainBoard { | |
| #endif | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
IoTThinks marked this conversation as resolved.
Outdated
|
||
| const char* getManufacturerName() const override { | ||
| return "Generic ESP32"; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ build_flags = | |
| -D MAX_NEIGHBOURS=50 | ||
| ; -D MESH_PACKET_LOGGING=1 | ||
| ; -D MESH_DEBUG=1 | ||
| -D POWERSAVING_MODE=1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really like the fact that we are enabling this for specific boards only. I know this can be rolled out to other boards later, but it will likely be confusing for some users if some boards show a different behavior than others (for example CLI accessibility after the initial 2 minute period).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, we will have power saving to all boards soon by default. All will have the same powersaving behaviors. |
||
| build_src_filter = ${Heltec_lora32_v3.build_src_filter} | ||
| +<helpers/ui/SSD1306Display.cpp> | ||
| +<../examples/simple_repeater> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.