blink fix (#949)
This commit is contained in:
parent
a06331eef1
commit
5f5bdd7294
@ -1,5 +1,4 @@
|
||||
const enum ColorSensorMode {
|
||||
None = 0,
|
||||
//% block="reflected light intensity"
|
||||
ReflectedLightIntensity = 0,
|
||||
//% block="ambient light intensity"
|
||||
@ -59,7 +58,6 @@ namespace sensors {
|
||||
|
||||
constructor(port: number) {
|
||||
super(port)
|
||||
this._setMode(ColorSensorMode.None);
|
||||
this.thresholdDetector = new sensors.ThresholdDetector(this.id());
|
||||
this.calibrating = false;
|
||||
}
|
||||
|
@ -275,21 +275,23 @@ void cUiUpdatePower(void)
|
||||
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
|
||||
let r = 0;
|
||||
for (let i = 0; i < conns.length; ++i) {
|
||||
r = (r << 8 | conns[i]);
|
||||
r = conns[i] + (r << 6) + (r << 16) - r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
let nonActivated = 0;
|
||||
function detectDevices() {
|
||||
//control.dmesg(`detect devices (${nonActivated} na)`)
|
||||
control.dmesg(`detect devices (hash ${hashDevices()})`)
|
||||
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
|
||||
let numChanged = 0;
|
||||
const uartSensors: SensorInfo[] = [];
|
||||
|
||||
for (const sensorInfo of sensorInfos) {
|
||||
const newConn = conns[sensorInfo.port]
|
||||
if (newConn == sensorInfo.connType) {
|
||||
if (newConn == sensorInfo.connType
|
||||
&& sensorInfo.sensor
|
||||
&& sensorInfo.sensor.isActive()) {
|
||||
// control.dmesg(`connection unchanged ${newConn} at ${sensorInfo.port}`)
|
||||
continue;
|
||||
}
|
||||
@ -425,11 +427,11 @@ void cUiUpdatePower(void)
|
||||
constructor(port: number) {
|
||||
super(port)
|
||||
this.mode = 0
|
||||
this.realmode = 0
|
||||
this.realmode = -1
|
||||
}
|
||||
|
||||
_activated() {
|
||||
this.realmode = 0
|
||||
this.realmode = -1
|
||||
this._setMode(this.mode)
|
||||
}
|
||||
|
||||
@ -456,7 +458,7 @@ void cUiUpdatePower(void)
|
||||
|
||||
reset() {
|
||||
if (this.isActive()) uartReset(this._port);
|
||||
this.realmode = 0;
|
||||
this.realmode = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user