|
|
|
@ -95,6 +95,7 @@ object GasPortUtils {
|
|
|
|
|
Thread.sleep(READ_MSG_INTERVAL)
|
|
|
|
|
ComMultiPortUtils.sendMsg(PORT_PATH, CMD.SENSOR_5)
|
|
|
|
|
}
|
|
|
|
|
synchronized(toDoCmdList) {
|
|
|
|
|
if (toDoCmdList.isNotEmpty()) {
|
|
|
|
|
toDoCmdList.forEach {
|
|
|
|
|
Thread.sleep(READ_MSG_INTERVAL)
|
|
|
|
@ -103,6 +104,7 @@ object GasPortUtils {
|
|
|
|
|
toDoCmdList.clear()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
e.printStackTrace()
|
|
|
|
|
}
|
|
|
|
@ -113,22 +115,30 @@ object GasPortUtils {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun setSpeed(speed: Int) {
|
|
|
|
|
synchronized(toDoCmdList) {
|
|
|
|
|
toDoCmdList.add(CMD.buildSpeedCmd(speed))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun calibrationSensor(index: Int, value: Int) {
|
|
|
|
|
synchronized(toDoCmdList) {
|
|
|
|
|
if (value == 0) {
|
|
|
|
|
toDoCmdList.add(CalibrationCmd(index, value).buildZeroCmd())
|
|
|
|
|
} else {
|
|
|
|
|
toDoCmdList.add(CalibrationCmd(index, value).buildSPANCmd())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun switchSensor(index: Int, open: Boolean) {
|
|
|
|
|
synchronized(toDoCmdList) {
|
|
|
|
|
toDoCmdList.add(buildSwitchSensorCmd(index, open))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun setSensorMaxRange(index: Int, value: Int) {
|
|
|
|
|
synchronized(toDoCmdList) {
|
|
|
|
|
toDoCmdList.add(buildSensorRangeCmd(index, value))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|