Avatar for arthurj

arthurj

Member since Mar 2014 • Last active May 2014
  • 2 conversations
  • 7 comments

Most recent activity

    • 7 comments
    • 3,301 views
  • in JavaScript
    Avatar for arthurj

    I think that this must be an inconsistency in Espruino

    a = "1"
    ="1"
    a++
    ="1"
    a++
    ="11"
    a++
    ="111"
    a = "s"
    ="s"
    a++
    ="s"
    a++
    ="s1"
    a++
    ="s11"
    a++
    ="s111"

    I would have expected (and comfirmed using javascript console in chrome) that if the string were a number it would return 1 , 2, 3 otherwise it would return NaN rather than concatenate 1 on the end.

    Is this a bug?

  • in General
    Avatar for arthurj

    I have tried the DS18B20 example code which since the setInterval fix (1v59) has worked faultlessly:-

    var ow = new OneWire(A1);
    var sensor = require("DS18B20").connect(ow);
    setInterval(function() {
      console.log(sensor.getTemp());
    }, 1000);
    
    However it now breaks after a couple of minutes with the following:-
    
    ERROR: Out of Memory!
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    ERROR: Out of Memory!
    at line 1 col 188
    {var a=[];this.bus.reset();this.bus.select(th­is.sCode);b&&(this.bus.write(68,!0),this­.bus.reset(),this.bus.select(this.sCode)­);this.bus.write(190);for(b=0;9>b;b++)a.­push(this.bus.read());return a}
                                                                                                                                                                                                ^
    in function "_readSpad" called from line 1 col 78
    in function "getTemp" called from line 2 col 30
    undefined
    in function called from system
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    
  • in Tutorials
    Avatar for arthurj

    Problem solved. I had first compiled espruino to run on Linux.
    I then tried to compile for the espruino hardware. I have found that I need to give make the -B switch to recompile everything and then it works. I now get -

    GEN espruino_1v60_espruino_1r3.bin
    bash scripts/check_size.sh espruino_1v60_espruino_1r3.bin
    FAIL - size of 225996 is over 215040 bytes
    make: *** [espruino_1v60_espruino_1r3.bin] Error 1

    I guess I need to change some configuration files. I assumed espruino would have been the default.

    Also is it possible to program the espruino from the web IDE using a .bin file from the local file system?

  • in Tutorials
    Avatar for arthurj

    I am trying to compile the espruino source. Everything works fine under linux.
    However when I compile for the espruino board I get the following messages and compilation fails. I am using the latest version of codebench arm-2013.11-24-arm-none-eabi.
    Any ideas where I am going wrong?

    arthur@SZ71:~/Espruino$ ESPRUINO_1V3=1 make
    CC libs/fat_sd/spi_diskio.o
    CC libs/math/atanh.o
    CC libs/math/cbrt.o
    libs/math/cbrt.c:46:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double CBRT2  = 1.2599210498948731647672;
     ^
    libs/math/cbrt.c:47:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double CBRT4  = 1.5874010519681994747517;
     ^
    libs/math/cbrt.c:48:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double CBRT2I = 0.79370052598409973737585;
     ^
    libs/math/cbrt.c:49:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double CBRT4I = 0.62996052494743658238361;
     ^
    libs/math/atanh.c:46:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double P[] = {
     ^
    In file included from libs/fat_sd/spi_diskio.c:38:0:
    /home/arthur/Espruino/src/jshardware.h:2­53:38: error: unknown type name 'uint16_t'
     void jshSPIPush(IOEventFlags device, uint16_t data);
                                          ^
    libs/fat_sd/spi_diskio.c: In function 'stm32_spi_rw':
    libs/math/atanh.c:53:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     const static double Q[] = {
     ^
    libs/math/atanh.c: In function 'atanh':
    libs/fat_sd/spi_diskio.c:100:24: error: 'SD_SPI' undeclared (first use in this function)
         int b = jshSPISend(SD_SPI, (unsigned char)out);
                            ^
    libs/fat_sd/spi_diskio.c:100:24: note: each undeclared identifier is reported only once for each function it appears in
    libs/fat_sd/spi_diskio.c: In function 'release_spi':
    libs/fat_sd/spi_diskio.c:70:38: error: 'SD_CS_PIN' undeclared (first use in this function)
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) DESELECT()      jshPinOutput(SD_CS_PIN, 1)      /* MMC CS = H */
                                          ^
    libs/fat_sd/spi_diskio.c:154:2: note: in expansion of macro 'DESELECT'
      DESELECT();
      ^
    libs/fat_sd/spi_diskio.c: In function 'power_on':
    libs/fat_sd/spi_diskio.c:70:38: error: 'SD_CS_PIN' undeclared (first use in this function)
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) DESELECT()      jshPinOutput(SD_CS_PIN, 1)      /* MMC CS = H */
                                          ^
    libs/fat_sd/spi_diskio.c:168:2: note: in expansion of macro 'DESELECT'
      DESELECT();
      ^
    libs/math/atanh.c:151:2: warning: passing argument 2 of 'polevl' discards 'const' qualifier from pointer target type [enabled by default]
      s = x   +  x * z * (polevl(z, P, 4) / p1evl(z, Q, 5));
      ^
    libs/math/atanh.c:118:15: note: expected 'void *' but argument is of type 'const double *'
     extern double polevl ( double x, void *P, int N );
                   ^
    libs/math/atanh.c:151:2: warning: passing argument 2 of 'p1evl' discards 'const' qualifier from pointer target type [enabled by default]
      s = x   +  x * z * (polevl(z, P, 4) / p1evl(z, Q, 5));
      ^
    libs/math/atanh.c:119:15: note: expected 'void *' but argument is of type 'const double *'
     extern double p1evl ( double x, void *P, int N );
                   ^
    libs/fat_sd/spi_diskio.c:173:16: error: 'SD_DO_PIN' undeclared (first use in this function)
      inf.pinMISO = SD_DO_PIN;
                    ^
    libs/fat_sd/spi_diskio.c:174:16: error: 'SD_DI_PIN' undeclared (first use in this function)
      inf.pinMOSI = SD_DI_PIN;
                    ^
    libs/fat_sd/spi_diskio.c:175:15: error: 'SD_CLK_PIN' undeclared (first use in this function)
      inf.pinSCK = SD_CLK_PIN;
                   ^
    libs/fat_sd/spi_diskio.c:177:14: error: 'SD_SPI' undeclared (first use in this function)
      jshSPISetup(SD_SPI, &inf);
                  ^
    libs/fat_sd/spi_diskio.c: In function 'power_off':
    libs/fat_sd/spi_diskio.c:69:38: error: 'SD_CS_PIN' undeclared (first use in this function)
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) SELECT()        jshPinOutput(SD_CS_PIN, 0)    /* MMC CS = L */
                                          ^
    libs/fat_sd/spi_diskio.c:184:3: note: in expansion of macro 'SELECT'
       SELECT();
       ^
    libs/fat_sd/spi_diskio.c:192:14: error: 'SD_DO_PIN' undeclared (first use in this function)
      jshPinInput(SD_DO_PIN);
                  ^
    libs/fat_sd/spi_diskio.c:193:14: error: 'SD_DI_PIN' undeclared (first use in this function)
      jshPinInput(SD_DI_PIN);
                  ^
    libs/fat_sd/spi_diskio.c:194:14: error: 'SD_CLK_PIN' undeclared (first use in this function)
      jshPinInput(SD_CLK_PIN);
                  ^
    libs/fat_sd/spi_diskio.c: In function 'send_cmd':
    libs/fat_sd/spi_diskio.c:70:38: error: 'SD_CS_PIN' undeclared (first use in this function)
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) DESELECT()      jshPinOutput(SD_CS_PIN, 1)      /* MMC CS = H */
                                          ^
    libs/fat_sd/spi_diskio.c:292:2: note: in expansion of macro 'DESELECT'
      DESELECT();
      ^
    libs/fat_sd/spi_diskio.c: In function 'disk_initialize':
    libs/fat_sd/spi_diskio.c:373:8: warning: conversion to 'DSTATUS' from 'int' may alter its value [-Wconversion]
       Stat &= ~STA_NOINIT;  /* Clear STA_NOINIT */
            ^
    libs/fat_sd/spi_diskio.c: In function 'disk_ioctl':
    libs/fat_sd/spi_diskio.c:69:38: error: 'SD_CS_PIN' undeclared (first use in this function)
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) SELECT()        jshPinOutput(SD_CS_PIN, 0)    /* MMC CS = L */
                                          ^
    libs/fat_sd/spi_diskio.c:526:4: note: in expansion of macro 'SELECT'
        SELECT();
        ^
    libs/fat_sd/spi_diskio.c:534:43: warning: conversion to 'WORD' from 'int' may alter its value [-Wconversion]
          csize = csd[9] + ((WORD)csd[8] << 8) + 1;
                                               ^
    libs/fat_sd/spi_diskio.c:537:71: warning: conversion to 'BYTE' from 'int' may alter its value [-Wconversion]
          n = (csd[5] & 15) + ((csd[10] & 128) >> 7) + ((csd[9] & 3) << 1) + 2;
                                                                           ^
    libs/fat_sd/spi_diskio.c:538:79: warning: conversion to 'WORD' from 'int' may alter its value [-Wconversion]
          csize = (csd[8] >> 6) + ((WORD)csd[7] << 2) + ((WORD)(csd[6] & 3) << 10) + 1;
                                                                                   ^
    libs/fat_sd/spi_diskio.c:563:82: warning: conversion to 'DWORD' from 'int' may change the sign of the result [-Wsign-conversion]
           *(DWORD*)buff = (((csd[10] & 63) << 1) + ((WORD)(csd[11] & 128) >> 7) + 1) << ((csd[13] >> 6) - 1);
                                                                                      ^
    libs/fat_sd/spi_diskio.c:565:58: warning: conversion to 'DWORD' from 'int' may change the sign of the result [-Wsign-conversion]
           *(DWORD*)buff = ((WORD)((csd[10] & 124) >> 2) + 1) * (((csd[11] & 3) << 3) + ((csd[11] & 224) >> 5) + 1);
                                                              ^
    make: *** [libs/fat_sd/spi_diskio.o] Error 1
    make: *** Waiting for unfinished jobs....
    
    • 6 comments
    • 3,381 views
  • in JavaScript
    Avatar for arthurj

    I have been running 1v59 commit_date/2014-03-25 13:14:38 for over 15 hours now and it is still working OK!

  • in JavaScript
    Avatar for arthurj

    getTime() does not return the correct result. It is incrementing far too fast, about 2500 per second. By the way, do you understand why it returns a value to 14 decimal places?

  • in JavaScript
    Avatar for arthurj

    I am having a lot of problems with setInterval. Even using the simple tutorial example of flashing a LED. If left unattended it works for perhaps two hours and then breaks with the LED constantly on. I have also tried it using digitalWrite to a pin and when it goes wrong the pin is being pulsed at a much higher rate than was set. Further calls to changeInterval have no effect, a reset is required. I have tried this on the two Espruino boards I have with the same results. I am observing this using firmware 1v58. Is this linked to the problems currently being seen for setTimeout and getTime? Any ideas?

    Arthur

Actions