Skip to content

Fix sleeping and add stop script#12

Open
Ectalite wants to merge 4 commits into
usetrmnl:mainfrom
Ectalite:main
Open

Fix sleeping and add stop script#12
Ectalite wants to merge 4 commits into
usetrmnl:mainfrom
Ectalite:main

Conversation

@Ectalite
Copy link
Copy Markdown

@Ectalite Ectalite commented May 30, 2025

As said in issue #10, my kindle PW3 goes into deep sleep after circa 1min in sleep. Because of this, you have to use something other than just the sleep function.
After some reading on https://github.com/pascalw/kindle-dash and https://www.mobileread.com/forums/showthread.php?t=235821, I wrote a commit to fix it.

It works on my PW3 and should also work on a PW2.
I don't know how sleep is managed on more recent models.

I also included some power management functions that are called in the https://github.com/pascalw/kindle-dash project.

Copy link
Copy Markdown
Contributor

@Xatter Xatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like really useful updates to lower the power utilization so maybe kindles can work on battery rather than being plugged in all the time.

Just seems to be missing a script otherwise looks good and when the script is checked in I'll test this on my Gen 7 PW

Comment thread zip_example/TRMNL.sh
Comment thread zip_example/TRMNL.sh
if [ 1 -eq $DISABLE_WIFI ]; then
eips_debug "Disabling WiFi"
lipc-set-prop com.lab126.cmd wirelessEnable 0
#lipc-set-prop com.lab126.wifid enable 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete commented code if not going to be readily used

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know if disabling wifid would be relevant here, there doesn't seem to be any information about it on kindlemodding.org. Maybe it would be interesting for power utilization, but it would require more testing.

This script will try to ping the given IP until it succeeds. We use it to be sure that the kindle is connected to internet before trying to get an image.
@Ectalite
Copy link
Copy Markdown
Author

Ectalite commented Jun 4, 2025

I forgot to add the script, here it is.

I tried to run the code during the week-end on my kindle and the results were interesting:

  • Battery went from 100% to 23% in about 72h with refresh rate set to 180s. Which is not that bad considering that the battery suffered from not being charged for about 2 years.
  • There is a clear problem with the refresh of the image, when I finished the experiment (after 72h) the screen had a lot of image retention and new images weren't properly put on screen.
  • Frontlight was on during the whole experiment, I only saw it at the end because even if you put the backlight on minimum it's still not off. So there must be a way to completely deactivate it and such get more battery out of it.
  • Date and battery percentage are appearing on screen which means kindle is not sleeping. This would also resolve the frontlight problem.

Comment thread zip_example/TRMNL.sh
/etc/init.d/framework stop
initctl stop webreader >/dev/null 2>&1
echo powersave >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
lipc-set-prop com.lab126.powerd preventScreenSaver 1
Copy link
Copy Markdown
Author

@Ectalite Ectalite Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure frontlight problem comes from line 66, I have to check if it impacts the refresh if I remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked this on my Gen7 PW and my light does not stay on, it does come on briefly when it refreshes but then turns off again so not sure. I might be able to come up with a way to have device specific code run though

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After retesting, I have the same behaviour. I will try to find something better, maybe we can refresh the screen without turning it on at all.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Xatter
I do have a Gen7 PW too but I've been struggling for quite some time to have the TRMNL PNGs render
I only get a blank screen - using other PNGs seem to work but not the TRMNL API one :/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ectalite did you find any solutions regrading the lights up ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sohel2020,
I think we should check into creating a native application, a bash script is nice as a proof of concept, but it has too many issues.

@Xatter
Copy link
Copy Markdown
Contributor

Xatter commented Jun 4, 2025

LGTM 👍 Works on my Gen7 PW and increases the battery life

@Ectalite
Copy link
Copy Markdown
Author

Ectalite commented Jun 4, 2025

Nice to hear

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.

4 participants