Commit adf87758 authored by 957dd's avatar 957dd

Merge branch 'feature/modify_0206' into 'master'

修改了水坦克设计冷却,每次射击加入了检测,防止间隔太久还在一个状态,修改了状态机问题 See merge request !89
parents 00fa0103 f146534b
No preview for this file type
......@@ -41,7 +41,7 @@ void device_shot_fire_init(TankFireControl* this) {
this->shooting_start_time = 0;
this->state = TANK_STATE_READY;
this->shot_interval_ms = 1000;
this->shot_duration_ms = 600;
this->shot_duration_ms = 1000;
}else{
this->last_shot_end_time = 0;
this->shooting_start_time = 0;
......@@ -75,6 +75,12 @@ int device_shot_cooling_init(){
int device_fire_check(TankFireControl* this) {
uint64_t current_time = get_current_time_millis(); // 假设已实现此函数
if (current_time - this->last_shot_end_time >= this->shot_interval_ms){
this->state = TANK_STATE_READY;
my_zlog_info("coolend");
return 0; // 冷却完成
}
switch (this->state) {
case TANK_STATE_READY:
if (current_time - this->last_shot_end_time < this->shot_interval_ms) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment