Merge pull request #3740 from craftandtheory/next
Haptic feedback in lua scripts
This commit is contained in:
@@ -693,6 +693,32 @@ static int luaPlayTone(lua_State * L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*luadoc
|
||||||
|
@function luaPlayHaptic(duration, pause [, flags])
|
||||||
|
|
||||||
|
Generate haptic feedback
|
||||||
|
|
||||||
|
@param duration (number) length of the haptic feedback in milliseconds
|
||||||
|
|
||||||
|
@param pause (number) length of the silence after haptic feedback in milliseconds
|
||||||
|
|
||||||
|
@param flags (number):
|
||||||
|
* `0 or not present` play with normal priority
|
||||||
|
* `PLAY_NOW` play immediately
|
||||||
|
|
||||||
|
@status current Introduced in 2.2.0
|
||||||
|
*/
|
||||||
|
static int luaPlayHaptic(lua_State * L)
|
||||||
|
{
|
||||||
|
#if defined(HAPTIC)
|
||||||
|
int length = luaL_checkinteger(L, 1);
|
||||||
|
int pause = luaL_checkinteger(L, 2);
|
||||||
|
int flags = luaL_optinteger(L, 3, 0);
|
||||||
|
haptic.play(length, pause, flags);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function killEvents(key)
|
@function killEvents(key)
|
||||||
|
|
||||||
@@ -866,6 +892,7 @@ const luaL_Reg opentxLib[] = {
|
|||||||
{ "playNumber", luaPlayNumber },
|
{ "playNumber", luaPlayNumber },
|
||||||
{ "playDuration", luaPlayDuration },
|
{ "playDuration", luaPlayDuration },
|
||||||
{ "playTone", luaPlayTone },
|
{ "playTone", luaPlayTone },
|
||||||
|
{ "playHaptic", luaPlayHaptic },
|
||||||
{ "popupInput", luaPopupInput },
|
{ "popupInput", luaPopupInput },
|
||||||
{ "defaultStick", luaDefaultStick },
|
{ "defaultStick", luaDefaultStick },
|
||||||
{ "defaultChannel", luaDefaultChannel },
|
{ "defaultChannel", luaDefaultChannel },
|
||||||
|
|||||||
Reference in New Issue
Block a user