user133430
Member since Aug 2021 • Last active Nov 2021Most recent activity
-
- 14 comments
- 3,584 views
-
The code I'm uploading. Basically, it allows me to connect my android app and retrieve log files.
var currentLog = {}; var log = {}; function ut(epoch) { setTime(epoch); } function listFiles(f) { f = typeof f !== 'undefined' ? f : /.log$/; return require("Storage").list(f); } function eraseOldest(files) { require("Storage").erase(files[0]); } function eraseAllLogFiles(files) { console.log(files); for (i=0; i <= files.length; i++) { console.log("erasing "+files[i]); require("Storage").erase(files[i]); } } //Record sensor data and dump in file when buffer exceeds 96 entries for 24/hr function fillLog() { var data = Puck.capSense(); var date = (new Date()).toISOString(); //Write to RAM if less than if (Object.keys(currentLog).length < 5) { currentLog[date] = data; } else { var files = listFiles(); //Check if storage is full, cleanup oldest if (files.length > 5) { //Deleteing files to write new eraseOldest(files); } //Wirite to file if log is full currentLog[date] = data; currentLog["lastdate"] = date; require("Storage").writeJSON(date + ".log", currentLog); currentLog = {}; } } function getData(file) { if (file == "undefined") { return require("Storage").readJSON(listFiles()[0]); } else { return require("Storage").readJSON(file); } } //Sync data fromDate defines latest log files we want to receive function sd(fromDate) { var files = listFiles(); for (i=0; i <= files.length; i++) { console.log("&&") var file = files[i]; if (typeof file !== "undefined" && Date.parse(file.substr(0, file.indexOf("."))) > fromDate) { log = require("Storage").readJSON(file); console.log(log); } else if (typeof file == "undefined") { console.log("DONE") return; } else { console.log("No logs found for this date range"); } } } function startMonitor() { //setTime(epoch); setInterval(fillLog, 2000); } // Change the name that's advertised NRF.setAdvertising({}, {name:"Test"}); var Blink = function(times, frenquency) { for(var i = 0 ; i< times ; i++) { setTimeout(function() { LED1.write(true)}, frenquency*2*i+1); setTimeout(function() { LED1.write(false)}, frenquency*2*i+frenquency); } }; NRF.on("connect", function(addr) { Blink(4,250); }); NRF.on("disconnect", function(addr) {Blink(2,250);}); //DELETE FOR PROD eraseAllLogFiles(listFiles()); //MONITOR ON STARTUP startMonitor();
-
Hi, so I ordered puck from here https://www.adafruit.com/product/3372, V2 . I also did flash it with firmware, don't quite remember the version it had. It's basically behaving like I'm pressing the button during startup while I'm not doing that and it's out of the case. I'll try to see if I'm able to get it connected with nRF Toolbox and flash the latest firmware.
-
-
I suspect that Puck somehow bricked during connect/disconnect or flash memory update. Green LED stays lit even when I try hard reset. Please help if there is any way to reset the Puck, same thing happened to 2 devices today, I'm not sure what is the cause and I don't want to keep breaking them. Console log:
Connected to Web Bluetooth, Puck.js 1363
index.js:92927 >>> Minifying
index.js:92927 >>> Minification complete
index.js:92927 Uploading 2393 bytes to flash
index.js:92927 Found a prompt... great!
index.js:92927 >>> Sending...
index.js:92927 --->BUNCH OF CODE HERE
index.js:92927 Splitting for reset(), delay 250
index.js:92927 >>> Sent
index.js:92927 BT> Disconnected (gattserverdisconnected)
index.js:92927 Disconnect callback... {"port":"Web Bluetooth","portName":"Puck.js 1363"}
index.js:92932 [notify_warn] Disconnected from Web Bluetooth, Puck.js 1363
console.warn @ index.js:92932
index.js:92927 >>> Disconnected from Web Bluetooth, Puck.js 1363
index.js:92927 >>> Connecting...
index.js:92927 Set Slow Write = true
index.js:92927 BT> Starting device chooser
index.js:92927 BT> ERROR: NotFoundError: User cancelled the requestDevice() chooser.
index.js:92937 [notify_error] Connection Failed: NotFoundError: User cancelled the requestDevice() chooser.
console.error @ index.js:92937
index.js:92927 >>> Connection Failed: NotFoundError: User cancelled the requestDevice() chooser.
index.js:92927 >>> Connecting...
index.js:92927 Set Slow Write = true
index.js:92927 BT> Starting device chooser
index.js:92927 BT> ERROR: NotFoundError: User cancelled the requestDevice() chooser.
index.js:92937 [notify_error] Connection Failed: NotFoundError: User cancelled the requestDevice() chooser.
console.error @ index.js:92937
index.js:92927 >>> Connection Failed: NotFoundError: User cancelled the requestDevice() chooser.
index.js:92927 >>> Connecting...
index.js:92927 Set Slow Write = true
index.js:92927 BT> Starting device chooser
index.js:92927 BT> ERROR: NotFoundError: User cancelled the requestDevice() chooser.
index.js:92937 [notify_error] Connection Failed: NotFoundError: User cancelled the requestDevice() chooser.
console.error @
Thank you all for looking into it, I was able to "fix" them by updating firmware with nRF Toolbox app. I also made a video of the issue when trying to hard reset it: https://youtu.be/zg66NeCJJPk