fix net.socket:send(), fix file.read() when 0xFF reached

This commit is contained in:
funshine 2015-01-08 16:03:21 +08:00
parent b65fb02cc5
commit 971c4b569b
10 changed files with 20 additions and 18 deletions

View File

@ -26,19 +26,18 @@ Tencent QQ group QQ群: 309957875<br />
- add coap module
# Change log
2015-01-08<br />
fix net.socket:send() issue when multi sends are called. <br />
*NOTE*: if data length is bigger than 1460, send next packet AFTER "sent" callback is called.<br />
fix file.read() api, take 0xFF as a regular byte, not EOF.<br />
pre_build/latest/nodemcu_512k_latest.bin is removed. use pre_build/latest/nodemcu_latest.bin instead.
2015-01-07<br />
retrive more ram back.<br />
add api file.format() to rebuild file system.<br />
rename "NodeMcu" to "NodeMCU" in firmware.<br />
add some check for file system op.
2015-01-06<br />
update sdk to 0.9.5.<br />
pre_build bin now compiled by gcc toolchain.<br />
memory/heap usage optimized.<br />
add support for multiple platform and toolchain include eclipse. <br />
combine firmware for 512K, 1M, 2M, 4M flash to one. flash size auto-detected.
[more change log](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#change_log)<br />
[更多变更日志](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_cn#change_log)

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1912993350869412582" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1433312569745558301" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -7,7 +7,7 @@
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 0.9.5"
#define BUILD_DATE "build 20150107"
#define BUILD_DATE "build 20150108"
// #define FLASH_512K
// #define FLASH_1M

View File

@ -272,7 +272,8 @@ espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length)
value = espconn_find_connection(espconn, &pnode);
switch (espconn ->type) {
case ESPCONN_TCP:
if (value && (pnode->pcommon.write_len == pnode->pcommon.write_total)){
// if (value && (pnode->pcommon.write_len == pnode->pcommon.write_total)){
if (value && (pnode->pcommon.cntr == 0)){
espconn_tcp_sent(pnode, psent, length);
}else
return ESPCONN_ARG;

View File

@ -188,7 +188,7 @@ espconn_tcp_sent(void *arg, uint8 *psent, uint16 length)
data_to_send = true;
ptcp_sent->pcommon.ptrbuf = psent + len;
ptcp_sent->pcommon.cntr = length - len;
ptcp_sent->pcommon.write_len = len;
ptcp_sent->pcommon.write_len += len;
espconn_printf("espconn_tcp_sent sending %d bytes, remain %d\n", len, ptcp_sent->pcommon.cntr);
}

View File

@ -159,7 +159,7 @@ static int file_g_read( lua_State* L, int n, int16_t end_char )
n = LUAL_BUFFERSIZE;
if(end_char < 0 || end_char >255)
end_char = EOF;
signed char ec = (signed char)end_char;
int ec = (int)end_char;
luaL_Buffer b;
if((FS_OPEN_OK - 1)==file_fd)
@ -167,15 +167,15 @@ static int file_g_read( lua_State* L, int n, int16_t end_char )
luaL_buffinit(L, &b);
char *p = luaL_prepbuffer(&b);
signed char c = EOF;
int c = EOF;
int i = 0;
do{
c = (signed char)fs_getc(file_fd);
c = fs_getc(file_fd);
if(c==EOF){
break;
}
p[i++] = c;
p[i++] = (char)(0xFF & c);
}while((c!=EOF) && (c!=ec) && (i<n) );
#if 0

View File

@ -133,16 +133,18 @@ int myspiffs_tell( int fd ){
return SPIFFS_tell(&fs, (spiffs_file)fd);
}
int myspiffs_getc( int fd ){
char c = EOF;
unsigned char c = 0xFF;
int res;
if(!myspiffs_eof(fd)){
res = SPIFFS_read(&fs, (spiffs_file)fd, &c, 1);
if (res != 1) {
NODE_DBG("getc errno %i\n", SPIFFS_errno(&fs));
return (int)EOF;
} else {
return (int)c;
}
}
return (int)c;
return (int)EOF;
}
int myspiffs_ungetc( int c, int fd ){
return SPIFFS_lseek(&fs, (spiffs_file)fd, -1, SEEK_CUR);

Binary file not shown.

Binary file not shown.