You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • This function breaks with the new build (either using your 1800jsvar build, or my 3250 jsvar build):

    function getfargostatus() {
    	var fargost="";
    	require("http").get(fargosturl, function(res) {
    		res.on('data',function (data) {fargost+=data;});
          res.on('close',function() {var tfs=JSON.parse(fargost); vtfs=tfs; for (var i=0;i<8;i++) { fargo[i]=tfs.relaystate[i].state;} if(menustate==3){uplcd();}});
    	});
    }
    
    Uncaught SyntaxError: Got '{' expected '}'
     at line 1 col 20
    {var b=JSON.parse(a);vtfs=b;for(var c=0;8>c;c++)fargo[c]=b.r...
                        ^
    > 
    

    This worked in v65 bigram, and the error message makes no sense to me.

    My BMP180 is returning bogus values - It says the pressure is -28347 Pa?
    Maybe this is a result of the 32-bit int change?

    (BMP180 module code that might be relevant is reproduced here for convenience):

    BMP085.prototype.getPressure = function(callback) {
      var bmp = this;
      this.readRawTemperature(function(UT) {
        bmp.readRawPressure(function(UP) {
          // Temperature compensation
          var X1 = Math.round((UT - bmp.ac6) * bmp.ac5 / 32768);
          var X2 = Math.round((bmp.mc * 2048) / (X1 + bmp.md));
          var B5 = X1 + X2;
          var compt = (B5 + 8) / 160;
          // Pressure calculation
          var B6 = B5 - 4000;
          X1 = (bmp.b2 * (B6 * B6 >> 12)) >> 11;
          X2 = bmp.ac2 * B6 >> 11;
          var X3 = X1 + X2;
          var B3 = (((bmp.ac1 * 4 + X3) << bmp.oss) + 2) >> 2;
          X1 = bmp.ac3 * B6 >> 13;
          X2 = (bmp.b1 * (B6 * B6 >> 12)) >> 16;
          X3 = ((X1 + X2) + 2) >> 2;
          var B4 = (bmp.ac4 * (X3 + 32768)) >> 15;
          var B7 = (UP - B3) * (50000 >> bmp.oss);
          var p = Math.round(B7 < 0x80000000 ? (B7 << 1) / B4 : (B7 / B4) << 1);
    
          X1 = (p >> 8) * (p >> 8);
          X1 = (X1 * 3038) >> 16;
          X2 = (-7357 * p) >> 16;
          var compp = p + ((X1 + X2 + 3791) >> 4);
          callback({pressure: compp, temperature: compt});
        });
      });
    };
    
    BMP085.prototype.readRawPressure = function(convert) {
      this.i2c.writeTo(0x77, [0xF4, (0x34 + (this.oss << 6))]);
      var delay;
      var bmp = this;
      switch(this.oss) {
        case 0:
          delay = 5;
          break;
        case 1:
          delay = 8;
          break;
        case 2:
          delay = 14;
          break;
        case 3:
          delay = 26;
          break;
      }
      setTimeout(function() {
        var msb = bmp.read8(0xF6);
        var lsb = bmp.read8(0xF7);
        var xlsb = bmp.read8(0xF8);
        convert(((msb << 16) + (lsb << 8) + xlsb) >> (8 - bmp.oss));
      }, delay);
    };
    
    

    Numbers going into that:

    "ac1":7972,"ac2":-1182,"ac3":-14539,"ac4­":33201,"ac5":25505,"ac6":18922,"b1":651­5,"b2":47,"mb":-32768,"mc":-11786,"md":2­512

    bmp.read8(0xF6);
    =161
    bmp.read8(0xF7);
    =122
    bmp.read8(0xF8);
    =96

    As an aside, the loss in efficiency of storing strings - does that apply to function code too? I say this because code is what takes up most of the space (that's been my experience, and iirc, Sascha indicated that was the

About

Avatar for DrAzzy @DrAzzy started