不允许超出范围的坐标值。
This commit is contained in:
@@ -38,9 +38,9 @@ public:
|
||||
}
|
||||
|
||||
static void set_status(int x, int y, int z, int brightness) {
|
||||
x %= 8;
|
||||
y %= 8;
|
||||
z %= 8;
|
||||
if (x >= 8 || x <= 0 || y >= 8 || y <= 0 || z >= 8 || z <= 0) {
|
||||
return;
|
||||
}
|
||||
brightness %= 4;
|
||||
LED_status[z][x] = (LED_status[z][x] & (~(3 << (y * 2)))) | (brightness << (y * 2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user