Skip to content

Conversation

@IoTThinks
Copy link

@IoTThinks IoTThinks commented Dec 23, 2025

Added powersaving to all ESP32 boards (Heltec v2, v3, v3, wsl3...) with RTC-supported DIO1

  • First sleep (if powersaving is enabled) is 2 minutes from boot. Then after that, they will try to sleep every 5s.
  • In powersaving, the ESP32 boards will consume only 9mA. Much less than 50mA without powersaving.
  • Added CLI powersaving, powersaving on and powersaving off to manage powersaving mode.
  • Support for boards with DIO1 wiring to non-RTC GPIO (Xiao S3...) will be added after this PR. For now, they will continue to work but without any powersaving.

This is the old PR with all comments and discussion.
Thanks a lot for your supports, comments and reviews.
Merry Chirstmas to everyone.
#1107

This is CLI for powersaving.
image

Added CLI to enable/disable powersaving
@SaschaKt
Copy link

I'm using your modification since the first day and helped to improve with testing and suggestions. Your mod is running on 2x v4 and 3x v3 Repeaters without problems. One of the repeater is solar based with only 5W Panel and 6000mAh battery and installed on the roof. I had in 24h no noticeable battery draining, it was very cloudy and over the day I think it was enough to support the v3 and now over night the accu is still at 78% like it was before 12h earlier. Thank you for your work, heltec is since your modification a really good and cheap repeater. It should be integrated it official firmware for all esps, and the cli powersaving on / off is perfect also for those connected to AC power.

Little question. Is when CLI powersaving on still active after reboot or plugging off from power? The last set should be saved and be active also after a reboot or power on

@IoTThinks
Copy link
Author

IoTThinks commented Dec 23, 2025

Little question. Is when CLI powersaving on still active after reboot or plugging off from power? The last set should be saved and be active also after a reboot or power on

Hi @SaschaKt,
Yes, the last powersaving setting is saved and will continue after you reboot the repeater.
E.g: If you set powersaving on, then you reboot the repeater.
After boot, the powersaving is still on and effective.

@csrutil
Copy link
Contributor

csrutil commented Dec 23, 2025

Thank you so much, this will help a lot of people. Very great work!

@IoTThinks
Copy link
Author

IoTThinks commented Dec 23, 2025

Thank you so much, this will help a lot of people. Very great work!

Yah, it is helping many friends to survive winter now.

The work is intially submitted by me.
However, a lot of reviewers have put in valuable improvement to the codes too.
So now it becomes our work instead.

I hope we can have an initial "framework" to implement to powersaving to all MCUs and companions.

At least, we have sleep() in the Mainboard for all boards to inherit now.

Then we can move on and improve it further.

Thanks a lot for reviewing.

Merry Chirstmas.

@Cisien
Copy link

Cisien commented Dec 23, 2025

For consistency, the cli command should probably be get powersaving and set powersaving on/off

@weebl2000
Copy link

See also IoTThinks#1

@IoTThinks
Copy link
Author

See also IoTThinks#1

I already replied.

@IoTThinks
Copy link
Author

IoTThinks commented Dec 24, 2025

For consistency, the cli command should probably be get powersaving and set powersaving on/off

May be, a bit long. And the code is a bit messy for get and set area.

But how about this?
image

@weebl2000
Copy link

weebl2000 commented Dec 24, 2025

For consistency, the cli command should probably be get powersaving and set powersaving on/off

May be, a bit long. And the code is a bit messy for get and set area. :D

But how about this? image

The cli isn't very consistent to begin with. There are some commands that work without set/get and some that work with. 😂

@IoTThinks
Copy link
Author

@liamcottle Should we use "set powersaving on/off" and "get powersaving"? Or "powersaving" and "powersaving on/off"?
Thanks a lot.

@IoTThinks
Copy link
Author

@weebl2000 I merged and pushed your suggested changes to this PR.

  1. Added powersaving_enabled sanitization - CommonCLI.cpp:98 - prevents garbage values from uninitialized prefs
  2. Reordered struct field - CommonCLI.h - moved powersaving_enabled to match serialization order (after bridge_secret)

For this one, I modified hasPendingWork() to return bool instead.
4. Renamed method - MyMesh.cpp/h - hasPendingWork() → getPendingWorkCount() for clarity

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

Successfully merging this pull request may close these issues.

5 participants