From 94b2ce4416b4167d7e64f240969234750de857b7 Mon Sep 17 00:00:00 2001 From: unlockable Date: Fri, 8 Sep 2023 17:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=A5=E6=9D=86=E6=8E=A7=E5=88=B6=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 8By8/8By8.ino | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/8By8/8By8.ino b/8By8/8By8.ino index bebdf51..2f734f7 100644 --- a/8By8/8By8.ino +++ b/8By8/8By8.ino @@ -949,6 +949,17 @@ void calculate_and_draw() { waiting_for_command = false; } + if (analogRead(JOYSTICK_VRX) < 50) { + z_offset -= 1; + need_reevaluate = true; + waiting_for_command = false; + } + else if (analogRead(JOYSTICK_VRX) > 974) { + z_offset += 1; + need_reevaluate = true; + waiting_for_command = false; + } + if (abs(SensorReader::acceleration.x) + abs(SensorReader::acceleration.y) + abs(SensorReader::acceleration.z) > @@ -983,9 +994,10 @@ void calculate_and_draw() { Serial.println(SensorReader::angle.z); } - if (abs(SensorReader::angle.x) < 30.0 && - abs(SensorReader::angle.y) < 30.0 && - abs(SensorReader::angle.z - z_ref) < 30.0) { + if (abs(SensorReader::angle.x) < 20.0 && + abs(SensorReader::angle.y) < 20.0 && + abs(SensorReader::angle.z - z_ref) < 20.0 && + analogRead(JOYSTICK_VRX) > 400 && analogRead(JOYSTICK_VRX) < 648) { waiting_for_command = true; Serial.println("Waiting for new command"); } @@ -1035,9 +1047,9 @@ void calculate_and_draw() { // Display origin point Cube::set_status(round(-x_offset), round(-y_offset), - round(-z_offset), 3); + round(z_offset), 3); Cube::set_blinking(round(-x_offset), round(-y_offset), - round(-z_offset)); + round(z_offset)); } } } \ No newline at end of file