running this prints "..." on screen, so variable startAt is corrupted
function rtc2Date(dt){
var t,d;
d = dt.split(" ")[0]; t = dt.split(" ")[1];
d = d.split("/"); t = t.split(":");
return new Date(d[2] + 2000,d[1],d[0],t[0],t[1],t[2]);
}
var fs = require("fs");
var data = JSON.parse(fs.readFile("Juergen1_ctrl.json"));
var startAt = rtc2Date(data.options.startAt);
//console.log(startAt);
var entrys = fs.statSync("Juergen1_data.bin").size / 20;
console.log(startAt);
uncommented first console.log and it works fine:
function rtc2Date(dt){
var t,d;
d = dt.split(" ")[0]; t = dt.split(" ")[1];
d = d.split("/"); t = t.split(":");
return new Date(d[2] + 2000,d[1],d[0],t[0],t[1],t[2]);
}
var fs = require("fs");
var data = JSON.parse(fs.readFile("Juergen1_ctrl.json"));
var startAt = rtc2Date(data.options.startAt);
console.log(startAt);
var entrys = fs.statSync("Juergen1_data.bin").size / 20;
console.log(startAt);
Also had problems sometimes by using fs.statSync from terminal window. Connection to com-port was lost, and I had to reset and restart everything.
IMHO, this could be a problem around memory management for fs.statSync.
Using 1v80 on Espruino Board
Data returned from readFile is this:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
running this prints "..." on screen, so variable startAt is corrupted
uncommented first console.log and it works fine:
Also had problems sometimes by using fs.statSync from terminal window. Connection to com-port was lost, and I had to reset and restart everything.
IMHO, this could be a problem around memory management for fs.statSync.
Using 1v80 on Espruino Board
Data returned from readFile is this: