desc:水印显示不由气体主导,无气体时,也应该显示时间

main
xiaowusky 1 year ago
parent c662b34e94
commit ac3d2b32c5

@ -7,6 +7,7 @@ import com.yinuo.safetywatcher.watcher.port.cmd.CMD
import com.yinuo.safetywatcher.watcher.port.cmd.CMD.Companion.buildSensorRangeCmd import com.yinuo.safetywatcher.watcher.port.cmd.CMD.Companion.buildSensorRangeCmd
import com.yinuo.safetywatcher.watcher.port.cmd.CMD.Companion.buildSwitchSensorCmd import com.yinuo.safetywatcher.watcher.port.cmd.CMD.Companion.buildSwitchSensorCmd
import com.yinuo.safetywatcher.watcher.port.cmd.CalibrationCmd import com.yinuo.safetywatcher.watcher.port.cmd.CalibrationCmd
import org.easydarwin.TxtOverlay
object GasPortUtils { object GasPortUtils {
private const val BAUD_RATE = 9600 private const val BAUD_RATE = 9600
@ -40,6 +41,7 @@ object GasPortUtils {
fun initPort() { fun initPort() {
openPorts() openPorts()
readGasMsg() readGasMsg()
TxtOverlay.startShow(null)
} }
private fun openPorts() { private fun openPorts() {

@ -64,8 +64,10 @@ object TxtOverlay {
private val gasMap = ConcurrentHashMap<String, Gas>() private val gasMap = ConcurrentHashMap<String, Gas>()
// 外部调用,设置待显示水印文字 // 外部调用,设置待显示水印文字
fun startShow(gas: Gas) { fun startShow(gas: Gas?) {
gasMap[gas.gasName] = gas gas?.let {
gasMap[it.gasName] = it
}
if (!looping) { if (!looping) {
looping = true looping = true
GlobalScope.launch(Dispatchers.IO) { GlobalScope.launch(Dispatchers.IO) {

Loading…
Cancel
Save