From 04af6b9a887865c62cb6d8f4c8f3d8cf03221d69 Mon Sep 17 00:00:00 2001 From: jeffyactive Date: Fri, 10 Dec 2021 11:55:50 -0500 Subject: [PATCH] Always advertise app name among data frames --- apps/sensible/sensible.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/apps/sensible/sensible.js b/apps/sensible/sensible.js index e604ccf1a..91bbeaa02 100644 --- a/apps/sensible/sensible.js +++ b/apps/sensible/sensible.js @@ -7,12 +7,9 @@ // Non-user-configurable constants const APP_ID = 'sensible'; const ESPRUINO_COMPANY_CODE = 0x0590; -const DEFAULT_ADVERTISING_OPTIONS = { - showName: false, - manufacturer: ESPRUINO_COMPANY_CODE, - manufacturerData: JSON.stringify({ name: APP_ID }), - interval: 2000 -}; +const APP_ADVERTISING_DATA = [ 0x16, 0xff, 0x90, 0x05, 0x7b, 0x22, 0x6e, 0x61, + 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x65, 0x6e, + 0x73, 0x69, 0x62, 0x6c, 0x65, 0x22, 0x7d ]; // Global variables @@ -105,7 +102,7 @@ let magMenu = { // Check for new sensor data and update the advertising sequence function transmitUpdatedSensorData() { - let data = []; + let data = [ APP_ADVERTISING_DATA ]; // Always advertise at least app name if(isNewBarData) { data.push({ 0x2a6e: encodeTemperature(bar.temperature) }); @@ -117,10 +114,6 @@ function transmitUpdatedSensorData() { isNewHrmData = false; } - if(data.length === 0) { - return NRF.setAdvertising({}, DEFAULT_ADVERTISING_OPTIONS); - } - NRF.setAdvertising(data, { showName: false, interval: 200 }); } @@ -203,7 +196,6 @@ Bangle.on('mag', function(newMag) { // On start: enable sensors and display main menu g.clear(); -NRF.setAdvertising({}, DEFAULT_ADVERTISING_OPTIONS); Bangle.setBarometerPower(isBarEnabled, APP_ID); Bangle.setGPSPower(isGpsEnabled, APP_ID); Bangle.setHRMPower(isHrmEnabled, APP_ID);