添加飞行时长
This commit is contained in:
parent
c09f7358f1
commit
21702f04d1
|
|
@ -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,
|
||||
Sub_Device_Online_Status,
|
||||
Total_Flight_Sorties,
|
||||
Total_Flight_Time,
|
||||
Drone_Charge_State_State,
|
||||
Drone_In_Dock,
|
||||
Acc_Time,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue