|
|
@ -3,10 +3,12 @@ package a8k.extui.page.driver; |
|
|
|
import a8k.app.constant.GearBacklashConstant; |
|
|
|
import a8k.app.hardware.driver.HbotDriver; |
|
|
|
import a8k.app.hardware.driver.PipetteCtrlDriver; |
|
|
|
import a8k.app.hardware.type.HbotRegIndex; |
|
|
|
import a8k.app.hardware.type.PipetteRegIndex; |
|
|
|
import a8k.app.type.a8k.Pos2d; |
|
|
|
import a8k.app.type.a8k.Pos3d; |
|
|
|
import a8k.app.type.exception.AppException; |
|
|
|
import a8k.app.utils.ZJsonNode; |
|
|
|
import a8k.extui.mgr.ExtApiPageMgr; |
|
|
|
import a8k.extui.type.ExtApiStatu; |
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
@ -141,6 +143,39 @@ public class HbotCtrlPage { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setReg(HbotRegIndex reg, Integer val) throws AppException { |
|
|
|
hbotDriver.setReg(reg, val); |
|
|
|
} |
|
|
|
|
|
|
|
public Object readAllRegs() throws AppException { |
|
|
|
ZJsonNode node = new ZJsonNode(); |
|
|
|
for (HbotRegIndex regIndex : HbotRegIndex.values()) { |
|
|
|
Integer regVal = hbotDriver.getReg(regIndex); |
|
|
|
log.info("reg {}: {}", regIndex, regVal); |
|
|
|
node.get(regIndex.name()).set(regVal); |
|
|
|
} |
|
|
|
return node.get(); |
|
|
|
} |
|
|
|
|
|
|
|
public Integer readRegNoEx(HbotRegIndex regIndex) { |
|
|
|
try { |
|
|
|
return hbotDriver.getReg(regIndex); |
|
|
|
} catch (AppException e) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void setShift(Integer xshift, Integer yshift) throws AppException { |
|
|
|
hbotDriver.setReg(HbotRegIndex.kreg_xyrobot_shift_x, xshift); |
|
|
|
hbotDriver.setReg(HbotRegIndex.kreg_xyrobot_shift_y, yshift); |
|
|
|
} |
|
|
|
|
|
|
|
public void setIRunIHold(Integer iRun, Integer iHold) throws AppException { |
|
|
|
hbotDriver.setReg(HbotRegIndex.kreg_xyrobot_irun, iRun); |
|
|
|
hbotDriver.setReg(HbotRegIndex.kreg_xyrobot_ihold, iHold); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
public void init() { |
|
|
|
var page = extApiPageMgr.newPage(this); |
|
|
@ -154,18 +189,24 @@ public class HbotCtrlPage { |
|
|
|
page.addFunction("后", this::moveBackward); |
|
|
|
page.addFunction("左", this::moveLeft); |
|
|
|
page.addFunction("右", this::moveRight); |
|
|
|
page.addFunction("移动到", this::moveTo).setParamVal("x", ()->0).setParamVal("y",()-> 0); |
|
|
|
page.addFunction("移动到", this::moveTo).setParamVal("x", () -> 0).setParamVal("y", () -> 0); |
|
|
|
|
|
|
|
page.newGroup("Z轴"); |
|
|
|
page.addFunction("设置Z轴相对移动距离", this::setzMotorMoveByDistance).setParamVal("distance", () -> zMotorMoveByDistance); |
|
|
|
page.addFunction("上", this::zmoveUp); |
|
|
|
page.addFunction("下", this::zmoveDown); |
|
|
|
page.addFunction("移动到", this::zMotorMoveTo).setParamVal("z", ()->0); |
|
|
|
page.addFunction("移动到", this::zMotorMoveTo).setParamVal("z", () -> 0); |
|
|
|
|
|
|
|
page.newGroup("移动到"); |
|
|
|
page.addFunction("移动到", this::measurementMoveTo); |
|
|
|
page.addFunction("移动到", this::measurementMoveTo); |
|
|
|
page.addFunction("移动到", this::measurementMoveTo).setParamVal("x", ()->readPosNoEx().x).setParamVal("y",()-> readPosNoEx().y).setParamVal("z", ()->readPosNoEx().z); |
|
|
|
page.addFunction("移动到", this::measurementMoveTo).setParamVal("x", () -> readPosNoEx().x).setParamVal("y", () -> readPosNoEx().y).setParamVal("z", () -> readPosNoEx().z); |
|
|
|
|
|
|
|
page.newGroup("读写寄存器"); |
|
|
|
page.addFunction("设置偏移", this::setShift).setParamVal("xshift", () -> readRegNoEx(HbotRegIndex.kreg_xyrobot_shift_x)).setParamVal("yshift", () -> readRegNoEx(HbotRegIndex.kreg_xyrobot_shift_y)); |
|
|
|
page.addFunction("读所有寄存器", this::readAllRegs); |
|
|
|
page.addFunction("设置寄存器", this::setReg); |
|
|
|
|
|
|
|
|
|
|
|
extApiPageMgr.addPage(page); |
|
|
|
} |
|
|
|