• Sun 2019.11.10

    Good Morning @user101931 ran out of steam last evening as I'm an hour ahead.

    'OHHHHH no, if gettime return in second, that proof the 833 Hz is impossible with javascript'

    Wanted to make sure it was understood that adding the getTime() function was only to get visual feedback on locating where the bottleneck is. It wasn't meant to be left in. IMPORTANT POINT: It is the duration of the loop (which will be in the msec range) has little to do with using that function (which returns a value in decimal seconds) to determine the iteration elapsed time. It is setInterval() and not getTime() we need to be concerned about. I also wanted to verify that SPI was functioning okay, and I believe we are in agreement that the device is filling the FIFO buffer, and that is overflowing.

    The time killer is the actual use of console.log() in an attempt to update the WebIDE console panel.


    'is there a way to check the data without using print?'

    Q: Is it really necessary to make an attempt to print *ALL* the values to the console?

    While it might be necessary to sample at a high rate, the data really isn't changing that fast between samples. My S.W.A.G. guess is that more than 90% aren't even needed as human perception is at a much slower rate. Isn't the need just to determine when the accelerometer changes state?

    What about using a counter and a conditional statement to say log every twentieth pass, instead of every pass?

    What about only fetching data when say the device is bumped for instance?

    See use of setWatch at end of snippet at:
    http://www.espruino.com/LSM6DSL

     

    'another way to call the function repeatedly'

    Other than a while loop, which will be tough at times to break out of, (not recommended stick with setInterval) writing the loop with inline 'C' will remove the interpreter having to read and parse each Javascript line of code.


    'but I am concerning if write file write it to the flash memory?'

    Some ideas from the data logging tutorial to toss around:

    http://www.espruino.com/Data+Collection
    http://www.espruino.com/Tutorials

About

Avatar for Robin @Robin started