Open K0rkunc opened 3 years ago
I think the code should be like this
rgb_matrix::FrameCanvas *canvas;
RGBMatrix *matrix;
RGBMatrix::Options matrix_options;
rgb_matrix::RuntimeOptions runtime_opt;
defaults.pwm_dither_bits=1;
defaults.pwm_bits=11;
//defaults.parallel =1;
defaults.show_refresh_rate=1;
//runtime_opt.daemon=0;
runtime_opt.gpio_slowdown=3;
......
matrix = RGBMatrix::CreateFromOptions(matrix_options, runtime_opt);
canvas = matrix->CreateFrameCanvas();
while (!interrupt_received) {
canvas->SetPixel(50,50,114,115,0);
canvas = matrix->SwapOnVSync(canvas);
}
I think the code should be like this
rgb_matrix::FrameCanvas *canvas; RGBMatrix *matrix; RGBMatrix::Options matrix_options; rgb_matrix::RuntimeOptions runtime_opt; defaults.pwm_dither_bits=1; defaults.pwm_bits=11; //defaults.parallel =1; defaults.show_refresh_rate=1; //runtime_opt.daemon=0; runtime_opt.gpio_slowdown=3; ...... matrix = RGBMatrix::CreateFromOptions(matrix_options, runtime_opt); canvas = matrix->CreateFrameCanvas(); while (!interrupt_received) { canvas->SetPixel(50,50,114,115,0); canvas = matrix->SwapOnVSync(canvas); }
thanks for your answer
There will be another small problem, I want to show a picture, I want to show another small picture or text on it, but the picture on the base is broken, how can I solve this, can you give an example about it?
Magik++ is PIL compatible graphic library and Hzeller's library supports it. I hope this code sample might helpful
Image img;
img.read("your image.jpg");
img.resize( Geometry(128,64));
//if you need another graphic job
// Do it on the img object
//draw the image on the canvas
for (size_t y = 0; y < img.rows(); ++y) {
for (size_t x = 0; x < img.columns(); ++x) {
const Magick::Color &c = img.pixelColor(x, y);
canvas->SetPixel(x, y,
ScaleQuantumToChar(c.redQuantum()),
ScaleQuantumToChar(c.greenQuantum()),
ScaleQuantumToChar(c.blueQuantum()));
}
}
canvas = matrix->SwapOnVSync(canvas);
**hi my screen flicker how to fix that
i tryed slowdown 3 4 5 ditherbits 0 1 2 pwm nano sc 50 150 250 35 1500 i tried but it didn't work
my fps 189/193 but sometimes it turns 40 then goes back to normal again
MY Codes**