-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add RPI hardware emulator #1765
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
base: master
Are you sure you want to change the base?
Conversation
update fork
Sync fork
Sync with upstream
|
Also I‘m quite unsure how to implement this. I think creating a new implementation is a good idea but should we make the RgbMatrix::Impl virtual so a mocking class can overwrite these methods? |
|
Also are there any emulators for seeing output of the led matrix? Like in the python implementation? |
|
I usually program all outputs against a Canvas implementation. Having said that, doing full animations with wait for sync and stuff is not possible with that. We could consider virtual methods, but given that this might really be a compile-time choice (testing on an animation vs. 'production'), this might be unnecessary overkill. Let me think about this more. Do you have a link to a project where you'd like to use this ? |
|
I'm using this for my led matrix application which has even support for plugins: Repo |
I managed to make my own version using @hzeller's flaschen-taschen, ripping the code from the terminal plotter, and modifying the underlying matrix code. Currently it uses a run-time flag like the other options but would be way better as a compile-time choice imo. It's not the best and is really just a hacked-together thing I did out of need (funnily enough my project that I am using it for is the exact same concept as yours). |
|
Do you happen to have a repo link? |
I do not at the moment. There are some things that are janky and not currently working. For example, there's no compatibility with content-streamer or chains/mappers (I can at least pinpoint where changes need to be made). If you would like I can upload the code as-is if you would like to modify it and improve it. Otherwise, I could take some time to see if I could improve it. |
|
Would be great if you could upload the code. I don't know if I'll be able to fix the missing features but I will try. Alright I looked at the source code and I don't really understand how pixels are stored in bitplanes etc. It would be great if you could take some time! |
|
Okay, I've created a simple emulator, again there is no support for pixel mapping but it is working for my use case! Although the content streamer doesn't work yet as I haven't implemented the |
|
Alright it works on my machine™. There needs to be a lot more of testing and reviewing the code I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this file for now, don't know about the other pull request for CMake
|
Oh damn it seems you already implemented it from scratch by the time I saw this. Just from initial skimming it seems like you went with SDL which is actually nice since it removes the annoyances with the terminal (e.g. scaling).
The bitplane logic is something I don't understand fully as well. For the pixel mapping, another simulator I made using SFML gets around this by creating the window in the rpi-rgb-led-matrix/lib/led-matrix.cc Lines 369 to 403 in d10f518
|
|
Yeah, I just ended up implementing a virtual frame buffer which the emulator update thread can read easily |
|
Oh, didn't mean to push this to this PR, will undo |
|
I should've clarified: I meant if there is a cpp based emulator so outputs of a cpp program can be seen |
|
This looks interesting, but indeed I'm going to leave it to @hzeller then the same code can run on rpi with this lib: |

This will add the ability to mock RPI hardware. Mocking RPI hardware can be especially useful when the project is large and needs a lot of compile time, especially on the slow RPI 3 hardware. Building and debugging the program on a computer can speed up development significantly.