better flow
This commit is contained in:
parent
88767e37fd
commit
fb4a0c2e16
@ -279,8 +279,11 @@ void cUiUpdatePower(void)
|
|||||||
|
|
||||||
if (newConn == DAL.CONN_INPUT_UART) {
|
if (newConn == DAL.CONN_INPUT_UART) {
|
||||||
control.dmesg(`new UART connection at ${sensorInfo.port}`)
|
control.dmesg(`new UART connection at ${sensorInfo.port}`)
|
||||||
if (!devcon) devcon = output.createBuffer(DevConOff.Size)
|
const status = getUartStatus(sensorInfo.port);
|
||||||
updateUartMode(devcon, sensorInfo.port, 0);
|
if (status & UART_PORT_CHANGED) {
|
||||||
|
if (!devcon) devcon = output.createBuffer(DevConOff.Size)
|
||||||
|
updateUartMode(devcon, sensorInfo.port, 0);
|
||||||
|
}
|
||||||
} else if (newConn == DAL.CONN_NXT_IIC) {
|
} else if (newConn == DAL.CONN_NXT_IIC) {
|
||||||
control.dmesg(`new IIC connection at ${sensorInfo.port}`)
|
control.dmesg(`new IIC connection at ${sensorInfo.port}`)
|
||||||
sensorInfo.devType = DAL.DEVICE_TYPE_IIC_UNKNOWN
|
sensorInfo.devType = DAL.DEVICE_TYPE_IIC_UNKNOWN
|
||||||
@ -301,13 +304,13 @@ void cUiUpdatePower(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (devcon) {
|
if (devcon)
|
||||||
setUartModes(devcon);
|
setUartModes(devcon);
|
||||||
for (const sensorInfo of sensorInfos.filter(si => si.connType == DAL.CONN_INPUT_UART)) {
|
|
||||||
const uinfo = readUartInfo(sensorInfo.port, devcon[DevConOff.Mode + sensorInfo.port]);
|
for (const sensorInfo of sensorInfos.filter(si => si.connType == DAL.CONN_INPUT_UART && si.devType == DAL.CONN_NONE)) {
|
||||||
sensorInfo.devType = uinfo[TypesOff.Type];
|
const uinfo = readUartInfo(sensorInfo.port, 0);
|
||||||
control.dmesg(`UART type ${sensorInfo.devType}`)
|
sensorInfo.devType = uinfo[TypesOff.Type];
|
||||||
}
|
control.dmesg(`UART type ${sensorInfo.devType}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign sensors
|
// assign sensors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user