增加手柄震动功能,右扳机按下时,触发震动,连接时震动,断开时震动,跳跃落地时震动
This commit is contained in:
1 parent
e33a6b894d
commit
0ef2bb0d7f
6 files changed
+439
-251
No files matched your search
@@ -292,10 +292,10 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
|
||||
handleLEDBlink(); // 处理LED闪烁
|
||||
process_xbox_notif(); // 处理xbox手柄通知
|
||||
updateXboxVibration(); // 手柄震动状态
|
||||
|
||||
bat_check(); // 电压检测
|
||||
delayMicroseconds(1500);
|
||||
@@ -485,6 +485,8 @@ void lqr_balance_loop()
|
||||
// Serial.print(",jump_flag:");
|
||||
// Serial.println(jump_flag); // 120左右
|
||||
|
||||
XboxKeyVibration(); // 落地手柄震动
|
||||
|
||||
if( jump_flag ){ // 落地点作为新的位移零点
|
||||
resetZeroPoint();
|
||||
}
|
||||
@@ -709,7 +711,7 @@ void yaw_loop()
|
||||
wrobot.height = lpf_height(wrobot.height);
|
||||
|
||||
// 增加rgb效果
|
||||
if(abs(wrobot.joyx) > 30){
|
||||
if(abs(wrobot.joyx) > 50){
|
||||
if(!isBlinking){ // 防止重复启动闪烁
|
||||
isBlinking = true;
|
||||
blinkCount = 0; // 重置闪烁计数
|
||||
@@ -911,6 +913,11 @@ void processControllerData(const XboxControllerNotificationParser& remoteData) {
|
||||
}
|
||||
last_btnA = remoteData.btnA;
|
||||
|
||||
// trigRT 根据扳机键按压力度调整振动力度
|
||||
if (xboxController.xboxNotif.trigRT > 0) {
|
||||
XboxtrigRTVibration();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 执行连续动作的函数
|
||||
|
||||
Reference in new issue
Block a user