Compare commits
1 Commits
feature/IS
...
feature/IS
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5d7187c0f |
@@ -31,7 +31,7 @@ fun HourItemView(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
hour: Int = 0,
|
hour: Int = 0,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
title: String = ""
|
title:String = ""
|
||||||
) {
|
) {
|
||||||
Row(modifier = modifier,
|
Row(modifier = modifier,
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
@@ -129,4 +129,4 @@ fun PreviewHourItemView() {
|
|||||||
title = "Hour Item View"
|
title = "Hour Item View"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ fun LifeTimeView(
|
|||||||
|
|
||||||
// Temp 0..7
|
// Temp 0..7
|
||||||
for (i in 0..lifeTimeTypes.size -1) {
|
for (i in 0..lifeTimeTypes.size -1) {
|
||||||
val value = when (i) {
|
val hour = when (i) {
|
||||||
0 -> lifeTime.lamp
|
0 -> lifeTime.lamp
|
||||||
1 -> lifeTime.hp5x5
|
1 -> lifeTime.hp5x5
|
||||||
2 -> lifeTime.hp7x7
|
2 -> lifeTime.hp7x7
|
||||||
@@ -70,35 +70,22 @@ fun LifeTimeView(
|
|||||||
7 -> lifeTime.water
|
7 -> lifeTime.water
|
||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
val modifier = Modifier
|
HourItemView(
|
||||||
.fillMaxSize()
|
modifier = Modifier
|
||||||
.weight(1f)
|
.fillMaxSize()
|
||||||
.padding(
|
.weight(1f)
|
||||||
start = 20.px.dp,
|
.padding(
|
||||||
end = 20.px.dp,
|
start = 20.px.dp,
|
||||||
//bottom = 10.px.dp
|
end = 20.px.dp,
|
||||||
)
|
//bottom = 10.px.dp
|
||||||
val title = lifeTimeTypes[i]
|
),
|
||||||
val onItemClick = {
|
title = lifeTimeTypes[i],
|
||||||
Timber.d("onClick > Temp $i ($title)")
|
hour = hour,
|
||||||
onClick.invoke(i)
|
onClick = {
|
||||||
}
|
Timber.d("onClick > Temp $i (${lifeTimeTypes[i]})")
|
||||||
|
onClick.invoke(i)
|
||||||
if (i <= 4) {
|
}
|
||||||
CountItemView(
|
)
|
||||||
modifier = modifier,
|
|
||||||
title = title,
|
|
||||||
count = value,
|
|
||||||
onClick = onItemClick
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
HourItemView(
|
|
||||||
modifier = modifier,
|
|
||||||
title = title,
|
|
||||||
hour = value,
|
|
||||||
onClick = onItemClick
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < lifeTimeTypes.size -1) {
|
if (i < lifeTimeTypes.size -1) {
|
||||||
HorizontalDivider(
|
HorizontalDivider(
|
||||||
@@ -121,4 +108,4 @@ fun LifeTimeView(
|
|||||||
@Composable
|
@Composable
|
||||||
fun PreviewLifeTimeView() {
|
fun PreviewLifeTimeView() {
|
||||||
LifeTimeView()
|
LifeTimeView()
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||||
import com.laseroptek.raman.const.LaserParameter
|
import com.laseroptek.raman.const.LaserParameter
|
||||||
|
import com.laseroptek.raman.const.LASER_STATUS
|
||||||
import com.laseroptek.raman.const.LaserStatusType
|
import com.laseroptek.raman.const.LaserStatusType
|
||||||
import com.laseroptek.raman.const.MAX_LASER_COUNT
|
import com.laseroptek.raman.const.MAX_LASER_COUNT
|
||||||
import com.laseroptek.raman.const.PresetButtonType
|
import com.laseroptek.raman.const.PresetButtonType
|
||||||
@@ -92,10 +93,18 @@ fun HomeScreen(
|
|||||||
|
|
||||||
val presetList by mainViewModel.presetList.collectAsState()
|
val presetList by mainViewModel.presetList.collectAsState()
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(lampCount, lifeTime.lamp, laserStatus.laserStatus) {
|
||||||
Timber.d("LaunchedEffect - HomeScreen")
|
Timber.d("LaunchedEffect - HomeScreen")
|
||||||
focusManager.clearFocus(force = true) // Hide the keyboard
|
focusManager.clearFocus(force = true) // Hide the keyboard
|
||||||
|
|
||||||
|
// Ensure the system returns to StandBy when lamp thresholds are exceeded
|
||||||
|
val lampLifetimeLimit = lifeTime.lamp
|
||||||
|
val reachedLifetimeLimit = lampLifetimeLimit > 0 && lampCount >= lampLifetimeLimit
|
||||||
|
if (reachedLifetimeLimit && laserStatus.laserStatus != LASER_STATUS.STAND_BY) {
|
||||||
|
Timber.d("HomeScreen load - forcing StandBy state due to lamp count limit")
|
||||||
|
mainViewModel.txLaserStatusEntry(LASER_STATUS.STAND_BY)
|
||||||
|
}
|
||||||
|
|
||||||
Timber.d("Attempted to hide keyboard on EngineerScreen launch")
|
Timber.d("Attempted to hide keyboard on EngineerScreen launch")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,6 +491,18 @@ fun HomeScreen(
|
|||||||
return@StandByButton
|
return@StandByButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val lampLifetimeLimit = lifeTime.lamp
|
||||||
|
if (lampLifetimeLimit > 0 && lampCount >= lampLifetimeLimit) {
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"Lamp lifetime limit reached",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
return@StandByButton
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val hpCount = mainViewModel.getHPCount()
|
val hpCount = mainViewModel.getHPCount()
|
||||||
if (hpCount < 1) {
|
if (hpCount < 1) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
|
|||||||
Reference in New Issue
Block a user