Compare commits
3 Commits
feature/IS
...
feature/IS
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5d7187c0f | ||
| 53cd5976bb | |||
|
|
841d9221a6 |
@@ -5,6 +5,7 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -13,15 +14,19 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
import com.laseroptek.raman.const.temperatureTypes
|
import com.laseroptek.raman.const.temperatureTypes
|
||||||
import com.laseroptek.raman.data.model.serial.Temperature
|
import com.laseroptek.raman.data.model.serial.Temperature
|
||||||
|
import com.laseroptek.raman.ui.theme.RobotoTypography
|
||||||
import com.laseroptek.raman.utils.ext.px
|
import com.laseroptek.raman.utils.ext.px
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
@@ -56,7 +61,33 @@ fun TemperatureView(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(10.px.dp))
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 20.px.dp, end = 20.px.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Spacer(modifier = Modifier.weight(1.5f))
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
text = "Read",
|
||||||
|
style = RobotoTypography.labelMedium,
|
||||||
|
fontSize = 12.px.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
textAlign = TextAlign.End
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
text = "Write",
|
||||||
|
style = RobotoTypography.labelMedium,
|
||||||
|
fontSize = 12.px.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
textAlign = TextAlign.End
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(2.px.dp))
|
||||||
|
|
||||||
// Tempearture
|
// Tempearture
|
||||||
for (i in 0..temperatureTypes.size -1) {
|
for (i in 0..temperatureTypes.size -1) {
|
||||||
@@ -116,4 +147,4 @@ fun TemperatureView(
|
|||||||
@Composable
|
@Composable
|
||||||
fun PreviewSerialNumber() {
|
fun PreviewSerialNumber() {
|
||||||
TemperatureView()
|
TemperatureView()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,25 +75,6 @@ fun TwoCountItemView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.weight(1f)
|
|
||||||
.height(30.px.dp),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
|
||||||
horizontalAlignment = Alignment.Start
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
text = "Read",
|
|
||||||
style = RobotoTypography.bodyMedium,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
fontSize = 12.px.sp,
|
|
||||||
color = Color.Black,
|
|
||||||
textAlign = TextAlign.End
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -113,25 +94,6 @@ fun TwoCountItemView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.weight(1f)
|
|
||||||
.height(30.px.dp),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
|
||||||
horizontalAlignment = Alignment.Start
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
text = "Write",
|
|
||||||
style = RobotoTypography.bodyMedium,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
fontSize = 12.px.sp,
|
|
||||||
color = Color.Black,
|
|
||||||
textAlign = TextAlign.End
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
//.noRippleClickable(onClick = onDeviceOpTimeClick)
|
//.noRippleClickable(onClick = onDeviceOpTimeClick)
|
||||||
|
|||||||
@@ -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