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() {