Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 16 implementation. #63

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

ErikBock
Copy link

Implementation of task 16 by group 1 (Erik and Daniel).

Description: Add to libSMCE the ability to draw on an output screenbuffer, and add to the frontend a display screen component.

Comment on lines +11 to +12
#include <FramebufferAccess.h>
#include "SMCE_dll.hpp"
Copy link
Collaborator

@RuthgerD RuthgerD Nov 25, 2021

Choose a reason for hiding this comment

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

ideally these shoudnt go in the public header to avoid leaking stuff we dont want the user to stumble upon.
you can forward declare FramebufferAccess in the header and then store it as a pointer or unique_ptr. this way the definition is hidden

Copy link
Member

Choose a reason for hiding this comment

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

(And the class name should be prefixed with SMCE__ so as to not conflict with user-defined identifiers)

class RGBMatrixClass : public ArduinoGraphics {
private:
FramebufferAccess framebufferAccessor;
std::byte buf[(BITS_PER_PIXEL * RGB_MATRIX_HEIGHT * RGB_MATRIX_WIDTH) / CHAR_BIT];
Copy link
Collaborator

Choose a reason for hiding this comment

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

std::byte is relatively new, use uint8_t instead to be more compatible

Comment on lines +94 to +96
func visualize_content() -> Array:
var text = " Resolution: %dx%d" % [resolution.x, resolution.y]
return [texture, aspect_ratio, text]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since ScreenBufferVisualizer is very specific this method is not needed and can be put inside the visualizer class

Copy link
Contributor

@danielolssonIT danielolssonIT Nov 25, 2021

Choose a reason for hiding this comment

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

Should we put setters in ScreenBufferVisualizer and set the texture, aspect_ratio, and text value from the ScreenBuffer's _physics_process() method instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't ScreenBufferVisualizer already take self ? it can just directly access the fields here

Comment on lines +26 to +27
var viewport: Viewport = Viewport.new()
var viewport_container: ViewportContainer = ViewportContainer.new()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we using a viewport here?

export var display_height = 0.2
var resolution = Vector2(0, 0) # Base resolution (for MKRRGBMAtrix)
var image_buf = null
var fps = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

should probably be 0

Comment on lines +1 to +4
//
// Created by danie on 2021-11-02.
//

Copy link
Collaborator

Choose a reason for hiding this comment

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

can remove just this

Comment on lines +14 to +18
#define RGB_MATRIX_WIDTH 640
#define RGB_MATRIX_HEIGHT 480
#define PIXEL_FORMAT SMCE_Pixel_Format::RGB888
#define BITS_PER_PIXEL 24
#define FPS 60
Copy link
Member

Choose a reason for hiding this comment

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

I doubt all of these are part of the MKRRGB API. If not, they should either be deleted, or prefixed with SMCE__

"library_patches" / "smartcar_shield")
.generic_string(),
.defaults = smce::PluginManifest::Defaults::arduino}}}};
std::vector<std::string> dep = {"ArduinoGraphics"};
Copy link
Member

Choose a reason for hiding this comment

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

What has this vector done to you for you to copy it it and thus exclude it from being directly initialized where it's used?

Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember correctly, we got a "C1001: Internal compiler error" when using .depends = {"ArduinoGraphics"} directly, and this was just a quick fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants