max
New Member
Posts: 1
|
Post by max on May 12, 2014 5:17:49 GMT -8
Hi,
I am writing some values to the screen with a update rate from 1 sec. Is it possible to update one value 5 times per second without updating all other values?
thanks max
|
|
|
Post by jamesbowman on May 13, 2014 6:46:58 GMT -8
The GD2 uses a 'true' GPU, which means that you have to draw everything for every frame.
I might do this: make a static 'struct' with all of the values in it. The sensing code updates each value at its 'natural' rate.
Then write a function that displays everything in the 'struct', and call it after all changes.
For example...
static struct { int a; int b; int c; } state;
static void sensing() { state.a++; ... state.b = analogRead(A1); ... if (random(6) == 3) state.c++; }
static void redraw() { GD.Clear(); GD.cmd_number(240, 50, 31, OPT_CENTER, state.a); GD.cmd_number(240, 150, 31, OPT_CENTER, state.b); GD.cmd_number(240, 200, 31, OPT_CENTER, state.c); GD.swap(); }
static void loop() { sensing(); redraw(); }
|
|