From 6f2d24717d964a2f47f439cdf3dfff6ecb45cbce Mon Sep 17 00:00:00 2001 From: StevenBuzzi Date: Wed, 18 Mar 2026 11:49:07 +0900 Subject: [PATCH] =?UTF-8?q?H/P=20=EC=97=B0=EA=B2=B0=ED=95=A0=20=EB=95=8C?= =?UTF-8?q?=EB=A7=88=EB=8B=A4=20Lifetime=20=EA=B8=B0=EC=A4=80=EA=B0=92?= =?UTF-8?q?=EC=9D=B4=201=EC=94=A9=20=EC=A6=9D=EA=B0=80=ED=95=98=EB=8A=94?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../raman/ui/screens/engineer/LifeTimeView.kt | 2 +- .../raman/ui/screens/main/MainViewModel.kt | 59 ++++--------------- 2 files changed, 11 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/com/laseroptek/raman/ui/screens/engineer/LifeTimeView.kt b/app/src/main/java/com/laseroptek/raman/ui/screens/engineer/LifeTimeView.kt index e45ab1d..1cf935f 100644 --- a/app/src/main/java/com/laseroptek/raman/ui/screens/engineer/LifeTimeView.kt +++ b/app/src/main/java/com/laseroptek/raman/ui/screens/engineer/LifeTimeView.kt @@ -58,7 +58,7 @@ fun LifeTimeView( Spacer(modifier = Modifier.height(2.px.dp)) // Temp 0..7 - for (i in 0..lifeTimeTypes.size -1) { + for (i in 0..lifeTimeTypes.size - 1) { val value = when (i) { 0 -> lifeTime.lamp 1 -> lifeTime.hp5x5 diff --git a/app/src/main/java/com/laseroptek/raman/ui/screens/main/MainViewModel.kt b/app/src/main/java/com/laseroptek/raman/ui/screens/main/MainViewModel.kt index 57d9f45..c51ce68 100644 --- a/app/src/main/java/com/laseroptek/raman/ui/screens/main/MainViewModel.kt +++ b/app/src/main/java/com/laseroptek/raman/ui/screens/main/MainViewModel.kt @@ -1106,7 +1106,7 @@ class MainViewModel @Inject constructor( CMD.LASER_STATUS -> { val l = packet.data.toLaserStatus() setLaserStatus(l.copy()) - // on receuve laser on (or interval) increase count and save to pref. + // on receive laser on (or interval) increase count and save to pref. // Laser On 패킷만 counting 하도록 변경 (2개 패킷 모두 수신 됨) if (_laserStatus.value.laserStatus == LASER_STATUS.LASER_ON /* || l.laserStatus == LASER_STATUS.INTERVAL */) { playBeepSound() @@ -1185,58 +1185,19 @@ class MainViewModel @Inject constructor( setEnergyControl(EnergyControl(0x03, 0x00)) setEnergyMeasured(EnergyMeasured(0x04, 0x00, 0x00)) - // hand piece 별 count 증가 - when (h.type) { - 1 -> { // hp 5x5 - setLifeTime( - _lifeTime.value.copy( - hp5x5 = _lifeTime.value.hp5x5 + 1 - ) - ) - saveLifeTimeToPreference() - Timber.d("_lifeTime (hp5x5): ${_lifeTime}") - } - 2 -> { - setLifeTime( - _lifeTime.value.copy( - hp7x7 = _lifeTime.value.hp7x7 + 1 - ) - ) - saveLifeTimeToPreference() - Timber.d("_lifeTime (hp7x7): ${_lifeTime}") - } - 3 -> { - setLifeTime( - _lifeTime.value.copy( - hp10x10 = _lifeTime.value.hp10x10 + 1 - ) - ) - saveLifeTimeToPreference() - Timber.d("_lifeTime (hp10x10): ${_lifeTime}") - } - 4 -> { - setLifeTime( - _lifeTime.value.copy( - hp12x12 = _lifeTime.value.hp12x12 + 1 - ) - ) - saveLifeTimeToPreference() - Timber.d("_lifeTime (hp12x12): ${_lifeTime}") - } - 5 -> { - setLifeTime( - _lifeTime.value.copy( - hp3x15 = _lifeTime.value.hp3x15 + 1 - ) - ) - saveLifeTimeToPreference() - Timber.d("_lifeTime (hp3x15): ${_lifeTime}") - } + val connectedHandPieceLifeTime = when (h.type) { + 1 -> lifeTime.value.hp5x5 + 2 -> lifeTime.value.hp7x7 + 3 -> lifeTime.value.hp10x10 + 4 -> lifeTime.value.hp12x12 + 5 -> lifeTime.value.hp3x15 else -> { - Timber.d("unknwon hand piece type: ${h.type}") + Timber.d("Unknown Hand-piece type: ${h.type}") return@launch } } + Timber.d("HAND_PIECE lifetime: type=${h.type}, value=${connectedHandPieceLifeTime}, hpCount=${hpCount.value}") + // hand piece가 변경 시점 에서, pref 테이블 값을 -> energyTable 로 로딩 loadFluenceTable(handPiece.value.type) -- 2.47.3