Avatar for Coder2012

Coder2012

Member since Jan 2015 • Last active Jun 2020
  • 10 conversations
  • 36 comments

Most recent activity

    • 13 comments
    • 442 views
  • in Interfacing
    Avatar for Coder2012

    Ok so I've now tested this using different USB plugs, cables and computers. The result is always the same, after maybe one or two hours. The Espruino WiFi seems to stop executing, and there led that is being used for sleep indicator, starts to flicker quickly and is no longer brightly lit.

    Does this sound like it's trying to sleep?

    I even added a ping back to the raspberry pi to make sure the connection stays alive every 15 seconds.

  • in Pico / Wifi / Original Espruino
    Avatar for Coder2012

    I am trying to update my Espruino Wifi to v106. It was recently updated to v105 without any issues.

    Here's what i've tried:

    1. Put the Espruino Wifi into boot loader mode, the red and green light pulsate in sequence.
    2. Click the flash firmware button.

    Error popup in the web ide says -

    Firmware for this device can't be updated from  the IDE at the moment. 
    

    (I used the above steps to update to v105 last week and it was successful)

    1. Put the Espruino Wifi into boot loader mode, the red and green light pulsate in sequence.
    2. Click flash from file button and locate previously downloaded - espruino_2v06_wifi.bin

    This time I see:

    Connected to COM1 (No response from board)
    Initializing...
    Error Flashing: Can't find STM32 bootloader. Make sure the chip is reset into bootloader mode by holding down BTN1 while pressing RST
    Disconnected from COM1
    
  • in Interfacing
    Avatar for Coder2012

    Oddly after several attempts using reset and save its started working again.

  • in Interfacing
    Avatar for Coder2012

    Ok so now I have this very simple piece of my implementation and i'm still getting this dreaded error:

    New interpreter error: FIFO_FULL
    

    All I'm doing is the following:

    const wifi = require('Wifi');
    const WIFI_NAME = 'BTHub6-3TFX';
    const WIFI_OPTIONS = { password : 'mypassword' };
    
    function onInit() {
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err) => {
        if (err) {
          console.log('Connection error: '+err);
          return;
        }
        console.log('Connected!');
      });
    }
    

    I really don't understand why it just throws this error when I do anything with Wifi now, this was all working the other day.

    Any ideas guys?

  • in Interfacing
    Avatar for Coder2012

    Hey AO good to hear from you. I only call onInit when I'm running in the web IDE.

    I remove this call when I run save(); in the IDE.

    I must admit the various methods of saving and running code on espruino don't make a lot of sense to a regular web developer such as myself. I'll need to do some reading up on this area.

  • in Interfacing
    Avatar for Coder2012

    I'm also unable to update to v106 even though the red and green lights are pulsing as expected.

    Error Flashing: Can't find STM32 bootloader. Make sure the chip is reset into bootloader mode by holding down BTN1 while pressing RST.

    Is there a way I can hard reset on Espruino Wifi? I'm running into a few issues lately.

  • in Interfacing
    Avatar for Coder2012

    So i've read the docs and I do indeed have console logs in my code, so my plan is to remove those, but I've somehow hit another issue. When I try to send code to my board i'm getting the following error.

    New interpreter error: FIFO_FULL
    Connection error: No 'ready' after AT+RST
    

    This is odd as it has been working from the web IDE just fine recently. Here's the source. I have a raspberry pi4 running nodered which reads sensors around the house, some of these send data via MQTT which i'm picking up with the Espruino Wifi.

    const neo = require('neopixel');
    const wifi = require('Wifi');
    const WIFI_NAME = 'BTHub6-3TFX';
    const WIFI_OPTIONS = { password : 'xxxxxxxx' };
    
    let delay = 0;
    let rgb = new Uint8ClampedArray(36);
    
    
    function onInit() {
      setSleepIndicator(LED1);
      const server = '192.168.1.64';
      const options = {
        client_id : 'random',
        keep_alive: 60,         // keep alive time in seconds
        port: 1883,             // port number
        clean_session: true,
        username: 'username',   // default is undefined
        password: 'password',   // default is undefined
        protocol_name: 'MQTT',  // or MQIsdp, etc..
        protocol_level: 4,      // protocol level
      };
      const mqtt = require('MQTT').create(server, options /*optional*/);
    
      mqtt.on('connected', () => {
        console.log('connected to broker');
    
        mqtt.subscribe('doorOpen');
        mqtt.subscribe('doorClosed');
        mqtt.subscribe('heartbeat');
      });
    
      mqtt.on('publish', (pub) => {
        console.log('topic: '+pub.topic);
        console.log('message: '+pub.message);
    
        switch(pub.topic) {
          case 'doorOpen':
            console.log('doorOpen');
            doorOpen();
            break;
    
          case 'doorClosed':
            console.log('doorClosed');
            doorClosed();
            break;
    
          case 'heartbeat':
            if(parseInt(pub.message) > 1) {
              heartbeat();
            }else{
              motion();
            }
            break;
    
          default:
            neo.write(B15, lights({r: 0, g: 0, b: 0}));
            break;
        }
    
      });
    
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err) => {
        if (err) {
          console.log('Connection error: '+err);
          return;
        }
        console.log('Connected!');
        mqtt.connect();
      });
    
      function lights(colors) {
        for (let i = 0; i < rgb.length;) {
          rgb[i++] = colors.g;
          rgb[i++] = colors.r;
          rgb[i++] = colors.b;
        }
        return rgb;
      }
    
      function doorOpen() {
        neo.write(B15, lights({r: 0, g: 0, b: 0}));
        update({r: 255, g: 0, b: 0});
      }
    
      function doorClosed() {
        neo.write(B15, lights({r: 0, g: 0, b: 0}));
        update({r: 0, g: 255, b: 0});
      }
    
      function heartbeat() {
        neo.write(B15, lights({r: 0, g: 0, b: 0}));
        update({r: 0, g: 0, b: 255});
      }
    
      function motion() {
        neo.write(B15, lights({r: 0, g: 0, b: 0}));
        update({r: 0, g: 255, b: 0});
      }
    
      function update(color) {
        neo.write(B15, lights(color));
        delay = setTimeout(() => {
          neo.write(B15, lights({r: 0, g: 0, b: 0}));
        }, 1000);
      }
    }
    
    onInit();
    
  • in Interfacing
    Avatar for Coder2012

    All my code is in an

    onInit() 
    

    My project requires my device to connect to the WiFi. If my device is plugged into USB on my PC it works great and the red led is lit all the time.

    If my device is plugged into a USB wall socket, it begins brightly lit. Then after a while it starts to flash on and off quickly. My code fails to execute it seems.

    The led is set by the setSleepIndicator function call.

    Espruino WiFi v1.05

Actions