Avatar for fanoush

fanoush

Member since Jul 2018 • Last active Oct 2022

Most recent activity

  • in Bangle.js
    Avatar for fanoush

    If I was just on Bangle.js 1 right now I'd totally be behind moving to that, but I'm not sure it quite adds enough to Bangle.js 2 to warrant the time and expense of moving to a new watch.

    I guess @yngv126399 's idea was to replace Bangle 1 with it and keep two watches - one smaller/lighter with less buttons/colors and one possibly larger with full color screen which is not always on like Bangle 1. However it probably doesn't really work that way for you since you need to support bangle 1 for existing customers anyway so that makes it 3 watches. I see it still being listed here https://shop.espruino.com/ble/banglejs so maybe after that one is gone completely? Well, unless two watches sold in parallel is simply too much to handle.

    EDIT: Oh, I see now the big bold sentence "Bangle.js 1 is now discontinued"

  • in Bangle.js
    Avatar for fanoush

    It depends. On Espruino side there are 2 values to tune
    NRF.setConnectionInterval(interval) for connected device - this one is relevant when you are reading value set by NRF.updateServices.
    Connection interval is shortest possible time for any BLE request packet to get response packet. However if you are subscribed to notifications without requesting/reading the value then you may get it without asking but still even in this case value updated by NRF.updateServices will get sent at the beginning of next connection interval

    NRF.setAdvertising(data, options) - options.interval if you are advertising the data without connection. for advertising there is also random 0-10ms extra delay suggested by BLE specs

  • in Interfacing
    Avatar for fanoush

    Also you may do a search for this topic, it is not so simple as higher MTU == better/faster, it also has some shortcomings. Larger packets may be more susceptible to noise => more errors/retries when 2.4GHz radio band is crowded. Also larger packets may not fit well into connection interval (typically there can be more smaller packets sent in same connection interval) so larger MTU may not increase speed and can even make things slower.

    EDIT: good article is https://interrupt.memfault.com/blog/ble-­throughput-primer it gets more interesting near the end

  • in Interfacing
    Avatar for fanoush

    This is a limit to to save memory, it can be tuned here
    https://github.com/espruino/Espruino/blo­b/master/boards/BANGLEJS2.py#L48
    and beware that it also needs tuning next line with matching LD_APP_RAM_BASE otherwise it won't start and just reboot in a loop.
    Note that it may also break other stuff inside Espruino and may need further tuning, even with 130 there were some overflow issues as it was 'too fast'.

    OTOH even 130 is pretty high and you will have this limit anyway so maybe better solution is to handle lower MTU too.

  • in Bangle.js
    Avatar for fanoush

    as for the rssi handler to be called 10 times and compute average I'd do something like

      var rssicnt=0;
      var sum=0;
      NRF.setRSSIHandler((data)=>{
        sum+=data;
        print(rssicnt,"rssi=",data);
        if(++rssicnt > 9) {
          NRF.setRSSIHandler();
          print("avg rssi=",sum/10);
        }
      });
    

    to do this every 5 seconds you just put it into setIterval

    setInterval(()=>{
      var rssicnt=0;
      var sum=0;
      NRF.setRSSIHandler((data)=>{
        sum+=data;
        print(rssicnt,"rssi=",data);
        if(++rssicnt > 9) {
          NRF.setRSSIHandler();print("avg rssi=",sum/10);
        }
      });
    },5000);
    
  • in Bangle.js
    Avatar for fanoush

    no async/await (and it would not help you with correctly timing setRSSIHandler anyway) but there is still easy solution, just read again my post. in javascript/Espruino it is bad idea to write long running loops in C/arduino style. In Espruino you have setTimeout,setInterval,setWatch, promises and events.

  • in Bangle.js
    Avatar for fanoush

    what about counting 10 calls inside handler with help of global variable and doing NRF.setRSSIHandler(); only after that?

    Javascript/espruino is single threaded and event based so until your code ends nothing else runs.
    The exception are hardware interrupts and bluetooth stack is also based on those so the rssi handler may be still called in your code despite your busy loop (not sure) but your code resets it very quickly anyway so it has no chance to run 10 times exactly.

    BTW what is wait(5000); ? There is no such thing in Espruino and it goes against basic principle of javascript

    I'd use setInterval with 5 second delay, set the RSSI handler there every 5 seconds and then do as suggested in first line - unset handler after 10 calls are made

  • in Bangle.js
    Avatar for fanoush

    As for the TK78G it all depends whether custom firmware flashing is possible, this seller/manufacturer
    https://www.alibaba.com/product-detail/T­K78G-Smart-Watch-with-GPS-Smartwatch_160­0344217582.html
    says:
    Customized logo(Min. order 1000 pieces)
    Customized packaging(Min. order 1000 pieces)
    Graphic customization(Min. order 1000 pieces)

    Not sure if "Graphic customization" means they can sign/flash custom firmware binary we would give them, if yes it could be an option.

    And BTW the HR sensor is VC32S - not sure if this is good or bad.

  • in Bangle.js
    Avatar for fanoush

    Nice that it is working for you again :-)

    However it looks that with some bad luck the watchdog reboot caused by holding the button may break stuff. In this case I guess the reboot was triggered in the middle of flash write and for some reason the check at boot time did not detect this corruption and yet some other code later crashed on such bad data. If that happens again it would be good to have backup of SPI flash storage to reproduce and fix this crash (or maybe it was never ending loop).

    BTW, the watchdog reboot can be delayed a bit by enabling watchdog interrupt but I am not sure that the code handling the interrupt could do something about the pending flash write to avoid such corruption.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for fanoush

    isn't it part of the NRF52832 soc?

    Yes but typically you also need antenna and some tuning capacitors for it to work so that might have been removed to save cost.

    For more details see https://infocenter.nordicsemi.com/pdf/nw­p_026.pdf however it is said that few rings of thin copper wire without any capacitors might be sometimes good enough too. Which reminds me that I must finally try it.

Actions