Skip to content

Conversation

@edimarvalentin
Copy link

This pull request introduces a new RGB LED matrix display application (rgboard) that integrates with a queue-based backend to fetch and render designs. The changes include the addition of a Makefile for build automation, new header and source files for core functionality, and a main program to tie everything together.

Build System

  • Added a Makefile to define build rules, including compiler settings, source files, and linking with external libraries (libcurl, jsoncpp, and the RGB matrix library).

Core Functionality

  • Introduced QueueClient in queue-client.h and queue-client.cpp to handle authentication and design retrieval from a backend API. This includes methods for obtaining a JWT token, fetching designs, and parsing JSON responses. [1] [2]
  • Added display.h and display.cpp to handle rendering of pixel designs onto the RGB matrix. Includes a utility function to convert hex color codes to RGB values and a function to draw designs on the canvas. [1] [2]

Main Program

  • Implemented main.cpp to initialize the RGB matrix, authenticate with the backend, and continuously fetch and display designs in a loop. Includes error handling for failed API calls and matrix initialization.

To: @irsaris @PinkSylvie @Jandel7

This is so you guys can review and see what's going on internally. Please feel free to make any comments or ask questions.

@edimarvalentin edimarvalentin added the enhancement New feature or request label May 3, 2025
@edimarvalentin edimarvalentin self-assigned this May 3, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the first iteration of the RGBoard RGB LED matrix display application that integrates with a queue-based backend for design retrieval.

  • Implements a QueueClient class with JWT authentication, design fetching, and JSON parsing.
  • Adds display functionality to render designs on an RGB matrix.
  • Sets up a main program to initialize the display, perform authentication, and run a continuous design-fetching loop.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rgboard/src/queue-client.cpp Implements QueueClient for JWT based authentication and design retrieval.
rgboard/src/main.cpp Contains the main loop that initializes the matrix and renders designs.
rgboard/src/display.cpp Provides functionality to convert hex color values and draw pixels on the canvas.
rgboard/include/queue-client.h Declares the QueueClient class and its responsibilities.
rgboard/include/display.h Declares the design drawing function for the RGB matrix.
Files not reviewed (1)
  • rgboard/Makefile: Language not supported

std::string response;
Json::Value body;

// Doing this in C++ is crazy, even the IDE is confused.
Copy link

Copilot AI May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider rephrasing or removing this informal comment to maintain a professional tone in the code.

Suggested change
// Doing this in C++ is crazy, even the IDE is confused.
// Constructing a JSON object with email and password fields.

Copilot uses AI. Check for mistakes.
Comment on lines 186 to 190
std::string errs;
std::istringstream ss(raw);

if (!Json::parseFromStream(builder, ss, &parsed, &errs)) {
std::fprintf(stderr, "Failed to parse pixel_data string: %s\n", errs.c_str());
Copy link

Copilot AI May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Avoid redeclaring the 'errs' variable in nested scopes to prevent potential confusion; consider using a distinct name or consolidating error handling.

Suggested change
std::string errs;
std::istringstream ss(raw);
if (!Json::parseFromStream(builder, ss, &parsed, &errs)) {
std::fprintf(stderr, "Failed to parse pixel_data string: %s\n", errs.c_str());
std::string pixel_data_errs;
std::istringstream ss(raw);
if (!Json::parseFromStream(builder, ss, &parsed, &pixel_data_errs)) {
std::fprintf(stderr, "Failed to parse pixel_data string: %s\n", pixel_data_errs.c_str());

Copilot uses AI. Check for mistakes.
@irsaris
Copy link

irsaris commented May 3, 2025

Merge this with my PR code first.

@edimarvalentin
Copy link
Author

Merge this with my PR code first.
@irsaris
I'll review yours today. This is a different repo so it won't merge with anything.

@irsaris
Copy link

irsaris commented May 3, 2025

What I meant was to make sure that it works with the new code, hope that clears up any confusion.

@edimarvalentin
Copy link
Author

What I meant was to make sure that it works with the new code, hope that clears up any confusion.

Ahh ok! I caught up. I'll update you with that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants