From cbcedbc6abc590d38b67b48750f76b7141b23397 Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Sun, 4 Feb 2024 12:47:10 -0500 Subject: [PATCH] Fix docs and also free the timer --- components/modules/rotary.c | 6 ++++++ docs/modules/rotary.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/modules/rotary.c b/components/modules/rotary.c index 94a9f72f..8292b549 100644 --- a/components/modules/rotary.c +++ b/components/modules/rotary.c @@ -187,6 +187,12 @@ static int lrotary_close( lua_State* L ) d->handle = NULL; } + + if (d->timer_handle) { + esp_timer_stop(d->timer_handle); + esp_timer_delete(d->timer_handle); + d->timer_handle = NULL; + } return 0; } diff --git a/docs/modules/rotary.md b/docs/modules/rotary.md index f591c53f..194c7fd2 100644 --- a/docs/modules/rotary.md +++ b/docs/modules/rotary.md @@ -60,7 +60,7 @@ Sets a callback on specific events. `switch:on(eventtype[, callback])` #### Parameters -- `eventtype` This defines the type of event being registered. This is the logical or of one or more of `PRESS`, `LONGPRESS`, `RELEASE`, `TURN`, `CLICK` or `DBLCLICK`. +- `eventtype` This defines the type of event being registered. This is the logical or of one or more of `PRESS`, `LONGPRESS`, `RELEASE`, `TURN`, `CLICK` or `DBLCLICK`. `ALL` can be used as shorthand for all event types. - `callback` This is a function that will be invoked when the specified event happens. If the callback is None or omitted, then the registration is cancelled.