-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADC sample rate and scopeHandler rate? #6
Comments
Hi Dagnall
I'll have to look at the code again after work.
But as I recall the 200ms rate was set intentionally due to the amount of data being streamed. The JS couldn't handle plotting faster than 5ms intervals. But needed around 200ms to do it.
So my work around was to store 8 ADC samples in a buffer and then send the 8 sample buffer over web sockets once every 200ms. That way the webpage could plot 8 data points while waiting for the next set.
Let me know if this helps.
… On Aug 15, 2017, at 12:28 PM, dagnall ***@***.***> wrote:
@S-March
Hi, I have been looking in more detail at the code and was wondering if you can help explain some details about the timings...
I think that in your original code the "esp" is reading the ADC every 5ms, and then calling the "scopeHandler" code at "mstimer" intervals to update the display, using the most recent adc readings. thus sending ADC data to the display PC/tablet.
BUT, I have been looking at the timings, and the scopehandler code seems to take about 200ms to complete, and only sends one sample from each channel?
I suspect I have "broken" something critical so that any "fast" ADC (eg internal) is now being hobbled by this slow scopeHandler code, quite probably by some edits I have made.
What update rate can you achieve with the original code? I did try to reinstall an early version,but still got 200ms or thereabouts timings for the scopeHandler code part.
Any suggestions, comments or hints gratefully accepted!
Cheers
Dagnall
(I have currently updated the code (again) so that the HTML stuff sorts out a sensible "mSTimer" based on which and how many ADC's it is using and sends this to the ESP .. But I will not upload this until I think the speed issue is sorted.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@S-March thanks, that makes sense, I must have upset or removed the mechanism that stores the readings in a buffer.. I can now see the addadcscopedata functions are called or should be called a few times before the scope handler is called... I think my mods have not take that into account! Thanks |
No prob, good luck!
… On Aug 15, 2017, at 3:16 PM, dagnall ***@***.***> wrote:
@S-March thanks, that makes sense, I must have upset or removed the mechanism that stores the readings in a buffer.. I can now see the addadcscopedata functions are called or should be called a few times before the scope handler is called... I think my mods have not take that into account!
I will try to set some interactions so that the code works both with fast adc and the really slow two channel strain gauge interface.
Thanks
D
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@S-March In doing this i have also moved the data logging send to the adc routine, from the web update routine where it was it only sent (one) data when sending to the HTML . Not sure if I introduced this or it was there before.. I have one last and very irritating issue: the scope plot (in my version) does not completely plot to the right hand edge of the plot area. If the set of data points being plotted exceeds the plot area, the clear plot is immediately called before the last plot lines are written... This is not so troublesome with time scales of 10 sec or longer, but with expansion and especially on the 2s scale, there can be more plot points than space and so clear plot happens immediately and there is no visible plot. Quite difficult to explain, not sure if this is another bug I introduced or one that was there before... Anyway, I think I need to synchronise the clear with new data arriving. Or I may try to reduce the number of data points so they fit, but would prefer an alternative solution... |
@S-March Hope you like it. I do not have the same I2C ADC as you so have not been able to test that feature, but hopefully it should be still working. The code is still littered with comments and commented out lines where I changed my mind or was working on something or trying to see what happened, but hopefully they will assist if you are trying to see what I did. |
@S-March
Hi, I have been looking in more detail at the code and was wondering if you can help explain some details about the timings...
I think that in your original code the "esp" is reading the ADC every 5ms, and then calling the "scopeHandler" code at "mstimer" intervals to update the display, using the most recent adc readings. thus sending ADC data to the display PC/tablet.
BUT, I have been looking at the timings, and the scopehandler code seems to take about 200ms to complete, and only sends one sample from each channel?
I suspect I have "broken" something critical so that any "fast" ADC (eg internal) is now being hobbled by this slow scopeHandler code, quite probably by some edits I have made.
What update rate can you achieve with the original code? I did try to reinstall an early version,but still got 200ms or thereabouts timings for the scopeHandler code part.
Any suggestions, comments or hints gratefully accepted!
Cheers
Dagnall
(I have currently updated the code (again) so that the HTML stuff sorts out a sensible "mSTimer" based on which and how many ADC's it is using and sends this to the ESP .. But I will not upload this until I think the speed issue is sorted.)
The text was updated successfully, but these errors were encountered: