-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve wake-up time #586
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
Improve wake-up time #586
Conversation
Very likely to avoid cases where the controller has gone haywire and doesn't turn on without such a reset. |
|
#480 also makes wakeup from a button press faster by lowering the debounce time from 200ms to 10 and waking up the watch immediately. Together these two PRs make waking up from a buttonpress practically instant! |
|
Merged with #480 and I'm so happy :) This goes perfectly together. 11 ms rock solid wake-up time with button. |
|
I've just flashed a build with this PR and #480 and while it's definitely faster, I feel like occasionally the button doesn't wake the device on the first try. I think it's only immediately after sleeping, if I do wake, sleep, wake, the 2nd wake doesn't work. It is however super fast, it feels like it's awake before I've finished pressing the button... |
|
I've been running this and haven't had any issues. If this will be merged, I think the commented out code should be removed and also this comment |
|
Works fine without issues on my PineTime too. |
|
I think this has been tested by @kieranc (and others using his test builds) by now and I think it can be merged. |
geekbozu
left a comment
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.
been distracted lately, This has been on my watch for a good few days now as well and its been awesome! Thanks @hubmartin!
@Avamander is right : I felt more comfortable by resetting all devices at wake up to ensure they are in a stable and known state. But indeed, this PR (together with #480) make the watch seem a lot faster, and it's better for user experience. So I suggest we merge them and test them until the next release to ensure there's no unexpected side effects :) |
|
I use this for a long time on Pine and P8 and no issues. |
|
I have been using this for the last month and it is working great. |
Hi, I've noticed that wake-up time is not as fast as I would expect. So I did a little investigation and would like to discuss what could be improved.
When I use button or wake-up on wrist, then there is really perceptible delay between button press and the moment I can read time. This delay slightly affects the wake-up on wrist, because when the logic detects the wrist motion, it is starting and you still moving your wrist up to wake it up, but this is not necessary since the movement was already sensed.
So I connected button and LCD backlight to the oscilloscope and measured the delays and different possible improvements.
Double-tap wake-up configuration
Current wake-up time differs in one configuration option - Double tap wake-up. This is turned on after reboot. When this is on, then wake-up is faster (no delays). When you turn double-tap off, then the touch constroller is completely put to sleep, and only 50ms reset pulse + more delays will initialize it. So wake-up with double-tap off adds at least additional 115ms (improvements below).
Current Wake-up times
Double-tap enabled 400-600 ms
Double-tap disabled 600-750 ms
Analysis of functions and delays
This analysis does not take into account communication delays, its just differnet delays commands in the code.
Functions which are in
case Messages::GoToRunning:in SystemTask.cpp have these delays inside:SPI - no delays
twiMaster - no delays
CST touch init - only when double tap is off
50+5+50+5+5 = 115ms
SPI NOR flash - no delays
LCD
HardwareReset 10 ms
SoftwareReset reset 150ms
ColMod 10ms
DisplayInversionOn 10ms
NormalModeOn 10ms
= 190ms in delays
Improvements
Touch controller
applies only when double tap is off
The first
nrf_gpio_pin_set(pinReset);with 50ms delay really is not necessary. So this saves us 50 ms just there.The second 50ms delay after reset is tricky. No info in datasheet, just other drivers also have 50ms.. I keep it for now but it seemed like 20-30ms was too little and touch sometimes initialized much later and missed the first swipe. So it might not worth the risk for 10-20 ms. Let's keep it.
So we gained 50 ms
LCD
JF002 had this comment in
St7789::Wakeup():// TODO why do we need to reset the controller?So I removed both SW and HW reset. Kept
SleepOut();.And because we do not reset controller, then we might remove bunch of other calls which have 10 ms delays in it.
And it works perfectly fine without resets. However this needs to be tested by others. I have no deep knowledge why the code used resets in the first place.
Bonus points: 190 ms
Final measurements
So we improved touch controller reset, but that's just the edge case when someone disables double tap wake-up. But the LCD really improved timing.
Previously we 400-600 ms wake up time. Now we have 200-300ms wake-up time.
This feels muuuch better and it feels like the lcd turns on instantly.
More ideas?
I was thinking if we can shuffle the functions in wake-up state machine. For example turn on LCD first and then activate touch and SPI flash. But this might not be possible because then you might miss the first swipe gesture (tested), or when I2C or SPI flash is disabled, then the screen might not display some data from flash...
Current PR is safe and complete, so you can merge it and test how it works for you. I just let this as WIP DRAFT PR in case we might figure more improvements.
Thanks for feedback and other ideas.