Avatar for DanDyse

DanDyse

Member since Nov 2021 • Last active May 2024
  • 11 conversations
  • 63 comments

Most recent activity

    • 7 comments
    • 256 views
  • in JavaScript
    Avatar for DanDyse

    Thank you again, I think I finally understand it – important note indeed!

  • in JavaScript
    Avatar for DanDyse

    Thank you Gordon. I have the following code:

    function Timer() {
      [... some more code ...]
      setTimeout(Timer, 60000);
      E.kickWatchdog();
    }
    
    E.enableWatchdog(10, false);
    setTimeout(Timer, 60000);
    

    This is supposed to run some code once per minute.
    But the dog seems to never let it happen this way ... do I need to set the watchdog's timeout higher than my code timeout? The timeout function is not considered "idle" by the watchdog so I need to add this to the time I want to let the code do its thing?

  • in JavaScript
    Avatar for DanDyse

    Thank you Gorden, this sounds perfect. Actually I could just set

    E.enableWatchdog(10);
    

    And it will restart the whole thing whenever anything breaks / hangs longer than 10 seconds, right?
    Does the dog take extra power?

  • in JavaScript
    Avatar for DanDyse

    I have a puck running a simple script that is set to advertise every 2000 ms. There is a timeout set that checks battery every 10 minutes, attaches the value to the name of the device so I can see the status of puck's battery by using a BLE scanner on my phone.
    I am not sure why but sometimes (after days) the advertising string doesn't change anymore (or keeps being empty), puck is still advertising, but the script is obviously not working anymore.
    I believe this is because of some script error that breaks the 10 minutes routine.
    So I would like to put the code in some "try-catch" loop that restarts the whole thing in case something odd happens. How to?
    Thank you!

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

    Thanks, makes no difference unfortunately ... this is what the list looks like (filter set to 4C):

    [
      BluetoothDevice: {
    	"id": "68:8e:9f:41:ed:04 private-resolvable",
    	"rssi": -85,
    	"data": new Uint8Array([2, 1, 26, 2, 10, 12, 12, 255, 76, 0, 16, 7, 61, 31, 172, 239, 186, 118, 120]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([16, 7, 61, 31, 172, 239, 186, 118, 120]).buffer
       },
      BluetoothDevice: {
    	"id": "55:9d:8f:7b:45:a1 private-resolvable",
    	"rssi": -62,
    	"data": new Uint8Array([2, 1, 26, 26, 255, 76, 0, 12, 14, 8, 3, 143, 238, 224, 193, 184, 184, 230, 42, 244, 112, 20, 89, 16, 5, 75, 28, 13, 209, 32]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([12, 14, 8, 3, 143, 238, 224, 193, 184, 184, 230, 42, 244, 112, 20, 89, 16, 5, 75, 28, 13, 209, 32]).buffer
       },
      BluetoothDevice: {
    	"id": "31:7e:10:d1:55:67 private-nonresolvable",
    	"rssi": -45,
    	"data": new Uint8Array([2, 1, 26, 11, 255, 76, 0, 9, 6, 3, 58, 192, 168, 20, 104]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([9, 6, 3, 58, 192, 168, 20, 104]).buffer
       },
      BluetoothDevice: {
    	"id": "36:c2:b6:c2:32:23 private-nonresolvable",
    	"rssi": -90,
    	"data": new Uint8Array([2, 1, 26, 11, 255, 76, 0, 9, 6, 3, 5, 192, 168, 1, 47]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([9, 6, 3, 5, 192, 168, 1, 47]).buffer
       },
      BluetoothDevice: {
    	"id": "54:24:6f:a9:f3:a0 private-resolvable",
    	"rssi": -49,
    	"data": new Uint8Array([2, 1, 26, 2, 10, 12, 10, 255, 76, 0, 16, 5, 71, 28, 200, 62, 162]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([16, 5, 71, 28, 200, 62, 162]).buffer
       },
      BluetoothDevice: {
    	"id": "73:c9:92:18:1f:b6 private-resolvable",
    	"rssi": -28,
    	"data": new Uint8Array([2, 1, 26, 2, 10, 7, 11, 255, 76, 0, 16, 6, 87, 30, 133, 239, 171, 122]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([16, 6, 87, 30, 133, 239, 171, 122]).buffer
       },
      BluetoothDevice: {
    	"id": "e5:a2:61:4d:88:81 random",
    	"rssi": -28,
    	"data": new Uint8Array([7, 255, 76, 0, 18, 2, 0, 3]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([18, 2, 0, 3]).buffer
       },
      BluetoothDevice: {
    	"id": "74:be:34:49:3d:37 private-resolvable",
    	"rssi": -28,
    	"data": new Uint8Array([2, 1, 26, 13, 255, 76, 0, 22, 8, 0, 143, 10, 199, 38, 46, 176, 112]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([22, 8, 0, 143, 10, 199, 38, 46, 176, 112]).buffer
       },
      BluetoothDevice: {
    	"id": "c4:b1:75:d5:55:41 random",
    	"rssi": -47,
    	"data": new Uint8Array([30, 255, 76, 0, 18, 25, 32, 249, 117, 54, 221, 67, 90, 101, 94, 4, 49, 34, 203, 36, 161, 116, 116, 86, 147, 200, 222, 188, 59, 1, 65]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([18, 25, 32, 249, 117, 54, 221, 67, 90, 101, 94, 4, 49, 34, 203, 36, 161, 116, 116, 86, 147, 200, 222, 188, 59, 1, 65]).buffer
       },
      BluetoothDevice: {
    	"id": "de:c3:1d:ad:f1:ed random",
    	"rssi": -47,
    	"data": new Uint8Array([7, 255, 76, 0, 18, 2, 36, 0]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([18, 2, 36, 0]).buffer
       },
      BluetoothDevice: {
    	"id": "f4:36:f6:2b:1d:7b random",
    	"rssi": -56,
    	"data": new Uint8Array([7, 255, 76, 0, 18, 2, 0, 3]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([18, 2, 0, 3]).buffer
       },
      BluetoothDevice: {
    	"id": "6d:8f:cd:d6:fb:9f private-resolvable",
    	"rssi": -88,
    	"data": new Uint8Array([2, 1, 26, 2, 10, 4, 11, 255, 76, 0, 16, 6, 77, 29, 159, 243, 222, 40]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([16, 6, 77, 29, 159, 243, 222, 40]).buffer
       },
      BluetoothDevice: {
    	"id": "fe:ab:ab:74:da:31 random",
    	"rssi": -85,
    	"data": new Uint8Array([7, 255, 76, 0, 18, 2, 0, 0]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([18, 2, 0, 0]).buffer
       },
      BluetoothDevice: {
    	"id": "48:f0:f4:6b:28:58 private-resolvable",
    	"rssi": -85,
    	"data": new Uint8Array([2, 1, 26, 13, 255, 76, 0, 22, 8, 0, 129, 159, 50, 7, 139, 249, 66]).buffer,
    	"manufacturer": 76,
    	"manufacturerData": new Uint8Array([22, 8, 0, 129, 159, 50, 7, 139, 249, 66]).buffer
       }
     ]
    

    How come there is no "name" at all?

  • in Other Boards
    Avatar for DanDyse

    Hehe, after some more trying it works ... the IDE is sometimes a bit "unruly" ... thank you @fanoush!

    • 5 comments
    • 267 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for DanDyse

    Hi again,

    I want my puck to wait a little longer before going into code that changes its name and advertising behaviour. But want it to wait only if a certain device is around (e.g. my iPhone).
    So I tried to do a scan or a request ... but this never returns ANY names of the devices, even with higher timeouts and "active" being true?!
    "namePrefix" does not make a difference when using findDevices – it just lists all, regardless of what I set. "namePrefix" does the opposite when using requestDevice – it never finds any, even if I just set one letter. Yes, I can see plenty of devices around using nRF-Connect including the ones I want the Puck to find.
    This is what I have tried:

    NRF.findDevices(function(devices) { console.log(devices);}, {timeout : 5000, active : true, filters : [{ manufacturerData:{0x004c:{}} }] });
    

    --> puts out a rather large list, but without names

    NRF.findDevices(function(devices) { console.log(devices);}, {timeout : 5000, active : true, filter : [{ namePrefix: 'S' }] });
    

    --> shows the same full list without names, although only two devices would fit.

    NRF.requestDevice({timeout : 5000, active : true, filters : [{ namePrefix: 'S' }] });
    

    --> times out without any result

    I have tried setting timeout to 10 or even 30 seconds – no difference. I must be doing something fundamentally wrong. Please advise.

Actions