Commit 54807c1f by gdj

调整参数commanderFlightHeight 2

parent f3564ccc
package com.dji.sample.manage.model.receiver;
import com.dji.sdk.cloudapi.device.OsdDockDrone;
import com.dji.sdk.cloudapi.device.RcLostActionEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Objects;
......@@ -13,12 +12,17 @@ import java.util.Objects;
*/
public class CommanderFlightHeightReceiver extends BasicDeviceProperty {
private static final int HEIGHT_LIMIT_MAX = 1500;
private static final float HEIGHT_LIMIT_MAX = 1500F;
private static final int HEIGHT_LIMIT_MIN = 20;
private static final float HEIGHT_LIMIT_MIN = 20F;
private Float commanderFlightHeight;
@JsonCreator
public CommanderFlightHeightReceiver(Float commanderFlightHeight) {
this.commanderFlightHeight = commanderFlightHeight;
}
@Override
public boolean valid() {
return Objects.nonNull(this.commanderFlightHeight) && this.commanderFlightHeight >= HEIGHT_LIMIT_MIN && this.commanderFlightHeight <= HEIGHT_LIMIT_MAX;
......@@ -26,6 +30,9 @@ public class CommanderFlightHeightReceiver extends BasicDeviceProperty {
@Override
public boolean canPublish(OsdDockDrone osd) {
if (osd.getCommanderFlightHeight() == null) {
return true;
}
return commanderFlightHeight.floatValue() != osd.getCommanderFlightHeight();
}
}
\ No newline at end of file
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