fix dot
This commit is contained in:
parent
8844559987
commit
1acb304e48
@ -1,4 +1,7 @@
|
|||||||
namespace sensors.internal {
|
namespace sensors.internal {
|
||||||
|
const UART_PORT_CHANGED = 1
|
||||||
|
const UART_DATA_READY = 8
|
||||||
|
|
||||||
export class Poller {
|
export class Poller {
|
||||||
private query: () => number;
|
private query: () => number;
|
||||||
private update: (previous: number, current: number) => void;
|
private update: (previous: number, current: number) => void;
|
||||||
@ -130,19 +133,6 @@ namespace sensors.internal {
|
|||||||
return sensorInfos.filter(si => si.sensor && si.sensor.isActive()).map(si => si.sensor);
|
return sensorInfos.filter(si => si.sensor && si.sensor.isActive()).map(si => si.sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function will return a meaningful result only when stats & CHANGED
|
|
||||||
// it is cleared afterwards
|
|
||||||
function readUartInfo(port: number, mode: number) {
|
|
||||||
const buf = output.createBuffer(UartCtlOff.Size)
|
|
||||||
buf[UartCtlOff.Port] = port
|
|
||||||
buf[UartCtlOff.Mode] = mode
|
|
||||||
uartMM.ioctl(IO.UART_READ_MODE_INFO, buf)
|
|
||||||
control.dmesg(`UART_READ_MODE ${buf.toHex()}`)
|
|
||||||
return buf
|
|
||||||
//let info = `t:${buf[TypesOff.Type]} c:${buf[TypesOff.Connection]} m:${buf[TypesOff.Mode]} n:${buf.slice(0, 12).toHex()}`
|
|
||||||
//serial.writeLine("UART " + port + " / " + mode + " - " + info)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function readIICID(port: number) {
|
export function readIICID(port: number) {
|
||||||
const buf = output.createBuffer(IICStr.Size)
|
const buf = output.createBuffer(IICStr.Size)
|
||||||
buf[IICStr.Port] = port
|
buf[IICStr.Port] = port
|
||||||
@ -316,13 +306,11 @@ void cUiUpdatePower(void)
|
|||||||
setUartModes(devcon);
|
setUartModes(devcon);
|
||||||
for (const sensorInfo of sensorInfos.filter(si => si.connType == DAL.CONN_INPUT_UART)) {
|
for (const sensorInfo of sensorInfos.filter(si => si.connType == DAL.CONN_INPUT_UART)) {
|
||||||
const uinfo = readUartInfo(sensorInfo.port, 0);
|
const uinfo = readUartInfo(sensorInfo.port, 0);
|
||||||
if (uinfo[TypesOff.Name]) { // the device info has data
|
|
||||||
sensorInfo.devType = uinfo[TypesOff.Type]
|
sensorInfo.devType = uinfo[TypesOff.Type]
|
||||||
const mode = uinfo[TypesOff.Mode];
|
const mode = uinfo[TypesOff.Mode];
|
||||||
control.dmesg(`UART type ${sensorInfo.devType} mode ${mode}`)
|
control.dmesg(`UART type ${sensorInfo.devType} mode ${mode}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// assign sensors
|
// assign sensors
|
||||||
for (const sensorInfo of sensorInfos.filter(si => !si.sensor)) {
|
for (const sensorInfo of sensorInfos.filter(si => !si.sensor)) {
|
||||||
@ -352,6 +340,18 @@ void cUiUpdatePower(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this function will return a meaningful result only when stats & CHANGED
|
||||||
|
// it is cleared afterwards
|
||||||
|
function readUartInfo(port: number, mode: number) {
|
||||||
|
const buf = output.createBuffer(UartCtlOff.Size)
|
||||||
|
buf[UartCtlOff.Port] = port
|
||||||
|
buf[UartCtlOff.Mode] = mode
|
||||||
|
uartMM.ioctl(IO.UART_READ_MODE_INFO, buf)
|
||||||
|
control.dmesg(`UART_READ_MODE ${buf.toHex()}`)
|
||||||
|
control.dmesg(`t:${buf[TypesOff.Type]} c:${buf[TypesOff.Connection]} m:${buf[TypesOff.Mode]} n:${buf.slice(0, 12).toHex()}`);
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
export class Sensor extends control.Component {
|
export class Sensor extends control.Component {
|
||||||
protected _port: number // this is 0-based
|
protected _port: number // this is 0-based
|
||||||
|
|
||||||
@ -577,9 +577,8 @@ void cUiUpdatePower(void)
|
|||||||
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Mode + port, mode)
|
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Mode + port, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
const UART_PORT_CHANGED = 1
|
|
||||||
const UART_DATA_READY = 8
|
|
||||||
function setUartMode(port: number, mode: number) {
|
function setUartMode(port: number, mode: number) {
|
||||||
|
control.dmesg(`UART set mode ${mode} at ${port}`);
|
||||||
while (true) {
|
while (true) {
|
||||||
const devcon = output.createBuffer(DevConOff.Size)
|
const devcon = output.createBuffer(DevConOff.Size)
|
||||||
updateUartMode(devcon, port, mode);
|
updateUartMode(devcon, port, mode);
|
||||||
|
@ -146,10 +146,6 @@ namespace brick {
|
|||||||
|
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
|
||||||
screen.setPixel(w - 1, blink, 1);
|
|
||||||
screen.setPixel(w - 1, blink, 1);
|
|
||||||
screen.setPixel(w - 2, blink + 1, 1);
|
|
||||||
screen.setPixel(w - 2, blink + 1, 1);
|
|
||||||
for (let i = 0; i < 4; ++i) {
|
for (let i = 0; i < 4; ++i) {
|
||||||
const x = i * col + 2;
|
const x = i * col + 2;
|
||||||
screen.print("ABCD"[i], x, 1 * lineHeight8, 1, image.font8)
|
screen.print("ABCD"[i], x, 1 * lineHeight8, 1, image.font8)
|
||||||
@ -186,6 +182,12 @@ namespace brick {
|
|||||||
if (inf)
|
if (inf)
|
||||||
screen.print(inf, x, h - 2 * lineHeight8, 1, inf.length > 4 ? image.font5 : image.font8);
|
screen.print(inf, x, h - 2 * lineHeight8, 1, inf.length > 4 ? image.font5 : image.font8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// alive dot
|
||||||
|
screen.setPixel(w - 1, blink, 1);
|
||||||
|
screen.setPixel(w - 1, blink - 1, 1);
|
||||||
|
screen.setPixel(w - 2, blink - 1, 1);
|
||||||
|
screen.setPixel(w - 2, blink, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showBoot() {
|
export function showBoot() {
|
||||||
|
Loading…
Reference in New Issue
Block a user