부팅 시 가이드빔 패킷 맞도록 수정
This commit is contained in:
@@ -825,7 +825,7 @@ class MainViewModel @Inject constructor(
|
||||
txPacket(READ_WRITE.WRITE, CMD.Q_SWITCH, qSwitch.value)
|
||||
|
||||
// tx Guide Beam Write
|
||||
txPacket(READ_WRITE.WRITE, CMD.GUIDE_BEAM, GuideBeam(value = guideBeam.value.toInt()))
|
||||
txPacket(READ_WRITE.WRITE, CMD.GUIDE_BEAM, GuideBeam(value = getGuideBeamTxValue()))
|
||||
|
||||
// tx DCD_GAS Write (DEFAULT VALUE)
|
||||
txPacket(READ_WRITE.WRITE, CMD.DCD_GAS, dcdGas.value.copy(status = 0x50))
|
||||
@@ -834,6 +834,18 @@ class MainViewModel @Inject constructor(
|
||||
txPacket(READ_WRITE.WRITE, CMD.SPRAY_DCD, sprayDcd.value)
|
||||
}
|
||||
|
||||
// Guide Beam step mapping (0~10)
|
||||
// 0 -> fixed 0
|
||||
// 1~10 -> min~max range in 10 steps (10 -> max)
|
||||
private fun getGuideBeamTxValue(): Int {
|
||||
val step = guideBeam.value.toInt().coerceIn(0, 10)
|
||||
return if (step == 0) {
|
||||
0
|
||||
} else {
|
||||
guideBeamMin.value + ((step - 1) * (guideBeamMax.value - guideBeamMin.value) / 9)
|
||||
}
|
||||
}
|
||||
|
||||
// Example: Emitting an event after a delay
|
||||
fun txPacketLoop() {
|
||||
viewModelScope.launch {
|
||||
|
||||
Reference in New Issue
Block a user