From b81c903292c63799799406e66310dc765534eec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=96=E5=8F=81?= Date: Wed, 1 Jan 2025 18:58:55 +0800 Subject: [PATCH] fxi --- src/handlers.cpp | 8 ++++---- src/mode.cpp | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/handlers.cpp b/src/handlers.cpp index a43089a..22d342a 100644 --- a/src/handlers.cpp +++ b/src/handlers.cpp @@ -124,17 +124,17 @@ void Handlers::motorSteerControl(BLECharacteristic &characteristic, uint8_t *pac void Handlers::motorRotateControl(BLECharacteristic &characteristic, uint8_t *packet) { uint8_t direction = packet[3]; - uint8_t time = packet[4]; - Serial.println("CMD_MOTOR_ROTATE_CONTROL, direction: " + String(direction) + ", time: " + String(time)); + uint8_t speed = packet[4]; + Serial.println("CMD_MOTOR_ROTATE_CONTROL, direction: " + String(direction) + ", speed: " + String(speed)); // 顺时针 if (direction == 0x00) { - MotorController::rotate(ROTATE_CLOCKWISE, 255); + MotorController::rotate(ROTATE_CLOCKWISE, speed); } // 逆时针 else if (direction == 0x01) { - MotorController::rotate(ROTATE_ANTICLOCKWISE, 255); + MotorController::rotate(ROTATE_ANTICLOCKWISE, speed); } } diff --git a/src/mode.cpp b/src/mode.cpp index e159781..4b147af 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -1,6 +1,7 @@ #include "mode.h" ModeType Mode::mode = ModeType::MODE_MANUAL_CONTROL; +ModeType Mode::lastMode = ModeType::MODE_MANUAL_CONTROL; void Mode::processDeviceMode() {