From ee8daad3939d89913e37402bfce5410df015d2c6 Mon Sep 17 00:00:00 2001 From: funshine Date: Mon, 29 Dec 2014 09:29:19 +0800 Subject: [PATCH 1/4] add rtc time --- app/modules/tmr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/modules/tmr.c b/app/modules/tmr.c index 9c0e2d47..83f54ff8 100644 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -154,6 +154,16 @@ static int ICACHE_FLASH_ATTR tmr_wdclr( lua_State* L ) return 0; } +// Lua: time() , return rtc time in us +static int ICACHE_FLASH_ATTR tmr_time( lua_State* L ) +{ + unsigned t = 0xFFFFFFFF & system_get_rtc_time(); + unsigned c = 0xFFFFFFFF & system_rtc_clock_cali_proc(); + lua_pushinteger( L, t ); + lua_pushinteger( L, c ); + return 2; +} + // Module function map #define MIN_OPT_LEVEL 2 #include "lrodefs.h" @@ -164,6 +174,7 @@ const LUA_REG_TYPE tmr_map[] = { LSTRKEY( "alarm" ), LFUNCVAL( tmr_alarm ) }, { LSTRKEY( "stop" ), LFUNCVAL( tmr_stop ) }, { LSTRKEY( "wdclr" ), LFUNCVAL( tmr_wdclr ) }, + { LSTRKEY( "time" ), LFUNCVAL( tmr_time ) }, #if LUA_OPTIMIZE_MEMORY > 0 #endif From a331438c9b5b41134fda80a48890b10b6940f1ea Mon Sep 17 00:00:00 2001 From: funshine Date: Mon, 29 Dec 2014 21:57:37 +0800 Subject: [PATCH 2/4] add setip setmac api --- app/modules/wifi.c | 106 ++++++++++++++++++++++++++++++++++++++++++ examples/fragment.lua | 4 +- 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/app/modules/wifi.c b/app/modules/wifi.c index 3748cd3e..3b34b2e0 100644 --- a/app/modules/wifi.c +++ b/app/modules/wifi.c @@ -159,6 +159,18 @@ static int ICACHE_FLASH_ATTR wifi_getmac( lua_State* L, uint8_t mode ) return 1; } +// Lua: mac = wifi.xx.setmac() +static int ICACHE_FLASH_ATTR wifi_setmac( lua_State* L, uint8_t mode ) +{ + unsigned len = 0; + const char *mac = luaL_checklstring( L, 1, &len ); + if(len!=6) + return luaL_error( L, "wrong arg type" ); + + lua_pushboolean(L,wifi_set_macaddr(mode, (uint8 *)mac)); + return 1; +} + // Lua: ip = wifi.xx.getip() static int ICACHE_FLASH_ATTR wifi_getip( lua_State* L, uint8_t mode ) { @@ -167,10 +179,71 @@ static int ICACHE_FLASH_ATTR wifi_getip( lua_State* L, uint8_t mode ) wifi_get_ip_info(mode, &pTempIp); if(pTempIp.ip.addr==0){ lua_pushnil(L); + return 1; } else { c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.ip) ); lua_pushstring( L, temp ); + // c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.netmask) ); + // lua_pushstring( L, temp ); + // c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.gw) ); + // lua_pushstring( L, temp ); + // return 3; + return 1; } +} + +static uint32_t parse_key(lua_State* L, const char * key){ + lua_getfield(L, 1, key); + if( lua_isstring(L, -1) ) // deal with the ssid string + { + const char *ip = luaL_checkstring( L, -1 ); + return ipaddr_addr(ip); + } + lua_pop(L, 1); + return 0; +} + +// Lua: ip = wifi.xx.setip() +static int ICACHE_FLASH_ATTR wifi_setip( lua_State* L, uint8_t mode ) +{ + struct ip_info pTempIp; + wifi_get_ip_info(mode, &pTempIp); + + if (!lua_istable(L, 1)) + return luaL_error( L, "wrong arg type" ); + uint32_t ip = parse_key(L, "ip"); + if(ip!=0) + pTempIp.ip.addr = ip; + + ip = parse_key(L, "netmask"); + if(ip!=0) + pTempIp.netmask.addr = ip; + + ip = parse_key(L, "gateway"); + if(ip!=0) + pTempIp.gw.addr = ip; + + lua_pushboolean(L,wifi_set_ip_info(mode, &pTempIp)); + return 1; +} + +// Lua: realtype = sleeptype(type) +static int ICACHE_FLASH_ATTR wifi_sleeptype( lua_State* L ) +{ + unsigned type; + + if ( lua_isnumber(L, 1) ){ + type = lua_tointeger(L, 1); + if ( type != NONE_SLEEP_T && type != LIGHT_SLEEP_T && type != MODEM_SLEEP_T ) + return luaL_error( L, "wrong arg type" ); + if(!wifi_set_sleep_type(type)){ + lua_pushnil(L); + return 1; + } + } + + type = wifi_get_sleep_type(); + lua_pushinteger( L, type ); return 1; } @@ -179,11 +252,21 @@ static int ICACHE_FLASH_ATTR wifi_station_getmac( lua_State* L ){ return wifi_getmac(L, STATION_IF); } +// Lua: wifi.sta.setmac() +static int ICACHE_FLASH_ATTR wifi_station_setmac( lua_State* L ){ + return wifi_setmac(L, STATION_IF); +} + // Lua: wifi.sta.getip() static int ICACHE_FLASH_ATTR wifi_station_getip( lua_State* L ){ return wifi_getip(L, STATION_IF); } +// Lua: wifi.sta.setip() +static int ICACHE_FLASH_ATTR wifi_station_setip( lua_State* L ){ + return wifi_setip(L, STATION_IF); +} + // Lua: wifi.sta.config(ssid, password) static int ICACHE_FLASH_ATTR wifi_station_config( lua_State* L ) { @@ -281,11 +364,21 @@ static int ICACHE_FLASH_ATTR wifi_ap_getmac( lua_State* L ){ return wifi_getmac(L, SOFTAP_IF); } +// Lua: wifi.ap.setmac() +static int ICACHE_FLASH_ATTR wifi_ap_setmac( lua_State* L ){ + return wifi_setmac(L, SOFTAP_IF); +} + // Lua: wifi.ap.getip() static int ICACHE_FLASH_ATTR wifi_ap_getip( lua_State* L ){ return wifi_getip(L, SOFTAP_IF); } +// Lua: wifi.ap.setip() +static int ICACHE_FLASH_ATTR wifi_ap_setip( lua_State* L ){ + return wifi_setip(L, SOFTAP_IF); +} + // Lua: wifi.ap.config(table) static int ICACHE_FLASH_ATTR wifi_ap_config( lua_State* L ) { @@ -352,7 +445,9 @@ static const LUA_REG_TYPE wifi_station_map[] = { LSTRKEY( "disconnect" ), LFUNCVAL ( wifi_station_disconnect4lua ) }, { LSTRKEY( "autoconnect" ), LFUNCVAL ( wifi_station_setauto ) }, { LSTRKEY( "getip" ), LFUNCVAL ( wifi_station_getip ) }, + { LSTRKEY( "setip" ), LFUNCVAL ( wifi_station_setip ) }, { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_station_getmac ) }, + { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_station_setmac ) }, { LSTRKEY( "getap" ), LFUNCVAL ( wifi_station_listap ) }, { LSTRKEY( "status" ), LFUNCVAL ( wifi_station_status ) }, { LNILKEY, LNILVAL } @@ -362,7 +457,9 @@ static const LUA_REG_TYPE wifi_ap_map[] = { { LSTRKEY( "config" ), LFUNCVAL( wifi_ap_config ) }, { LSTRKEY( "getip" ), LFUNCVAL ( wifi_ap_getip ) }, + { LSTRKEY( "setip" ), LFUNCVAL ( wifi_ap_setip ) }, { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_ap_getmac ) }, + { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_ap_setmac ) }, { LNILKEY, LNILVAL } }; @@ -372,6 +469,7 @@ const LUA_REG_TYPE wifi_map[] = { LSTRKEY( "getmode" ), LFUNCVAL( wifi_getmode ) }, { LSTRKEY( "startsmart" ), LFUNCVAL( wifi_start_smart ) }, { LSTRKEY( "stopsmart" ), LFUNCVAL( wifi_exit_smart ) }, + { LSTRKEY( "sleeptype" ), LFUNCVAL( wifi_sleeptype ) }, #if LUA_OPTIMIZE_MEMORY > 0 { LSTRKEY( "sta" ), LROVAL( wifi_station_map ) }, { LSTRKEY( "ap" ), LROVAL( wifi_ap_map ) }, @@ -381,6 +479,10 @@ const LUA_REG_TYPE wifi_map[] = { LSTRKEY( "SOFTAP" ), LNUMVAL( SOFTAP_MODE ) }, { LSTRKEY( "STATIONAP" ), LNUMVAL( STATIONAP_MODE ) }, + { LSTRKEY( "NONE_SLEEP" ), LNUMVAL( NONE_SLEEP_T ) }, + { LSTRKEY( "LIGHT_SLEEP" ), LNUMVAL( LIGHT_SLEEP_T ) }, + { LSTRKEY( "MODEM_SLEEP" ), LNUMVAL( MODEM_SLEEP_T ) }, + // { LSTRKEY( "STA_IDLE" ), LNUMVAL( STATION_IDLE ) }, // { LSTRKEY( "STA_CONNECTING" ), LNUMVAL( STATION_CONNECTING ) }, // { LSTRKEY( "STA_WRONGPWD" ), LNUMVAL( STATION_WRONG_PASSWORD ) }, @@ -410,6 +512,10 @@ LUALIB_API int ICACHE_FLASH_ATTR luaopen_wifi( lua_State *L ) MOD_REG_NUMBER( L, "SOFTAP", SOFTAP_MODE ); MOD_REG_NUMBER( L, "STATIONAP", STATIONAP_MODE ); + MOD_REG_NUMBER( L, "NONE_SLEEP", NONE_SLEEP_T ); + MOD_REG_NUMBER( L, "LIGHT_SLEEP", LIGHT_SLEEP_T ); + MOD_REG_NUMBER( L, "MODEM_SLEEP", MODEM_SLEEP_T ); + // MOD_REG_NUMBER( L, "STA_IDLE", STATION_IDLE ); // MOD_REG_NUMBER( L, "STA_CONNECTING", STATION_CONNECTING ); // MOD_REG_NUMBER( L, "STA_WRONGPWD", STATION_WRONG_PASSWORD ); diff --git a/examples/fragment.lua b/examples/fragment.lua index 79256373..4acadc8c 100644 --- a/examples/fragment.lua +++ b/examples/fragment.lua @@ -300,4 +300,6 @@ sk=net.createConnection(net.TCP, 0) sk:on("receive", function(sck, c) print(c) e sk:send("GET / HTTP/1.1\r\nHost: 115.239.210.27\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") sk=net.createConnection(net.TCP, 1) sk:on("receive", function(sck, c) print(c) end ) -sk:on("connection", function(sck) sck:send("GET / HTTPS/1.1\r\nHost: www.google.com.hk\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") end ) sk:connect(443,"173.194.72.199") \ No newline at end of file +sk:on("connection", function(sck) sck:send("GET / HTTPS/1.1\r\nHost: www.google.com.hk\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") end ) sk:connect(443,"173.194.72.199") + +wifi.sta.setip({ip="192.168.18.119",netmask="255.255.255.0",gateway="192.168.18.1"}) From 5209c099a0fb1a5718e593921bf3dab50deac5f1 Mon Sep 17 00:00:00 2001 From: funshine Date: Tue, 30 Dec 2014 15:42:24 +0800 Subject: [PATCH 3/4] modify uart.on api to read raw data from uart --- app/driver/readline.c | 13 ++-- app/lua/lua.c | 166 +++++++++++++++++++----------------------- app/modules/uart.c | 41 +++++++++-- examples/fragment.lua | 6 ++ 4 files changed, 121 insertions(+), 105 deletions(-) diff --git a/app/driver/readline.c b/app/driver/readline.c index 78781a06..7d755d5d 100644 --- a/app/driver/readline.c +++ b/app/driver/readline.c @@ -11,15 +11,14 @@ extern UartDevice UartDev; #define uart_putc uart0_putc -char ICACHE_FLASH_ATTR uart_getc(void){ - char c = 0; +bool ICACHE_FLASH_ATTR uart_getc(char *c){ RcvMsgBuff *pRxBuff = &(UartDev.rcv_buff); if(pRxBuff->pWritePos == pRxBuff->pReadPos){ // empty - return 0; + return false; } // ETS_UART_INTR_DISABLE(); ETS_INTR_LOCK(); - c = (char)*(pRxBuff->pReadPos); + *c = (char)*(pRxBuff->pReadPos); if (pRxBuff->pReadPos == (pRxBuff->pRcvMsgBuff + RX_BUFF_SIZE)) { pRxBuff->pReadPos = pRxBuff->pRcvMsgBuff ; } else { @@ -27,7 +26,7 @@ char ICACHE_FLASH_ATTR uart_getc(void){ } // ETS_UART_INTR_ENABLE(); ETS_INTR_UNLOCK(); - return c; + return true; } #if 0 @@ -43,13 +42,13 @@ start: os_memset(buffer, 0, length); while (1) { - while ((ch = uart_getc()) != 0) + while (uart_getc(&ch)) { /* handle CR key */ if (ch == '\r') { char next; - if ((next = uart_getc()) != 0) + if (uart_getc(&next)) ch = next; } /* backspace key */ diff --git a/app/lua/lua.c b/app/lua/lua.c index 24807a08..bd85ff4b 100644 --- a/app/lua/lua.c +++ b/app/lua/lua.c @@ -490,34 +490,6 @@ void ICACHE_FLASH_ATTR dojob(lua_Load *load){ do{ if(load->done == 1){ l = c_strlen(b); -#if 0 - if(log_fd!=-1 && l>0) - { - if(l>=10 && (c_strstr(b,"log.stop()")) ) - { - fs_close(log_fd); - log_fd = -1; - noparse = 0; - NODE_ERR( "log stopping.\n" ); - } - if(log_fd!=-1){ // test again - rs = fs_write(log_fd, b, l); - if(rs!=l){ - fs_close(log_fd); - log_fd = -1; - } else { - rs = fs_write(log_fd, "\r\n", 2); - if(rs!=2){ - fs_close(log_fd); - log_fd = -1; - } - } - } - if(noparse){ - break; - } - } -#endif if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ b[l-1] = '\0'; /* remove it */ if (load->firstline && b[0] == '=') /* first line starts with `=' ? */ @@ -613,86 +585,100 @@ void ICACHE_FLASH_ATTR update_key_led(){ #endif extern bool uart_on_data_cb(const char *buf, size_t len); extern bool uart0_echo; +extern bool run_input; +extern uint16_t need_len; +extern int16_t end_char; void ICACHE_FLASH_ATTR readline(lua_Load *load){ // NODE_DBG("readline() is called.\n"); update_key_led(); char ch; - while ((ch = uart_getc()) != 0) + while (uart_getc(&ch)) { - /* handle CR key */ - if (ch == '\r') + if(run_input) { - char next; - if ((next = uart_getc()) != 0) - ch = next; - } - /* backspace key */ - else if (ch == 0x7f || ch == 0x08) - { - if (load->line_position > 0) + /* handle CR key */ + if (ch == '\r') { - if(uart0_echo) uart_putc(0x08); - if(uart0_echo) uart_putc(' '); - if(uart0_echo) uart_putc(0x08); - load->line_position--; + char next; + if (uart_getc(&next)) + ch = next; } - load->line[load->line_position] = 0; - continue; - } - /* EOF(ctrl+d) */ - else if (ch == 0x04) - { - if (load->line_position == 0) - // No input which makes lua interpreter close - donejob(load); - else + /* backspace key */ + else if (ch == 0x7f || ch == 0x08) + { + if (load->line_position > 0) + { + if(uart0_echo) uart_putc(0x08); + if(uart0_echo) uart_putc(' '); + if(uart0_echo) uart_putc(0x08); + load->line_position--; + } + load->line[load->line_position] = 0; continue; - } - /* end of line */ - if (ch == '\r' || ch == '\n') - { - load->line[load->line_position] = 0; - if(uart0_echo) uart_putc('\n'); - if(uart_on_data_cb(load->line, load->line_position)){ + } + /* EOF(ctrl+d) */ + else if (ch == 0x04) + { + if (load->line_position == 0) + // No input which makes lua interpreter close + donejob(load); + else + continue; + } + + /* end of line */ + if (ch == '\r' || ch == '\n') + { + load->line[load->line_position] = 0; + if(uart0_echo) uart_putc('\n'); + uart_on_data_cb(load->line, load->line_position); + if (load->line_position == 0) + { + /* Get a empty line, then go to get a new line */ + c_puts(load->prmt); + os_timer_disarm(&readline_timer); + os_timer_setfn(&readline_timer, (os_timer_func_t *)readline, load); + os_timer_arm(&readline_timer, READLINE_INTERVAL, 0); // no repeat + } else { + load->done = 1; + os_timer_disarm(&lua_timer); + os_timer_setfn(&lua_timer, (os_timer_func_t *)dojob, load); + os_timer_arm(&lua_timer, READLINE_INTERVAL, 0); // no repeat + } + } + + /* other control character or not an acsii character */ + if (ch < 0x20 || ch >= 0x80) + { + continue; + } + /* echo */ + if(uart0_echo) uart_putc(ch); + + /* it's a large line, discard it */ + if ( load->line_position + 1 >= load->len ){ load->line_position = 0; } - if (load->line_position == 0) - { - /* Get a empty line, then go to get a new line */ - c_puts(load->prmt); - os_timer_disarm(&readline_timer); - os_timer_setfn(&readline_timer, (os_timer_func_t *)readline, load); - os_timer_arm(&readline_timer, READLINE_INTERVAL, 0); // no repeat - } else { - load->done = 1; - os_timer_disarm(&lua_timer); - os_timer_setfn(&lua_timer, (os_timer_func_t *)dojob, load); - os_timer_arm(&lua_timer, READLINE_INTERVAL, 0); // no repeat - } } - /* other control character or not an acsii character */ - if (ch < 0x20 || ch >= 0x80) - { - continue; - } - /* echo */ - if(uart0_echo) uart_putc(ch); + load->line[load->line_position] = ch; - ch = 0; load->line_position++; - /* it's a large line, discard it */ - if (load->line_position >= load->len) - load->line_position = 0; + if(!run_input) + { + if( ((need_len!=0) && (load->line_position >= need_len)) || \ + (load->line_position >= load->len) || \ + ((end_char>=0) && ((unsigned char)ch==(unsigned char)end_char)) ) + { + uart_on_data_cb(load->line, load->line_position); + load->line_position = 0; + } + } + + ch = 0; } // if there is no input from user, repeat readline() os_timer_disarm(&readline_timer); os_timer_setfn(&readline_timer, (os_timer_func_t *)readline, load); os_timer_arm(&readline_timer, READLINE_INTERVAL, 0); // no repeat } - -void ICACHE_FLASH_ATTR dogc(void){ - if(globalL){ - lua_gc(globalL, LUA_GCCOLLECT, 0); - } -} diff --git a/app/modules/uart.c b/app/modules/uart.c index 98d3c5dd..99d811a8 100644 --- a/app/modules/uart.c +++ b/app/modules/uart.c @@ -12,7 +12,7 @@ static lua_State *gL = NULL; static int uart_receive_rf = LUA_NOREF; -static bool run_input = true; +bool run_input = true; bool ICACHE_FLASH_ATTR uart_on_data_cb(const char *buf, size_t len){ if(!buf || len==0) return false; @@ -26,21 +26,46 @@ bool ICACHE_FLASH_ATTR uart_on_data_cb(const char *buf, size_t len){ return !run_input; } +uint16_t need_len = 0; +int16_t end_char = -1; // Lua: uart.on("method", function, [run_input]) static int ICACHE_FLASH_ATTR uart_on( lua_State* L ) { - size_t sl; + size_t sl, el; int32_t run = 1; - const char *method = luaL_checklstring( L, 1, &sl ); + uint8_t stack = 1; + const char *method = luaL_checklstring( L, stack, &sl ); + stack++; if (method == NULL) return luaL_error( L, "wrong arg type" ); - // luaL_checkanyfunction(L, 2); - if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION){ - if ( lua_isnumber(L, 3) ){ - run = lua_tointeger(L, 3); + if( lua_type( L, stack ) == LUA_TNUMBER ) + { + need_len = ( uint16_t )luaL_checkinteger( L, stack ); + stack++; + end_char = -1; + if( need_len > 255 ){ + need_len = 255; + return luaL_error( L, "wrong arg range" ); } - lua_pushvalue(L, 2); // copy argument (func) to the top of stack + } + else if(lua_isstring(L, stack)) + { + const char *end = luaL_checklstring( L, stack, &el ); + stack++; + if(el!=1){ + return luaL_error( L, "wrong arg range" ); + } + end_char = (int16_t)end[0]; + need_len = 0; + } + + // luaL_checkanyfunction(L, stack); + if (lua_type(L, stack) == LUA_TFUNCTION || lua_type(L, stack) == LUA_TLIGHTFUNCTION){ + if ( lua_isnumber(L, stack+1) ){ + run = lua_tointeger(L, stack+1); + } + lua_pushvalue(L, stack); // copy argument (func) to the top of stack } else { lua_pushnil(L); } diff --git a/examples/fragment.lua b/examples/fragment.lua index 4acadc8c..7f02823e 100644 --- a/examples/fragment.lua +++ b/examples/fragment.lua @@ -303,3 +303,9 @@ sk=net.createConnection(net.TCP, 1) sk:on("receive", function(sck, c) print(c) e sk:on("connection", function(sck) sck:send("GET / HTTPS/1.1\r\nHost: www.google.com.hk\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n") end ) sk:connect(443,"173.194.72.199") wifi.sta.setip({ip="192.168.18.119",netmask="255.255.255.0",gateway="192.168.18.1"}) + +uart.on("data","\r",function(input) if input=="quit\r" then uart.on("data") else print(input) end end, 0) +uart.on("data","\n",function(input) if input=="quit\n" then uart.on("data") else print(input) end end, 0) +uart.on("data", 5 ,function(input) if input=="quit\r" then uart.on("data") else print(input) end end, 0) + +uart.on("data","\r",function(input) if input=="quit" then uart.on("data") else print(input) end end, 1) From ee2e79128271616c5c2631c7477260c39b4cb220 Mon Sep 17 00:00:00 2001 From: funshine Date: Tue, 30 Dec 2014 19:00:36 +0800 Subject: [PATCH 4/4] serial input now accept non-ascii chars --- app/lua/lua.c | 27 ++++++++++++++------------- bin/.gitignore | 3 ++- bin/blank.bin | 1 + bin/esp_init_data_default.bin | Bin 0 -> 128 bytes 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 bin/blank.bin create mode 100644 bin/esp_init_data_default.bin diff --git a/app/lua/lua.c b/app/lua/lua.c index bd85ff4b..890e568b 100644 --- a/app/lua/lua.c +++ b/app/lua/lua.c @@ -616,15 +616,15 @@ void ICACHE_FLASH_ATTR readline(lua_Load *load){ load->line[load->line_position] = 0; continue; } - /* EOF(ctrl+d) */ - else if (ch == 0x04) - { - if (load->line_position == 0) - // No input which makes lua interpreter close - donejob(load); - else - continue; - } + /* EOT(ctrl+d) */ + // else if (ch == 0x04) + // { + // if (load->line_position == 0) + // // No input which makes lua interpreter close + // donejob(load); + // else + // continue; + // } /* end of line */ if (ch == '\r' || ch == '\n') @@ -648,10 +648,11 @@ void ICACHE_FLASH_ATTR readline(lua_Load *load){ } /* other control character or not an acsii character */ - if (ch < 0x20 || ch >= 0x80) - { - continue; - } + // if (ch < 0x20 || ch >= 0x80) + // { + // continue; + // } + /* echo */ if(uart0_echo) uart_putc(ch); diff --git a/bin/.gitignore b/bin/.gitignore index 081b0eda..03d17079 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -4,4 +4,5 @@ *.bin *.bin_rep !.gitignore - +!blank.bin +!esp_init_data_default.bin diff --git a/bin/blank.bin b/bin/blank.bin new file mode 100644 index 00000000..7de9e36a --- /dev/null +++ b/bin/blank.bin @@ -0,0 +1 @@ +ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ \ No newline at end of file diff --git a/bin/esp_init_data_default.bin b/bin/esp_init_data_default.bin new file mode 100644 index 0000000000000000000000000000000000000000..2936c7b7b82b893427a92bc204187cb535ad3d66 GIT binary patch literal 128 zcmZQ&U}0iqWo2SzU}0qip?`n>fB5j>!Gi}6x&HtE!SLfpke`=}g9QTvBO?TA literal 0 HcmV?d00001