Avatar for user94148

user94148

Member since Sep 2018 • Last active Nov 2019
  • 3 conversations
  • 10 comments

Most recent activity

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

    Hi gordon

    Thanks for your answer
    I don't follow you. I've tried also to use the

    Float32Array([Puck.light() * 100]).buffer
    

    to eliminate this question of value between 0 à 1 as an integer. But the value I get, in the ADV_IND does not change neither !!

    I've looked again at the http://www.espruino.com/Reference#l_NRF_­setAdvertising but do no see really what is wrong in my code.
    By the way I've not used the following code that is proposed in the puck.js API documentation because to me, the setInterval is redundant to the setAdvertising. The NRF.setAdvertising is already arming the advertising mechanism and their is no way to use a setInterval() to do the same again ...
    I Am wrong ?

    setInterval(function() {
      NRF.setAdvertising({
        0x1809 : [Math.round(E.getTemperature())]
      });
    }, 30000);
    

    Vpl

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

    Hi

    I'm testing the ADV_IND associated to a sensing service definition as follow

    NRF.setServices({
    	// Configuring the Envrionmental Sensing Service
    	0x181A: {
    		// Configure Temperature Characteristics
    		0x2A6E: {
    			readable: true,
    			notify: true,
    			writeable: false,
    		}
    	}
    });
    NRF.setAdvertising(
       [
    	{0x181A : [Puck.light()]}], 
       {interval:500}
    );
    

    I've controlled that the service is well defined into the GATT
    I receive ADV_IND perdiodically as expected

    My problem is that the Service Data value does not change at all. Egal to 0 !!
    I've check several things

    The Puck.light() is Ok as the following code works fine

    setInterval(function() {
      print (Puck.light());
    }, 500);
    

    I've tried to replace the Puck.light() by

    - new Float32Array([Puck.light() * 100]).buffer or
     - new Int16Array([E.getTemperature() * 100]).buffer
    

    The value is not = 0 but does not change neither ..

    Any idea ?
    Other option to get this sensing value ?

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

    Hi
    Yes this helps and clarify a lot

    Thanks very much for your support and help

    Regards
    Vpl

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

    Hi

    For the Advertising issue I recap from the begining with the code such as we are on the same page:
    Here is the code that I've loaded on my puck (latest version)

    NRF.setServices({
        // Configuring the Envrionmental Sensing Service
        0x181A: {
            // Configure Temperature Characteristics
            0x2A6E: {
                readable: true,
                notify: true,
                writeable: false,
                value: new Int16Array([E.getTemperature() * 100]).buffer
            }
        }
    // Make Envrionmental Sensing Service known 
    }, {advertise: ['0x181A']});
    

    The puck.js documentation (https://www.espruino.com/Reference#l_NRF­_setServices) states that a connection is required to get the ADV_IND.
    So I used the NRF connect Android App (latest version), activated my BLE sniffer and connected to the puck
    On the trace I see the CONNECT_REQ but no ADV_IND with the temperature

    What is wrong ? is there an error in the doc and the "advertise" option does not work this way ?

    Thanks for your answer

    Regards
    Vpl

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

    Hi,

    Regarding this advertising behavior that does not work for me, I'm refering to this part of the documentation https://www.espruino.com/Reference#l_NRF_setServices
    It is said here

    Just creating a service doesn't mean that the service will be advertised. It will only be available after a device connects. To advertise, specify the UUIDs you wish to advertise in the advertise field of the second options argument. For example this will create and advertise a heart rate service:

    NRF.setServices({
      0x180D: { // heart_rate
        0x2A37: { // heart_rate_measurement
          notify: true,
          value : [0x06, heartrate],
        }
      }
    }, { advertise: [ '180D' ] })
    

    In my code (provided earlier in this post) I'm replicating exactly the same things but does not work

    What do I do wrongly ?

    Regards
    Vpl

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

    Hi

    Thanks very much for your answer
    I've tested different things

    My firmware is 2v04
    I've tested a simple advertisement using the setAdvertising like that

    NRF.setAdvertising(
       [
    	{0x180F : new Int16Array([E.getTemperature() * 100]).buffer}
       ], 
       {
    		interval:300
    	}
    	);
    
    

    I get ADV_IND as expected with period SCAN_REQ/SCAN_RESP.
    Perfect this is what I was looking for. THanks

    Nevertheless in the puck documentation it is written that we should get a similar behavior with the following code

    NRF.setServices({
    	// Configuring the Envrionmental Sensing Service
    	0x181A: {
    		// Configure Temperature Characteristics
    		0x2A6E: {
    			readable: true,
    			notify: true,
    			writeable: false,
    			value: new Int16Array([E.getTemperature() * 100]).buffer
    		}
    	}
    // Make Envrionmental Sensing Service known 
    }, {advertise: ['0x181A']});
    

    I've tested but DO NOT get any advertising. It is mentioned to be connected to the device. I've tried with the NRF Tool (android) to connect but no advertisement
    Is it a bug or a wrong coding ?


    By the way (not a priority but questioning)
    The only thing I've noticed is that the battery level does not change .. A bit surprised as when I run this code

    setInterval(function() {
      print (E.getBattery());
    }, 500);
    

    I get a variable battery level with 5/10% change at each sample

    I've tried to change in the SetAdvertising with

    Puck.getBatteryPercentage()
    

    But same problem.

    Thanks for your support and help
    I'm developing labs for students and this puck.js is really a nice piece of Hw for training !!

    Regards
    Vpl

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

    Hi
    I've updated the firmware to the latest version 2.v04
    Then I've reloaded the service as above.
    Connecting with Nrf Connect (android) I can see as you the 0x181A sensing service

    Then in the documentation they mention that the advertisement cannot be seen outside of a connection
    So running my sniffer I've connected to the puck.js from NrfConnect
    I can see The CONNECT_REQ then various Read-by-group req to discover the GATT characteristiques
    then a bunch of empty PDU to maintain the connection open I guess.
    But no adverstisement at all
    At the end I get again the ADV_IND with just the device Name

    I suspect an issue somewhere or an error in the doc or a wrong usage ?

    Any idea and help ?

    Thanks a lot

    Vpl

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

    Hi
    Thanks very much for this quick answer. My firmware is 1.99 so a bit old but not so much.
    I'm going to update the firmware first to check this option
    Thanks again
    Regards
    Vpl

Actions