添加飞行时长

This commit is contained in:
孙小云 2026-01-21 19:21:20 +08:00
parent c09f7358f1
commit 21702f04d1
2 changed files with 27 additions and 0 deletions

View File

@ -443,6 +443,21 @@ public class DeviceTelemetry {
} }
); );
/**
* 总飞行时长单位
*/
public static final TelemetryKey<Integer> Total_Flight_Time = TelemetryKey.of(
"total_flight_time",
Integer.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).intValue();
}
return Integer.parseInt(value.toString());
}
);
/** /**
@ -470,6 +485,7 @@ public class DeviceTelemetry {
FlightTask_Step_Code, FlightTask_Step_Code,
Sub_Device_Online_Status, Sub_Device_Online_Status,
Total_Flight_Sorties, Total_Flight_Sorties,
Total_Flight_Time,
Drone_Charge_State_State, Drone_Charge_State_State,
Drone_In_Dock, Drone_In_Dock,
Acc_Time, Acc_Time,

View File

@ -190,6 +190,17 @@ public class BufferDeviceImpl implements IBufferDeviceService
} }
}); });
// 飞行时长 - total_flight_time 获取秒数并转换为天
telemetryMap.get(DeviceTelemetry.Total_Flight_Time)
.ifPresent(telemetryValue -> {
Integer seconds = telemetryValue.getValue();
if (seconds != null) {
// 将秒转换为天 / (60 * 60 * 24)
Integer days = seconds / (60 * 60 * 24);
dto.setFlightDuration(days);
}
});
return dto; return dto;
} }