From 1898e37775ba5a1853ccbcd8f858ad08abd4e831 Mon Sep 17 00:00:00 2001 From: unlockable Date: Thu, 24 Aug 2023 18:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E8=B6=85=E5=87=BA?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E7=9A=84=E5=9D=90=E6=A0=87=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 8By8/8By8.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/8By8/8By8.ino b/8By8/8By8.ino index 09df817..ed72e79 100644 --- a/8By8/8By8.ino +++ b/8By8/8By8.ino @@ -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)); }