You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "DebugOpt.h"
uint8_t DebugOpt::led_flow_cnt = 0;
bool DebugOpt::led_flow_switch = true;
void DebugOpt::DoLEDFlow()
{
if (!led_flow_switch)
return;
switch (led_flow_cnt)
{
case 0:
CoreLED.TurnOn(LED1);
CoreLED.TurnOff(LED2);
CoreLED.TurnOff(LED3);
CoreLED.TurnOff(LED4);
digitalWrite(LED_BUILTIN, HIGH);
break;
case 1:
CoreLED.TurnOff(LED1);
CoreLED.TurnOn(LED2);
CoreLED.TurnOff(LED3);
CoreLED.TurnOff(LED4);
digitalWrite(LED_BUILTIN, LOW);
break;
case 2:
CoreLED.TurnOff(LED1);
CoreLED.TurnOff(LED2);
CoreLED.TurnOn(LED3);
CoreLED.TurnOff(LED4);
digitalWrite(LED_BUILTIN, LOW);
break;
case 3:
CoreLED.TurnOff(LED1);
CoreLED.TurnOff(LED2);
CoreLED.TurnOff(LED3);
CoreLED.TurnOn(LED4);
digitalWrite(LED_BUILTIN, LOW);
break;
}
led_flow_cnt++;
if (led_flow_cnt >= 4)
led_flow_cnt = 0;
delay(15);
}
void DebugOpt::DebugRun()
{
LED.LeftTurnOn();
LED.RightTurnOn();
BEEP.TurnOn();
delay(100);
BEEP.TurnOff();
/*AccurateMotor.RunForward(10);
AccurateMotor.DelayUntilCarStop();
AccurateMotor.RunBackward(10);
AccurateMotor.DelayUntilCarStop();
AccurateMotor.TurnLeft(20);
AccurateMotor.DelayUntilCarStop();
AccurateMotor.TurnRight(20);
AccurateMotor.DelayUntilCarStop();*/
AccurateMotor.TurnRight(180);
AccurateMotor.DelayUntilCarStop();
AccurateMotor.RunForward(10);
AccurateMotor.DelayUntilCarStop();
BEEP.TurnOn();
delay(100);
BEEP.TurnOff();
LED.LeftTurnOff();
LED.RightTurnOff();
}
void DebugOpt::DebugServo()
{
for (int i = -80; i <= 20; i++)
{
OpenMVOpt::Servo_Control(i);
delay(50);
}
OpenMVOpt::Servo_Control(0);
}
void DebugOpt::LEDFlowOn()
{
led_flow_switch = true;
}
void DebugOpt::LEDFlowOff()
{
led_flow_switch = false;
}
void DebugOpt::Road_Gate_Test()
{
BarrierCommand b_cmd;
ZigBeeOperator.SendCommand(b_cmd.CMD_GateDown());
}
void DebugOpt::Speech_Sounds_Ctr()
{
//ExtSRAMInterface.ExMem_Write_Bytes(0x6180, voive_test_buf, 13);
}
void DebugOpt::Speech_Disc()
{
uint8_t sph_id = 0;
/*0为控制语音播报标志物随机播报并开启识别
2-6为指定词条识别具体信息可查看通信协议*/
sph_id = BKRC_Voice.BKRC_Voice_Extern(0);
delay(200);
//Serial.print("识别到的词条ID为");
//Serial.println(sph_id, HEX);
//voice_trm_buf[2] = sph_id;
//ExtSRAMInterface.ExMem_Write_Bytes(0x6008, voice_trm_buf, 8);//上传识别结果至评分终端
}
void DebugOpt::Infrared_Test()
{
//Infrare.Transmition(ir_repo_buf, 6);
}