Fix building with DEVKIT_0_9 defined.
This got broken in the 1.4.0 overhaul, mea culpa.
This commit is contained in:
parent
e31a8f433a
commit
382eea5079
|
@ -62,6 +62,7 @@
|
|||
#define LUA_OPTIMIZE_MEMORY 0
|
||||
#endif /* LUA_OPTRAM */
|
||||
|
||||
#define READLINE_INTERVAL 80
|
||||
#define LUA_TASK_PRIO USER_TASK_PRIO_0
|
||||
#define LUA_PROCESS_LINE_SIG 2
|
||||
|
||||
|
|
|
@ -152,6 +152,47 @@ static int key_press_count = 0;
|
|||
static bool key_short_pressed = false;
|
||||
static bool key_long_pressed = false;
|
||||
static os_timer_t keyled_timer;
|
||||
static int long_key_ref = LUA_NOREF;
|
||||
static int short_key_ref = LUA_NOREF;
|
||||
|
||||
static void default_long_press(void *arg) {
|
||||
if (led_high_count == 12 && led_low_count == 12) {
|
||||
led_low_count = led_high_count = 6;
|
||||
} else {
|
||||
led_low_count = led_high_count = 12;
|
||||
}
|
||||
// led_high_count = 1000 / READLINE_INTERVAL;
|
||||
// led_low_count = 1000 / READLINE_INTERVAL;
|
||||
// NODE_DBG("default_long_press is called. hc: %d, lc: %d\n", led_high_count, led_low_count);
|
||||
}
|
||||
|
||||
static void default_short_press(void *arg) {
|
||||
system_restart();
|
||||
}
|
||||
|
||||
static void key_long_press(void *arg) {
|
||||
NODE_DBG("key_long_press is called.\n");
|
||||
if (long_key_ref == LUA_NOREF) {
|
||||
default_long_press(arg);
|
||||
return;
|
||||
}
|
||||
if (!gL)
|
||||
return;
|
||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, long_key_ref);
|
||||
lua_call(gL, 0, 0);
|
||||
}
|
||||
|
||||
static void key_short_press(void *arg) {
|
||||
NODE_DBG("key_short_press is called.\n");
|
||||
if (short_key_ref == LUA_NOREF) {
|
||||
default_short_press(arg);
|
||||
return;
|
||||
}
|
||||
if (!gL)
|
||||
return;
|
||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, short_key_ref);
|
||||
lua_call(gL, 0, 0);
|
||||
}
|
||||
|
||||
static void update_key_led (void *p)
|
||||
{
|
||||
|
@ -225,48 +266,6 @@ static int node_led( lua_State* L )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int long_key_ref = LUA_NOREF;
|
||||
static int short_key_ref = LUA_NOREF;
|
||||
|
||||
void default_long_press(void *arg) {
|
||||
if (led_high_count == 12 && led_low_count == 12) {
|
||||
led_low_count = led_high_count = 6;
|
||||
} else {
|
||||
led_low_count = led_high_count = 12;
|
||||
}
|
||||
// led_high_count = 1000 / READLINE_INTERVAL;
|
||||
// led_low_count = 1000 / READLINE_INTERVAL;
|
||||
// NODE_DBG("default_long_press is called. hc: %d, lc: %d\n", led_high_count, led_low_count);
|
||||
}
|
||||
|
||||
void default_short_press(void *arg) {
|
||||
system_restart();
|
||||
}
|
||||
|
||||
void key_long_press(void *arg) {
|
||||
NODE_DBG("key_long_press is called.\n");
|
||||
if (long_key_ref == LUA_NOREF) {
|
||||
default_long_press(arg);
|
||||
return;
|
||||
}
|
||||
if (!gL)
|
||||
return;
|
||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, long_key_ref);
|
||||
lua_call(gL, 0, 0);
|
||||
}
|
||||
|
||||
void key_short_press(void *arg) {
|
||||
NODE_DBG("key_short_press is called.\n");
|
||||
if (short_key_ref == LUA_NOREF) {
|
||||
default_short_press(arg);
|
||||
return;
|
||||
}
|
||||
if (!gL)
|
||||
return;
|
||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, short_key_ref);
|
||||
lua_call(gL, 0, 0);
|
||||
}
|
||||
|
||||
// Lua: key(type, function)
|
||||
static int node_key( lua_State* L )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue