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
382eea50
Commit
382eea50
authored
Nov 09, 2015
by
Johny Mattsson
Browse files
Fix building with DEVKIT_0_9 defined.
This got broken in the 1.4.0 overhaul, mea culpa.
parent
e31a8f43
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/include/user_config.h
View file @
382eea50
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
#define LUA_OPTIMIZE_MEMORY 0
#define LUA_OPTIMIZE_MEMORY 0
#endif
/* LUA_OPTRAM */
#endif
/* LUA_OPTRAM */
#define READLINE_INTERVAL 80
#define LUA_TASK_PRIO USER_TASK_PRIO_0
#define LUA_TASK_PRIO USER_TASK_PRIO_0
#define LUA_PROCESS_LINE_SIG 2
#define LUA_PROCESS_LINE_SIG 2
...
...
app/modules/node.c
View file @
382eea50
...
@@ -152,6 +152,47 @@ static int key_press_count = 0;
...
@@ -152,6 +152,47 @@ static int key_press_count = 0;
static
bool
key_short_pressed
=
false
;
static
bool
key_short_pressed
=
false
;
static
bool
key_long_pressed
=
false
;
static
bool
key_long_pressed
=
false
;
static
os_timer_t
keyled_timer
;
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
)
static
void
update_key_led
(
void
*
p
)
{
{
...
@@ -225,48 +266,6 @@ static int node_led( lua_State* L )
...
@@ -225,48 +266,6 @@ static int node_led( lua_State* L )
return
0
;
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)
// Lua: key(type, function)
static
int
node_key
(
lua_State
*
L
)
static
int
node_key
(
lua_State
*
L
)
{
{
...
...
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