Skip to content
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

ESP32: enable wake-on-touch #4781

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@manningt
Copy link

commented May 13, 2019

ports/esp32/modesp32.c: Add touch_pad_set_meas_time & touch_pad_set_fsm_mode.

@manningt manningt changed the title Update modesp32.c ESP32: enable wake-on-touch May 13, 2019

@dpgeorge

This comment has been minimized.

Copy link
Member

commented May 14, 2019

Thanks for the patch.

Perhaps it's better to call these functions in ports/esp32/machine_touchpad.c, just after touch_pad_init()? That would match better with what the ESP32 docs say about the use of these functions, and also mean that touch.config() can be called before (or after) esp32.wake_on_touch()

@manningt

This comment has been minimized.

Copy link
Author

commented May 14, 2019

I originally put the 2 calls in machine_touchpad.c. I moved them to modesp32.c figuring it would only change the touch_pad behavior (FSM mode & meas_time) for applications using wake_on_touch, instead of changing it for all touch_pad applications. I'd be fine with putting it after touch_pad_init(); I just wanted to explain the reasoning. Please indicate which you prefer.

@dpgeorge

This comment has been minimized.

Copy link
Member

commented May 15, 2019

I'd be fine with putting it after touch_pad_init(); I just wanted to explain the reasoning.

It's definitely good to consider the impact of a change. But I'd prefer it to go just after touch_pad_init(). Using the hardware timer for touch should give better results (I guess?) and gives a cleaner implementation. If it really affects users then we can (later on) add an option to TouchPad to select which FSM mode is used.

@manningt manningt closed this May 15, 2019

@manningt manningt force-pushed the manningt:esp32-enable-wake-on-touch branch from 99a0e49 to c0a1de3 May 15, 2019

call touch_pad_set_meas_time & set_fsm_mode after touch_pad_init
touch_pad_set_FSM_mode needs to be set to timer for wake_on_touch to work.
call touch_pad_set_meas_time to reduce current draw in deep_sleep

@manningt manningt reopened this May 15, 2019

@manningt

This comment has been minimized.

Copy link
Author

commented May 15, 2019

Made the change to perform the 2 calls after touch_pad_init in machine_touchpad.c, per the preference.

@dpgeorge

This comment has been minimized.

Copy link
Member

commented May 17, 2019

Thanks for updating the PR. I tested it and found that it takes about 0.5 seconds (a noticeable time at the REPL) to initialise (construct) and call config() on a touch pad object. And this is because the sleep_cycle value is large. Reducing this value to 0x1000 makes it much faster and from what I measure doesn't really affect the light-sleep current.

The default values for sleep_cycle and meas_cycle are 0x1000 and 0x7fff.

I'd prefer to keep the sleep_cycle the default of 0x1000. Eventually it could be configured by the user. @manningt do you agree to change it to 0x1000?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.