-
No, the connection might be dropped... Can I detect a connection drop with a callback or something?
Edit:
We have another RTFM situation here: http://www.espruino.com/Reference#l_Wifi_disconnected
Edit2
That event (
Wifi.on('disconnected', ...)
) is not working for me. -
Hi,
I'm using
net.connect
to send and receive raw data to/from server. Client (esp8266) gets data, creates a response and sends to server. Then server asks another thing.This works as intended till a point, then esp8266 gets a data from server (a stringified JSON), prepares response, then stucks. Here is the last status of
clientSocket
that is created vianet.connect
:={ "type": 0, "#onconnect": function (e) { ... }, "opt": { "host": "aktos.io", "port": 1235 }, "sckt": 54, "conn": true, "dSnd": "{\"status\":{\"coinI" ... "cd1234\"},\"hb\":0}}", "#ondata": function (n) { ... }, "#onend": function () { ... }, "dRcv": undefined }
the
dSnd
isnt empty. Is that the root of the problem? Should I flush it? -
Can we manually handle resetting watchdog instead of Espruino's main loop?
I want to reset the watchdog manually in order to trigger some action that can only be performed upon boot process.
My application may response and give control to Espruino's main loop, but that is not sufficient for my purpose. Instead, it should be reset via a data from a socket connection.
-
-
I found SDK 1.5.0 and liblwip_536_for_ESP8266_NONOS_SDK_V1.5.0.zip, downloaded them, extracted lwip_....zip and copied the
liblwip_536.a
file into[SDK-1.5.0]/lib
folder. It seems everything went OK. Result binaries are here, FYI -
FYI: I moved these builds to a new repo: https://github.com/aktos-io/aktos-espruino-builds
-
Well, I found the problem. I just forgot to rename new build folder after
git pull
. Nowprocess.env.GIT_COMMIT="498b9d4cc0f1fc5e0886c19a3b84ce64279aaf85"
and everything works great.The reason I build on my own is because both being able to do so, and keep up with your latest fixes :) Nothing related with a hack or something.
-
-
-
Hi,
I see a v1.86 entry in the changelog but there is nothing listed in
git tag | grep 86
. Why is that? Where is v1.86? -
Here you are:
>f = new (require("FlashEEPROM"))(0x076000); ={ "flash": function () { [native code] }, "addr": 483328, "endAddr": 487424 } >f.read(1) =undefined >f.write(1, "hello") WARNING: If specifying an object, it must be of the form {data : ..., count : N} WARNING: If specifying an object, it must be of the form {data : ..., count : N} Uncaught Error: Function "set" not found! at line 1 col 123 ...int8Array(r.length+3&-4);a.set(r),r=a}return r.length&&this.... ^ in function "_write" called from line 1 col 289 ...ory!";this._write(r.end,t,e)} ^ in function "write" called from line 1 col 19 f.write(1, "hello") ^ >
As you might not see my edit in the previous post, the situation is the same with
git checkout tags/RELEASE_1V85
Edit
Same with current
git pull
-
A working code now outputs an error:
flushing to eeprom... WARNING: If specifying an object, it must be of the form {data : ..., count : N} WARNING: If specifying an object, it must be of the form {data : ..., count : N} Uncaught Error: Function "set" not found! at line 1 col 123 ...int8Array(r.length+3&-4);a.set(r),r=a}return r.length&&this.... ^ in function "_write" called from line 1 col 289 ...ory!";this._write(r.end,t,e)} ^ in function "write" called from line 1 col 96 ...f.write(this.fileNo,pack(t)),this.ram=t ^ in function "write" called from line 1 col 57 console.log("flushing to eeprom..."),this.write(this.ram) ^ in function "flush" called from line 1 col 515 ...atus: ",cfg.ram),cfg.flush() ^ in function "logFileInit" called from line 1 col 13 logFileInit(),limitFilter(),setupIo(),sleep(1e3,function(){r... ^ in function called from system
I built Espruino by myself from commit 3d4047bf4fe5ab52f7b583257e41eae24a7fc947.
EDIT
Situation is the same with
git checkout tags/RELEASE_1V85
-
You mean this one and the lwip link points to here. I unzipped the archieve and moved
liblwip_536.a
to${ESP8266_SDK_ROOT}/lib/
. Now we progressed and new error is this:cp: cannot stat ‘/home/ceremcem/embedded/esp-espressif-sdk/ESP8266_NONOS_SDK_V1.5.3_16_04_18/ESP8266_NONOS_SDK/bin/boot_v1.4(b1).bin’: No such file or directory
I simply created a symlink to
bin/boot_v1.5.bin
, so the result is:./run-make Generating pin info Generating platform configs Generating JS wrappers Generating pin info WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_serial.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/network/esp8266/jswrap_esp8266_network.c targets/esp8266/jswrap_esp8266.c targets/esp8266/jswrap_nodemcu.c libs/network/telnet/jswrap_telnet.c libs/crypto/jswrap_crypto.c DEFINES = -DGIT_COMMIT=3d4047bf4fe5ab52f7b583257e41eae24a7fc947 -DBUILDNUMBER="131" -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DUSE_ESP8266 -DUSE_TELNET -DUSE_CRYPTO -DUSE_OPTIMIZE_PRINTF -D__ETS__ -DICACHE_FLASH -DXTENSA -DUSE_US_TIMER -DEMBEDDED -DESP8266 CC src/jslex.o CC src/jsvar.o CC src/jsvariterator.o CC src/jsutils.o CC src/jsnative.o CC src/jsparse.o CC src/jspin.o CC src/jsinteractive.o CC src/jsdevices.o CC src/jstimer.o CC src/jsspi.o CC gen/jswrapper.o CC libs/compression/heatshrink/heatshrink_encoder.o CC libs/compression/heatshrink/heatshrink_decoder.o CC libs/compression/compress_heatshrink.o CC libs/graphics/bitmap_font_4x6.o CC libs/graphics/graphics.o CC libs/graphics/lcd_arraybuffer.o CC libs/graphics/lcd_js.o CC libs/network/network.o CC libs/network/socketserver.o CC libs/network/socketerrors.o CC libs/network/js/network_js.o CC libs/network/esp8266/network_esp8266.o CC libs/network/esp8266/pktbuf.o CC libs/network/esp8266/ota.o CC libs/crypto/mbedtls/library/sha1.o CC libs/crypto/mbedtls/library/sha256.o CC libs/crypto/mbedtls/library/sha512.o CC /home/ceremcem/embedded/Espruino/gen/jspininfo.o CC src/jswrap_array.o CC src/jswrap_arraybuffer.o CC src/jswrap_date.o CC src/jswrap_error.o CC src/jswrap_espruino.o CC src/jswrap_flash.o CC src/jswrap_functions.o CC src/jswrap_interactive.o CC src/jswrap_io.o CC src/jswrap_json.o CC src/jswrap_modules.o CC src/jswrap_pin.o CC src/jswrap_number.o CC src/jswrap_object.o CC src/jswrap_onewire.o CC src/jswrap_pipe.o CC src/jswrap_process.o CC src/jswrap_promise.o CC src/jswrap_serial.o CC src/jswrap_spi_i2c.o CC src/jswrap_stream.o CC src/jswrap_string.o CC src/jswrap_waveform.o CC libs/math/jswrap_math.o CC libs/graphics/jswrap_graphics.o CC libs/network/jswrap_net.o CC libs/network/http/jswrap_http.o CC libs/network/js/jswrap_jsnetwork.o CC libs/network/esp8266/jswrap_esp8266_network.o CC targets/esp8266/jswrap_esp8266.o CC targets/esp8266/jswrap_nodemcu.o CC libs/network/telnet/jswrap_telnet.o CC libs/crypto/jswrap_crypto.o CC targets/esp8266/uart.o CC targets/esp8266/spi.o CC targets/esp8266/user_main.o CC targets/esp8266/log.o CC targets/esp8266/jshardware.o CC targets/esp8266/i2c_master.o CC targets/esp8266/esp8266_board_utils.o CC targets/esp8266/gdbstub.o LD espruino_esp8266_partial.o LD espruino_esp8266_user1.elf LD espruino_esp8266_user2.elf To disassemble: xtensa-lx106-elf-objdump -d -l -x espruino_esp8266_user2.elf Sections: Idx Name Size VMA LMA File off Algn 3 .text 00006a70 40100000 40100000 00002f20 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 4 .irom0.text 0006b074 40201010 40201010 00009990 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE To disassemble: xtensa-lx106-elf-objdump -d -l -x espruino_esp8266_user1.elf 4 -rwxr-xr-x 1 ceremcem ceremcem 2204 May 13 15:10 eagle.app.v6.data.bin 432 -rwxr-xr-x 1 ceremcem ceremcem 438388 May 13 15:10 eagle.app.v6.irom0text.bin 12 -rwxr-xr-x 1 ceremcem ceremcem 9632 May 13 15:10 eagle.app.v6.rodata.bin 28 -rwxr-xr-x 1 ceremcem ceremcem 27248 May 13 15:10 eagle.app.v6.text.bin ** user1.bin uses 477540 bytes of 491520 available
-
-
Hi,
I'm trying to get the latest build of Espruino but I'm not able to build from source.
As README says, I built
esp-open-sdk
without errors. I also cloned espressif-sdk from https://github.com/espressif/ESP8266_RTOS_SDK as stated here. As far as I could understand, there is no need to build espressif's SDK.Then I used following script to call
make
:#! /bin/bash R=/home/ceremcem/embedded export ESP8266_BOARD=1 [#export](http://forum.espruino.com/search/?q=%23export) FLASH_4MB=1 export ESP8266_SDK_ROOT=${R}/ESP8266_RTOS_SDK export PATH=$PATH:${R}/esp-open-sdk/xtensa-lx106-elf/bin/ export COMPORT=/dev/ttyUSB0 make $*
No success:
$ ./run-make CC targets/esp8266/user_main.o targets/esp8266/user_main.c:17:28: fatal error: user_interface.h: No such file or directory [#include](http://forum.espruino.com/search/?q=%23include) <user_interface.h> ^ compilation terminated. Makefile:1705: recipe for target 'targets/esp8266/user_main.o' failed make: *** [targets/esp8266/user_main.o] Error 1
-
-
OK, I've succeded with the following code:
connect-to-server = !-> csock = null connect-to = (server) -> console.log "trying to connect to the server...", server csock := net.connect server, (socket) !-> console.log "client connected. " socket.on \data, (data) !-> do-something! socket.on \end, !-> console.log "client disconnected..." connect-to first-server <- sleep 10_000ms if csock.sckt is void console.log "timed out, trying default server..." connect-to default-server else console.log "Connected to the first server correctly, not trying default..."
...Javascript:
var connectToServer; connectToServer = function(){ var csock, connectTo; csock = null; connectTo = function(server){ console.log("trying to connect to the server...", server); return csock = net.connect(server, function(socket){ console.log("client connected. "); socket.on('data', function(data){ doSomething(); }); socket.on('end', function(){ console.log("client disconnected..."); }); }); }; connectTo(firstServer); sleep(10000, function(){ if (csock.sckt === void 8) { console.log("timed out, trying default server..."); return connectTo(defaultServer); } else { return console.log("Connected to the first server correctly, not trying default..."); } }); };
-
Hi,
I found this conversation but I didn't find my answer in the replies.
When I try to connect to a valid server, my application works as expected and exchanges data. If I try to connect to an invalid server, for example
net.connect({host: "hello", port: 123}, function () {....
, then it hangs while trying to connect.How can I implement a timeout or something in order to fall back to a default server?
-
-
Here is the output after 30 power cycles:
Loading 7981 bytes from flash... Running onInit()... 299 { "free": 468, "usage": 932, "total": 1400, "history": 1 } ERROR: Out of Memory! WARNING: Truncating string as not enough memory Execution Interrupted during event processing. at line 1 col 127 ...[0]]=this.flash.read(t,r+4)),r+=t+7&-4,a=this.flash.read(4,r... ^ in function "readAll" called from line 1 col 24 var t,e,r=this.readAll();this.flash.erasePage(this.addr),t=t... ^ in function "cleanup" called from line 1 col 208 ...dAddr&&(r.end=this.cleanup(),r.end+e.length+4>=this.endAddr)... ^ in function "write" called from line 1 col 96 ...f.write(this.fileNo,pack(e)),sleep(3,function(){return Confi... ^ in function "write" called from line 1 col 83 ...return inpCounter.write(++n),n}catch(o){return e=o,console.l... ^ in function "incInput" called from line 1 col 22 console.log(incInput(),process.memory()),sleep(5,function(){... ^ in function "n" called from line 1 col 4 n(e) ^ in function called from system ESSID: aea ESSID: aktos-elektronik ESSID: Enopan trying to connect to wifi... {
The
Out of memory
error is thrown right afteronInit()
runs. How could it be possible?Edit
Program is not starting at all afterwards. Giving the following error:
Loading 7981 bytes from flash... Running onInit()... ERROR: Out of Memory! WARNING: Truncating string as not enough memory Execution Interrupted during event processing. at line 1 col 127 ...[0]]=this.flash.read(t,r+4)),r+=t+7&-4,a=this.flash.read(4,r... ^ in function "readAll" called from line 1 col 24 var t,e,r=this.readAll();this.flash.erasePage(this.addr),t=t... ^ in function "cleanup" called from line 1 col 208 ...dAddr&&(r.end=this.cleanup(),r.end+e.length+4>=this.endAddr)... ^ in function "write" called from line 1 col 96 ...f.write(this.fileNo,pack(e)),sleep(3,function(){return Confi... ^ in function "write" called from line 1 col 83 ...return inpCounter.write(++n),n}catch(o){return e=o,console.l... ^ in function "incInput" called from line 1 col 22 console.log(incInput(),process.memory()),sleep(5,function(){... ^ in function called from line 1 col 110 ...return n(e)})}(function(){}) ^ in function "sim2" called from line 1 col 44 ...mitFilter(),setupIo(),sim2(),sleep(1e3,function(){return con... ^ in function called from system WARNING: Truncating string as not enough memory Execution Interrupted during event processing. at line 1 col 127 ...[0]]=this.flash.read(t,r+4)),r+=t+7&-4,a=this.flash.read(4,r... ^ in function "readAll" called from line 1 col 24 var t,e,r=this.readAll();this.flash.erasePage(this.addr),t=t... ^ in function "cleanup" called from line 1 col 208 ...dAddr&&(r.end=this.cleanup(),r.end+e.length+4>=this.endAddr)... ^ in function "write" called from line 1 col 37 Config.f.write(this.raidFile,pack(e)) ^ in function called from system
-
@DrAzzy After refactoring my classes (used
prototype
s instead), memory usage is decreased dramatically:41 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 42 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 43 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 44 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 45 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 46 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 47 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 48 { "free": 579, "usage": 821, "total": 1400, "history": 3 } 49 { "free": 579, "usage": 821, "total": 1400, "history":
Edit
...but this didn't entirely help solving the problem. I cycled the power supply many times. Most of the time it read from FlashEEPROM as expected (correctly), but at 10th time or so, here is the result:
Loading 7991 bytes from flash... Running onInit()... WARNING: Expecting a number or something iterable, got undefined WARNING: Expecting a number or something iterable, got undefined Error on unpacking: null wire data: ERROR CONFIG READ: Error on unpacking raw data read: dump: 1 WARNING: Expecting a number or something iterable, got undefined WARNING: Expecting a number or something iterable, got undefined Error on unpacking: null wire data: ERROR CONFIG READ: Error on unpacking raw data read: dump: 2 WARNING: Expecting a number or something iterable, got undefined WARNING: Expecting a number or something iterable, got undefined Error on unpacking: null wire data: ERROR CONFIG READ: Error on unpacking raw data read: dump: 2 error reading input counter: null ....
-
Well, I removed my variables (class instances) one by one, and available memory is increased to 836 bytes. Absolutely these classes are needed, but clearly they consume a lot of memory. Would this be my solution?
-
I reconnected the ESP8266 in order to add
process.memory()
in the loop and saw that it had been working for hours (11.25597 hours for now). I addedprocess.memory()
anyway:810428 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810429 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810430 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810431 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810432 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810433 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810434 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810435 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810436 { "free": 122, "usage": 1278, "total": 1400, "history": 1 } 810437 { "free": 122, "usage": 1278, "total": 1400, "history": 1 }
-
Hi,
The following function is not printing
Wifi disconnected!
when wifi connection is dropped (I am manually turning off the AP on my cell phone):What is wrong here?