rounding-change

So that there is no difference in uart values, as well as values in the label of the toggle switches.
This commit is contained in:
Dmitriy Antipov 2023-05-13 23:16:37 +03:00
parent 333b487bb6
commit 8e9240ee92

View File

@ -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