Avatar for bakon

bakon

Member since Apr 2020 • Last active May 2020
  • 1 conversations
  • 6 comments

Most recent activity

  • in Other Boards
    Avatar for bakon

    oh oops you're right, unfortunately that didn't solve my problem. I'm making a better post about it on the github commit.

    Thank you.

    • 4 comments
    • 1,716 views
  • in Other Boards
    Avatar for bakon

    Also this is the code running on my thingy device:
    https://github.com/bakon11/openrpcThingy­52/blob/master/server/typescript/src/dev­ices/thingy52.js

    I noticed that it actually does execute the function each time, but it disconnects before the call back fires off back to node JS and my data comes back undefined.

  • in Other Boards
    Avatar for bakon

    Hey guys.

    So I have the nordic thingy52 with espruino 1v98 since I can't flash newer versions due to locked bootloader.

    Anyways, I wrote a small program to run on it to basically collect some sensor data and store them in typed arrays in the ram, and a small data extraction function based on some examples from espruino.

    Everything actually works great, the problem I'm having is when using the espruino NPM package(https://www.npmjs.com/package/espruino).

    Im using the example to run expresion function on the device.

    import { GetSensorData } from "../generated-typings";
    var esp = require("espruino");
    
    const getSensorData: GetSensorData = (deviceID, sensorType) => {
      return Promise.resolve(querySensors(deviceID, sensorType));
    };
    
    const querySensors = (deviceID:any, sensorType: any):Promise<any> => {
      return new Promise((resolve, reject) => {  
        esp.init((data:any) => {
          esp.expr(deviceID, 'exportData('+sensorType+')', function(data:any){
            // resolve(JSON.parse(data));
            resolve(data);
            console.log("your data:" + data);
            // return(data);
          });
        });
      });
    }
    
    // queryPressure("e5:b6:7f:eb:a0:dd");
    export default getSensorData;
    });
    

    And on first call it works great and returns data to my app, however when I do the same call again I get unable to connect error:

    Already initialised.
    Already initialised.
    BT> Connecting
    BT> Connected
    Connected {}
    BT> send "\n"
    Received a prompt after sending newline... good!
    Sending...
    ---> "\u0010print(\"<\",\"<<\",JSON.stringify­(process.env),\">>\",\">\")\n"
    BT> send "\u0010print(\"<\",\"<<\",JSON"
    BT> send ".stringify(process.e"
    BT> send "nv),\">>\",\">\")\n"
    Sent
    Receiving...
    Got "< << {\"VERSION\":\"1v98\",\"GIT_COMMIT\":\"1­e06400\",\"BOARD\":\"THINGY52\",\"FLASH\­":524288,\"RAM\":65536,\"SERIAL\":\"50a9­77b6-bf9ebbea\",\"CONSOLE\":\"Bluetooth\­",\"MODULES\":\"Flash,Storage,BH1745,Thi­ngy,LPS22HB,HTS221,CCS811,MPU9250,LIS2DH­12\",\"EXPTR\":536882356} >> >\r\n>"
    
    Found THINGY52, 1v98
    Loading http://www.espruino.com/json/THINGY52.js­on
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    Set Slow Write = false
    FIRMWARE: Current 1v98, Available 2v05
    BT> send "\n"
    Received a prompt after sending newline... good!
    Sending...
    ---> "\u0010print(\"<\",\"<<\",JSON.stringify­(exportData(temp)),\">>\",\">\")\n"
    BT> send "\u0010print(\"<\",\"<<\",JSON"
    BT> send ".stringify(exportDat"
    BT> send "a(temp)),\">>\",\">\")\n"
    Sent
    Receiving...
    Got "< << [{\"date\":{\"ms\":1588436637},\"sensor\­":\"22.31\"},{\"date\":{\"ms\":158843664­1},\"sensor\":\"22.29\"},{\"date\":{\"ms­\":1588436645},\"sensor\":\"22.23\"},{\"­date\":{\"ms\":1588436649},\"sensor\":\"­22.23\"},{\"date\":{\"ms\":1588436653},\­"sensor\":\"22.16\"},{\"date\":{\"ms\":1­588436657},\"sensor\":\"22.14\"},{\"date­\":{\"ms\":1588436661},\"sensor\":\"22.1­8\"},{\"date\":{\"ms\":1588436665},\"sen­sor\":\"22.19\"},{\"date\":{\"ms\":15884­36669},\"sensor\":\"22.16\"},{\"date\":{­\"ms\":1588436673},\"sensor\":\"22.10\"}­,{\"date\":{\"ms\":1588436677},\"sensor\­":\"22.16\"},{\"date\":{\"ms\":158843668­1},\"sensor\":\"22.21\"},{\"date\":{\"ms­\":1588436685},\"sensor\":\"22.21\"},{\"­date\":{\"ms\":1588436689},\"sensor\":\"­22.18\"},{\"date\":{\"ms\":1588436693},\­"sensor\":\"22.14\"},{\"date\":{\"ms\":1­588436697},\"sensor\":\"22.10\"},{\"date­\":{\"ms\":1588436701},\"sensor\":\"22.2­7\"},{\"date\":{\"ms\":1588436705},\"sen­sor\":\"22.16\"},{\"date\":{\"ms\":15884­36709},\"sensor\":\"22.27\"},{\"date\":{­\"ms\":1588436713},\"sensor\":\"22.19\"}­,{\"date\":{\"ms\":1588436717},\"sensor\­":\"22.27\"},{\"date\":{\"ms\":158843672­1},\"sensor\":\"22.23\"},{\"date\":{\"ms­\":1588436725},\"sensor\":\"22.29\"},{\"­date\":{\"ms\":1588436729},\"sensor\":\"­22.19\"},{\"date\":{\"ms\":1588436733},\­"sensor\":\"22.05\"}] >> >\r\n>"
    
    
    Unable to connect!
    your data:undefined
    

    And basically it does this until I stop and start the nodejs app again.

    Thank you.

  • in Other Boards
    Avatar for bakon

    Hey, were you ever able to get nordic to sign the 2v04 firmware?

    Thanks.

Actions