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
Next Next commit
rounding-change
So that there is no difference in uart values, as well as values in the label of the toggle switches.
  • Loading branch information
THEb0nny committed May 13, 2023
commit 8e9240ee92b96d0fa66b76988facf78ef95f1a98
4 changes: 2 additions & 2 deletions sim/state/uart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ namespace pxsim {
// Actual
const index = 0; //UartOff.Actual + port * 2;
if (!node.isModeReturnArr()) {
const value = Math.floor(node.getValue());
const value = Math.round(node.getValue());
util.map16Bit(data, UartOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index, value);
} else {
const values = node.getValues();
for (let i = 0, offset = 0; i < values.length; i++, offset += 2) {
util.map16Bit(data, UartOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index + offset, Math.floor(values[i]));
util.map16Bit(data, UartOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index + offset, Math.round(values[i]));
}
}
// Status
Expand Down