This commit is contained in:
玖叁 2025-01-01 18:58:55 +08:00
parent 91c4500d82
commit b81c903292
2 changed files with 5 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -1,6 +1,7 @@
#include "mode.h"
ModeType Mode::mode = ModeType::MODE_MANUAL_CONTROL;
ModeType Mode::lastMode = ModeType::MODE_MANUAL_CONTROL;
void Mode::processDeviceMode()
{