自瞄实时性修复
This commit is contained in:
@@ -208,25 +208,21 @@ bool ArmorFinder::sendBoxPosition(uint16_t shoot_delay) {
|
||||
return true;
|
||||
|
||||
} else if (state == LOST_TARGET_WAIT) {
|
||||
// 等待1秒期间:开启小陀螺旋转索敌
|
||||
// 等待1秒期间:保持静止,不旋转
|
||||
static int wait_count = 0;
|
||||
wait_count++;
|
||||
if (wait_count % 50 == 0) {
|
||||
auto remaining = 1000 - std::chrono::duration_cast<std::chrono::milliseconds>(now - state_start_time).count();
|
||||
LOGM(STR_CTR(WORD_YELLOW, "Pre-search: yaw=150, %dms left"), remaining > 0 ? remaining : 0);
|
||||
LOGM(STR_CTR(WORD_YELLOW, "Waiting... %dms left before search"), remaining > 0 ? remaining : 0);
|
||||
wait_count = 0;
|
||||
}
|
||||
// 等待期间也旋转:yaw=150,pitch 小范围扫描
|
||||
pitch_scan += pitch_direction * 5;
|
||||
if (pitch_scan >= 50) pitch_direction = -1;
|
||||
if (pitch_scan <= -50) pitch_direction = 1;
|
||||
|
||||
updateControl(150, pitch_scan, 0, 3, 2);
|
||||
// 等待期间不旋转,发送0值
|
||||
updateControl(0, 0, 0, 3, 3);
|
||||
return true;
|
||||
|
||||
} else { // SEARCHING
|
||||
// 索敌状态:持续旋转直到找到目标
|
||||
pitch_scan += pitch_direction * 7;
|
||||
// 索敌状态:持续旋转直到找到目标,加快pitch扫描速度
|
||||
pitch_scan += pitch_direction * 15; // 从7加快到15
|
||||
if (pitch_scan >= 200) pitch_direction = -1;
|
||||
if (pitch_scan <= -100) pitch_direction = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user