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
7d20dd74
Commit
7d20dd74
authored
Jun 27, 2015
by
devsaurus
Browse files
Merge remote-tracking branch 'upstream/dev' into dev
parents
388a0b4e
dce0d2c2
Changes
8
Show whitespace changes
Inline
Side-by-side
README.md
View file @
7d20dd74
...
...
@@ -35,6 +35,15 @@ Tencent QQ group: 309957875<br />
-
add coap module (done)
-
cross compiler (done)
# Change log
2015-06-27
<br
/>
fixed ap/station-ap cannot connect to the device.
<br
/>
added wifi.ap.getconfig().
<br
/>
fixed net.dns.getdnsserver().
<br
/>
added new base64 lua example.
<br
/>
added node.bootreason() to inspect boot cause.
<br
/>
optimization of u8g.
<br
/>
# Change log
2015-06-25
<br
/>
move constants to ROM. Frees up 16k+ of RAM.
<br
/>
...
...
app/include/rom.h
View file @
7d20dd74
...
...
@@ -39,6 +39,9 @@ extern unsigned char * base64_decode(const unsigned char *src, size_t len, size_
extern
void
mem_init
(
void
*
start_addr
);
// 2, 3 = reset (module dependent?), 4 = wdt
int
rtc_get_reset_reason
(
void
);
// Hardware exception handling
struct
exception_frame
{
...
...
app/include/user_version.h
View file @
7d20dd74
...
...
@@ -7,6 +7,6 @@
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 0.9.6"
#define BUILD_DATE "build 2015062
5
"
#define BUILD_DATE "build 2015062
7
"
#endif
/* __USER_VERSION_H__ */
app/lwip/app/dhcpserver.c
View file @
7d20dd74
...
...
@@ -13,7 +13,7 @@
#include "user_interface.h"
////////////////////////////////////////////////////////////////////////////////////
static
const
uint8_t
xid
[
4
]
=
{
0xad
,
0xde
,
0x12
,
0x23
};
static
uint8_t
xid
[
4
]
=
{
0xad
,
0xde
,
0x12
,
0x23
};
static
u8_t
old_xid
[
4
]
=
{
0
};
static
const
uint8_t
magic_cookie
[
4
]
=
{
99
,
130
,
83
,
99
};
static
struct
udp_pcb
*
pcb_dhcps
=
NULL
;
...
...
app/modules/net.c
View file @
7d20dd74
...
...
@@ -13,6 +13,7 @@
#include "c_types.h"
#include "mem.h"
#include "espconn.h"
#include "lwip/dns.h"
#ifdef CLIENT_SSL_ENABLE
unsigned
char
*
default_certificate
;
...
...
@@ -1447,14 +1448,16 @@ static int net_getdnsserver( lua_State* L )
if
(
numdns
>=
DNS_MAX_SERVERS
)
return
luaL_error
(
L
,
"server index out of range [0-%d]"
,
DNS_MAX_SERVERS
-
1
);
ip_addr_t
ipaddr
;
dns_getserver
(
numdns
,
&
ipaddr
);
// ip_addr_t ipaddr;
// dns_getserver(numdns,&ipaddr);
// Bug fix by @md5crypt https://github.com/nodemcu/nodemcu-firmware/pull/500
ip_addr_t
ipaddr
=
dns_getserver
(
numdns
);
if
(
ip_addr_isany
(
&
ipaddr
)
)
{
lua_pushnil
(
L
);
}
else
{
char
temp
[
20
]
=
{
0
};
c_sprintf
(
temp
,
IPSTR
,
IP2STR
(
&
ipaddr
)
);
c_sprintf
(
temp
,
IPSTR
,
IP2STR
(
&
ipaddr
.
addr
)
);
lua_pushstring
(
L
,
temp
);
}
...
...
app/modules/node.c
View file @
7d20dd74
...
...
@@ -414,6 +414,13 @@ static int node_setcpufreq(lua_State* L)
return
1
;
}
// Lua: code = bootreason()
static
int
node_bootreason
(
lua_State
*
L
)
{
lua_pushnumber
(
L
,
rtc_get_reset_reason
());
return
1
;
}
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
...
...
@@ -438,6 +445,7 @@ const LUA_REG_TYPE node_map[] =
{
LSTRKEY
(
"CPU80MHZ"
),
LNUMVAL
(
CPU80MHZ
)
},
{
LSTRKEY
(
"CPU160MHZ"
),
LNUMVAL
(
CPU160MHZ
)
},
{
LSTRKEY
(
"setcpufreq"
),
LFUNCVAL
(
node_setcpufreq
)
},
{
LSTRKEY
(
"bootreason"
),
LFUNCVAL
(
node_bootreason
)
},
// Combined to dsleep(us, option)
// { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
#if LUA_OPTIMIZE_MEMORY > 0
...
...
app/modules/wifi.c
View file @
7d20dd74
...
...
@@ -815,6 +815,19 @@ static int wifi_ap_getbroadcast( lua_State* L ){
return
wifi_getbroadcast
(
L
,
SOFTAP_IF
);
}
// Lua: wifi.ap.getconfig()
static
int
wifi_ap_getconfig
(
lua_State
*
L
)
{
struct
softap_config
config
;
wifi_softap_get_config
(
&
config
);
lua_pushstring
(
L
,
config
.
ssid
);
if
(
config
.
authmode
=
AUTH_OPEN
)
lua_pushnil
(
L
);
else
lua_pushstring
(
L
,
config
.
password
);
return
2
;
}
// Lua: wifi.ap.config(table)
static
int
wifi_ap_config
(
lua_State
*
L
)
{
...
...
@@ -1030,6 +1043,7 @@ static const LUA_REG_TYPE wifi_station_map[] =
{
LSTRKEY
(
"connect"
),
LFUNCVAL
(
wifi_station_connect4lua
)
},
{
LSTRKEY
(
"disconnect"
),
LFUNCVAL
(
wifi_station_disconnect4lua
)
},
{
LSTRKEY
(
"autoconnect"
),
LFUNCVAL
(
wifi_station_setauto
)
},
{
LSTRKEY
(
"getconfig"
),
LFUNCVAL
(
wifi_ap_getconfig
)
},
{
LSTRKEY
(
"getip"
),
LFUNCVAL
(
wifi_station_getip
)
},
{
LSTRKEY
(
"setip"
),
LFUNCVAL
(
wifi_station_setip
)
},
{
LSTRKEY
(
"getbroadcast"
),
LFUNCVAL
(
wifi_station_getbroadcast
)
},
...
...
lua_modules/base64/base64_v2.lua
0 → 100644
View file @
7d20dd74
--this version actually works
local
tab
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
base64
=
{
enc
=
function
(
data
)
local
l
,
out
=
0
,
''
local
m
=
(
3
-
data
:
len
()
%
3
)
%
3
local
d
=
data
..
string.rep
(
'
\0
'
,
m
)
for
i
=
1
,
d
:
len
()
do
l
=
bit
.
lshift
(
l
,
8
)
l
=
l
+
d
:
byte
(
i
,
i
)
if
i
%
3
==
0
then
for
j
=
1
,
4
do
local
a
=
bit
.
rshift
(
l
,
18
)
+
1
out
=
out
..
tab
:
sub
(
a
,
a
)
l
=
bit
.
band
(
bit
.
lshift
(
l
,
6
),
0xFFFFFF
)
end
end
end
return
out
:
sub
(
1
,
-
1
-
m
)
..
string.rep
(
'='
,
m
)
end
,
dec
=
function
(
data
)
local
a
,
b
=
data
:
gsub
(
'='
,
'A'
)
local
out
=
''
local
l
=
0
for
i
=
1
,
a
:
len
()
do
l
=
l
+
tab
:
find
(
a
:
sub
(
i
,
i
))
-
1
if
i
%
4
==
0
then
out
=
out
..
string.char
(
bit
.
rshift
(
l
,
16
),
bit
.
band
(
bit
.
rshift
(
l
,
8
),
255
),
bit
.
band
(
l
,
255
))
l
=
0
end
l
=
bit
.
lshift
(
l
,
6
)
end
return
out
:
sub
(
1
,
-
b
-
1
)
end
}
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