Skip to content

Commit

Permalink
Fix docs and also free the timer
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsg committed Feb 4, 2024
1 parent a6d3e4b commit cbcedbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/modules/rotary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/rotary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cbcedbc

Please sign in to comment.