As I’m integrating my “display” with HomeKit (smarthome) to switch it off.
It works to simple clear and skip drawing to the display but the update thread remains busy and taking CPU.
Is there a way to stop the thread or skip updating, to lower CPU usage, and then later simple start it?
I’m using the c++ interface but it seams that it’s not public, besides I don’t understand enough of c++ to know what to do.
Thanks in advance!
i think i found a workaround.
i deleting the RGBMatrix
and immediately creating a new one while i have set daemon
to -1
… its a little heavier then what i have hoped for but it does what i wanted to achieve, CPU is at zero and it starts back up.
// skip if we are off
if (!on) {
if (last_frame_on) {
printf("Killing matrix and creating a new one");
canvas->Clear();
delete matrix;
matrix = rgb_matrix::CreateMatrixFromFlags(&argc, &argv, &defaults, &runtime);
if (matrix == NULL) return EXIT_FAILURE;
canvas = matrix->CreateFrameCanvas();
}
last_frame_on = false;
usleep(1000);
continue;
}
if (!last_frame_on) matrix->StartRefresh();
last_frame_on = true;
Note: last_frame_on
is just a flag that helps to only do things if needed. full code