Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Dec 2017

Most recent activity

  • in Other Boards
    Avatar for Gordon

    @Konkery you don't have an official Espruino board - please don't post in the 'Official Boards' section.

    It exists so I can help people who have purchased boards that actually contribute something to Espruino. I do still look at the other forums, just not as often.

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    I am guessing that I may have corrupted the esp8266 firmware on the EspruinoWiFi board that I purchased.

    Looks like that could be the case... If you did this code:

    digitalWrite(A14,0); // power off
    digitalWrite(A13,0); // boot mode
    digitalWrite(A14,1); // power on
    Serial2.setup(115200, { rx: A3, tx : A2 });
    Serial2.on('data', function(d) { USB.write(d); });
    USB.on('data', function(d) { Serial2.write(d); });
    Serial1.setConsole();
    

    I'd have thought you might be able to reflash it.

    But if you do decide to reflash it externally, try and give it a try without resoldering. You can issue JS commands to boot the ESP8266 into bootloader mode, and can set the RX and TX lines to be open circuit with (digitalRead(A2) and A3).

    The holes in the ESP8266 are small enough that you can actually just push dupont male pins (the standard jumper leads that you get with everything now) right into the holes and they'll stay there enough - all you need to connect is RX and TX (ground should already be handled by USB)

  • in Puck.js
    Avatar for Gordon

    Hi - I haven't got any measured figures, but:

    The connection interval can be negotiated (depending on the PC) between 7.5 and 20ms - and it can send/receive 20 bytes per interval, so that's between 1000-2700 bytes/second. For reliable comms I'd stick a little below that if possible.

    On Espruino's side, newer firmwares will warn you with a FIFO_FULL error message if they believe that they have lost some data (eg. code was busy waiting for a write to complete so didn't have time to process the data that came in)

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Just to add that there is something iffy going on with sockets getting into an invalid state, and that looks like a bug in the ESP8266 interface library for Espruino.

    However, I think that's likely caused by trying to run the 3 sockets concurrently.

    If you try this:

    function getPrices() {
      symbolCtr = symbolCtr+1;
      if (symbolCtr>=symbols.length) symbolCtr=0;
      let symbol = symbols[symbolCtr];
      let url = `${proxy}${api}${symbol}-${currency}`;
      console.log("Opening socket");
      h.get(url, function(res) {      
        let pricesRaw = "";
        res.on('data', function(d) { pricesRaw += d; });
        res.on('close', () => {
          console.log("Socket closed");
          prices[symbol] = JSON.parse(pricesRaw);
          showPrices();
        });
      }); 
    }
    

    every 10 seconds then I bet it'll be a lot more stable.

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Thanks for posting up the code, it's a nice idea! - I just gave it a try.

    What I believe is happening is Unable to create socket happens because you have too many active connections. Espruino via ESP8266 can handle around 4 I believe - but you fire off 3 at the same time.

    While that works normally, if a connection gets slowed down for some reason and isn't closed after 30 seconds, now you're using 4 at once. One more and it'll fail.

    If it's like me, I found that after a while it did start working again?

    function getPrices() {
      symbols.forEach(symbol => {
        let url = `${proxy}${api}${symbol}-${currency}`;
        console.log("Opening socket");
        h.get(url, function(res) {      
          let pricesRaw = "";
          res.on('data', function(d) { pricesRaw += d; });
          res.on('close', () => {
            console.log("Socket closed");
            prices[symbol] = JSON.parse(pricesRaw);
          });
        });
      });
      showPrices();
    }
    

    If you output when a socket opens and when it closes (like above), you'll probably be able to see it happening.

    So... Personally I'd request each of your symbols in turn, after each one has completed - that'll probably make these slightly broken connections far less frequent. You could actually update more often, but could just update each token in turn?

    You could also skip an update if something is already in progress (I believe connections will time out after 60 seconds anyway)

  • in The Place for Patreon Patrons
    Avatar for Gordon

    @AntiCat thanks - yes, the change itself doesn't seem particularly unfair - it's just the act of changing it in such a way that it raised everyone's payments when there really didn't seem to be anyone who wanted the change :(

    That's interesting re. VAT - and thanks for doing the recurring PayPal payment @tom.gidden!

    Frustratingly VAT does still has to be paid even on donations (yay UK!) - so it has to be deducted on my side. While it's annoying that Patreon add it to UK pledges, in that particular case it does make the creator's life a lot easier (unless of course you're a creator that's not VAT registered - which could actually be quite a lot of people).

  • in ESP32
    Avatar for Gordon

    I'm a bit late to this, but:

    How do we get this change for jshGetSystemTime() into the master branch?

    What you did (PR for just that change) was spot on :)

  • in Other Boards
    Avatar for Gordon

    Great! By 'loss of context', you mean you called it in a setTimeout or something?

  • in Puck.js
    Avatar for Gordon

    Ok, thanks - does any other message about disconnection appear that might mean the library is at all aware the connection has dropped out? You can set Puck.debug=3; to help with extra logging info.

  • in Projects
    Avatar for Gordon

    Nice - thanks!

Actions