Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
a3dc13e3
Commit
a3dc13e3
authored
Mar 09, 2017
by
devsaurus
Browse files
fix tmr.interval()
parent
b3ec03e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/tmr.c
View file @
a3dc13e3
...
@@ -192,12 +192,13 @@ static int tmr_interval(lua_State* L)
...
@@ -192,12 +192,13 @@ static int tmr_interval(lua_State* L)
luaL_argcheck
(
L
,
interval
>
0
&&
interval
<=
MAX_TIMEOUT
,
2
,
MAX_TIMEOUT_ERR_STR
);
luaL_argcheck
(
L
,
interval
>
0
&&
interval
<=
MAX_TIMEOUT
,
2
,
MAX_TIMEOUT_ERR_STR
);
if
(
tmr
->
mode
!=
TIMER_MODE_OFF
)
{
if
(
tmr
->
mode
!=
TIMER_MODE_OFF
)
{
tmr
->
interval
=
interval
;
tmr
->
interval
=
interval
;
if
(
!
(
tmr
->
mode
&
TIMER_IDLE_FLAG
))
{
if
(
xTimerChangePeriod
(
tmr
->
timer
,
xTimerStop
(
tmr
->
timer
,
portMAX_DELAY
);
pdMS_TO_TICKS
(
tmr
->
interval
),
if
(
xTimerChangePeriod
(
tmr
->
timer
,
tmr
->
interval
,
portMAX_DELAY
)
!=
pdPASS
)
{
portMAX_DELAY
)
!=
pdPASS
)
{
luaL_error
(
L
,
"cannot change period"
);
luaL_error
(
L
,
"cannot change period"
);
}
}
// stop again since xTimerChangePeriod will re-start the timer
if
(
tmr
->
mode
&
TIMER_IDLE_FLAG
)
{
// xTimerChangePeriod will start a dormant timer, thus force stop if it was dormant
xTimerStop
(
tmr
->
timer
,
portMAX_DELAY
);
xTimerStop
(
tmr
->
timer
,
portMAX_DELAY
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment