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

RGB raw color sensor simulator support #1023

Merged
merged 8 commits into from
May 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
sim-color-mode-set-defl-val
Prior to this, the color mode was not taken into account. It turns out that the initial value is 50. There is no such index in the array. showPorts didn't output anything for this sensor initially until you chose some color yourself in the simulator. If you look at what the value is there, then 50 is displayed. Therefore, I made the default value 0 - nothing.
  • Loading branch information
THEb0nny committed May 14, 2023
commit 4b0f13315585a26589a8e698c6475ee8f3254092
4 changes: 4 additions & 0 deletions sim/state/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ namespace pxsim {
this.color = 0;
this.colors = [128, 128, 128];
this.modeReturnArr = true;
} else if (this.mode == ColorSensorMode.Colors) {
this.color = 0; // None defl color
this.colors = [0, 0, 0];
this.modeReturnArr = false;
} else { // Reflection or ambiend light
this.color = 50;
this.colors = [0, 0, 0];
Expand Down