puck.js-改善长时间延迟的广告

时间:2018-10-08 12:25:57

标签: button bluetooth delay

我正在使用puck.js按钮打开我的色调灯。 基本上,按钮按下是由EspruinoHub进行广告宣传和接送,然后通过nodered转向以关闭灯。不幸的是,这可能要花一些时间,大约要延迟8秒。

这种延迟是否可以改善,我知道电池可以承受一定的冲击,但愿意尝试不同的情况。

查看puck.js上使用的代码

var pressCount = 0;
setWatch(function() {
  pressCount++;
  NRF.setAdvertising({
    0xFFFF : [pressCount]
  });
}, BTN, { edge:"rising", repeat:true, debounce:50 });

节点流:

  

[{“ id”:“ 597ae332.73aaa4”,“ type”:“ mqtt   in“,” z“:” 99c290d2.1b2068“,” name“:”“,” topic“:” / ble / advertise / d8:19:e7:5b:3a:57 / ffff“,” qos“:” 2“,”经纪人“:” 21fe8cb3.438fcc“,” x“:160,” y“:440,”电线“:[[”“ 2b1d98d6.76c7b”,“ d47b84a0.1d40e8”]]},{“ id” :“ 2b1d98d6.76c7b”,“类型”:“调试”,“ z”:“ 99c290d2.1b2068”,“名称”:“”,“活动”:true,“ tosidebar”:true,“控制台”:false, “ tostatus”:false,“ complete”:“有效载荷”,“ x”:410,“ y”:360,“电线”:[]},{“ id”:“ 9efb6c2e.9426b”,“类型”:“色相组“,” z“:” 99c290d2.1b2068“,”名称“:”生活   Room”,“ bridge”:“ fe3415a5.63152”,“ groupid”:“ 24”,“ colornamer”:true,“ x”:810,“ y”:500,“ wires”:[[“” 1c68d506.5a4eb3“ ]]},{“ id”:“ 8a84c118.fdbae”,“ type”:“ function”,“ z”:“ 99c290d2.1b2068”,“ name”:“ On / Off”,“ func”:“ var   liv_light_bool = global.get(\“ liv_light_bool \”); \ nconst msg1 = {} \ n \ n   \ nif(!liv_light_bool){\ n \ n msg.payload = {\ n \ t \“ on \”:[true],\ n
  \ t \“亮度\”:[100],\ n \ t \“ rgb \”:[255,255,255],\ n
  \ t \“ transitionTime \”:[3],\ n \ t // \“ colorloop \”:[10],\ n}; \ n
  \ n} \ n \ nelse \ n {\ n msg.payload = {\ n \ t \“ on \”:[false],\ n
  \ t \“亮度\”:[0],\ n}; \ n \ n \ n} \ n \ n \ nmsg1.payload   = \“ digitalPulse(LED2,1,50); \”; \ n \ nreturn [msg,msg1];“,”输出“:2,” noerr“:0,” x“:530,” y“:440 ,“ wires”:[[“” 9efb6c2e.9426b“],[” 1660958b.f84e62“,” 73e8e8a3.ba5848“]]}},{” id“:” 1c68d506.5a4eb3“,” type“:” function“,” z“:” 99c290d2.1b2068“,”名称“:”设置   全局变量“,” func“:” global.set(\“ liv_light_bool \”,msg.payload.on);   \ nnode.status({fill:\“ red \”,shape:\“ ring \”,text:msg.payload.on});“,” outputs“:1,” noerr“:0,” x“: 1060,“ y”:500,“ wires”:[[]]},{“ id”:“ 1660958b.f84e62”,“ type”:“ debug”,“ z”:“ 99c290d2.1b2068”,“ name” :“”,“ active”:true,“ tosidebar”:true,“ console”:false,“ tostatus”:false,“ complete”:“ true”,“ x”:670,“ y”:360,“电线“:[]},{” id“:” d47b84a0.1d40e8“,” type“:” rbe“,” z“:” 99c290d2.1b2068“,” name“:”“,” func“:” rbe“, “ gap”:“”,“ start”:“”,“ inout”:“ out”,“ property”:“有效载荷”,“ x”:390,“ y”:440,“电线”:[[“” 8a84c118 .fdbae“]]},{” id“:” 21fe8cb3.438fcc“,” type“:” mqtt-broker“,” z“:”“,” name“:” Localhost“,” broker“:” localhost“ ,“ port”:“ 1883”,“ clientid”:“”,“ usetls”:false,“ compatmode”:true,“ keepalive”:“ 60”,“ cleansession”:true,“ birthTopic”:“”,“ birthQos“:” 0“,” birthRetain“:” false“,” birthPayload“:”“,” closeTopic“:”“,” closeQos“:” 0“,” closeRetain“:” false“,” closePayload“:” “,” willTopic“:”“,” willQos“:” 0“,” willRetain“:” false“,” willPayload“:”“},{” id“:” fe3415a5.63152“,” type“:”色相-bridge“,” z“:”“,” name“:” Philips   hue“,” bridge“:” 192.168.0.24“,” key“:” vvB2GXGT15E6qEaaGTWzRwZVKoBXTcHYCnN25sGo“,” interval“:” 1500“}]

0 个答案:

没有答案