mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-21 02:39:54 -04:00
Only send matrix data if input !== null (#1356)
This commit is contained in:
parent
2af04c43ea
commit
9524db5609
1 changed files with 8 additions and 7 deletions
|
@ -508,13 +508,14 @@ class Scratch3MicroBitBlocks {
|
|||
return value;
|
||||
};
|
||||
const hex = symbol.split('').reduce(reducer, 0);
|
||||
if (!hex) return;
|
||||
this._device.ledMatrixState[0] = hex & 0x1F;
|
||||
this._device.ledMatrixState[1] = (hex >> 5) & 0x1F;
|
||||
this._device.ledMatrixState[2] = (hex >> 10) & 0x1F;
|
||||
this._device.ledMatrixState[3] = (hex >> 15) & 0x1F;
|
||||
this._device.ledMatrixState[4] = (hex >> 20) & 0x1F;
|
||||
this._device.displayMatrix(this._device.ledMatrixState);
|
||||
if (hex !== null) {
|
||||
this._device.ledMatrixState[0] = hex & 0x1F;
|
||||
this._device.ledMatrixState[1] = (hex >> 5) & 0x1F;
|
||||
this._device.ledMatrixState[2] = (hex >> 10) & 0x1F;
|
||||
this._device.ledMatrixState[3] = (hex >> 15) & 0x1F;
|
||||
this._device.ledMatrixState[4] = (hex >> 20) & 0x1F;
|
||||
this._device.displayMatrix(this._device.ledMatrixState);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue