Inspired by the "charts" driver with many functions and possibilities I thought about a small alternative, allowing to generate a simple SVG graph of data.
I specially liked the possibility not to load JS code from "outside" my network but being able to store a small version in flash (though it might now be possible, to put charts.js in lfs, maybe even gziped).
As an example I thought about saving the chip temperature in a compact way: Measure e.g. every 30 seconds and save the value compressed in an 8 bit uint.
I decided for a range from -15.0°C to +110°C in 0.5° steps, so we need 125*2 = 250 values (out of 255 possible ones for 8 bit).
The simple ringbuffer used is in a separate file, so it might later also be used in graph driver to share the ringbuffer code.
So for storage we need only 100 bytes for 100 temperatures with a resolution of 0.5°
If we only have data points in equal time steps, we can omit storing the time at all, if we can live with a small error:
We send the data points and take the actual time as time of last value measured (so there is a small error in the graph) and every point before is <timestep> earlier.
Code and artifacts with driver enabled can be found in PR #1346.
After a minimal first version it's now realized as a driver you can start with an optional <timestep> argument:
Here are some screenshots:
Size increase is about 2.5k:
W800 +2.5k
W600 +2.3k
BK7231N +2.3k
I specially liked the possibility not to load JS code from "outside" my network but being able to store a small version in flash (though it might now be possible, to put charts.js in lfs, maybe even gziped).
As an example I thought about saving the chip temperature in a compact way: Measure e.g. every 30 seconds and save the value compressed in an 8 bit uint.
I decided for a range from -15.0°C to +110°C in 0.5° steps, so we need 125*2 = 250 values (out of 255 possible ones for 8 bit).
The simple ringbuffer used is in a separate file, so it might later also be used in graph driver to share the ringbuffer code.
So for storage we need only 100 bytes for 100 temperatures with a resolution of 0.5°
If we only have data points in equal time steps, we can omit storing the time at all, if we can live with a small error:
We send the data points and take the actual time as time of last value measured (so there is a small error in the graph) and every point before is <timestep> earlier.
Code and artifacts with driver enabled can be found in PR #1346.
After a minimal first version it's now realized as a driver you can start with an optional <timestep> argument:
startdriver savetemps <optional time between measures, defaults to 30 seconds>
Here are some screenshots:



Size increase is about 2.5k:
W800 +2.5k
W600 +2.3k
BK7231N +2.3k
Cool? Ranking DIY