Skip to content

Commit 9047aa5

Browse files
committed
Fix analog inputs for Sequent Home Automation v4
Analog voltage reading is at register 0x18 (int 24) according to the libioplus python library. Fix typo reg -> register so that the register is read properly.
1 parent ff615e3 commit 9047aa5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

i2c-bus/SequentIO.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ export class SequentHomeAuto extends SequentIO {
20732073
gpioDir: { reg: 0x07, name: 'GPIO_DIR', desc: 'GPIO Direction', r: true, w: false },
20742074

20752075
analogValue: { reg: 0x08, name: 'ADC_RAW', desc: 'Analog Raw', r: true, w: false, size: 16 },
2076-
analogVoltage: { reg: 0x1E, name: 'ADC_MV', desc: 'Analog Millivolts', r: true, w: false, size: 16 },
2076+
analogVoltage: { reg: 0x18, name: 'ADC_MV', desc: 'Analog Millivolts', r: true, w: false, size: 16 },
20772077
dacValue: { reg: 0x34, name: 'DAC_VAL', desc: 'DAC Value', r: true, w: false, size: 8 },
20782078
pwmValue: { reg: 0x3C, name: 'PWM_VAL', desc: 'PWM Value', r: true, w: false, size: 8 },
20792079
risingEdge: { reg: 0x3D, name: 'RISING_EDGE', desc: 'Rising Edge Enable', r: true, w: true },
@@ -2397,11 +2397,11 @@ export class SequentHomeAuto extends SequentIO {
23972397
let input = this.inAnalog[i];
23982398
if (this.inAnalog[i].enabled) {
23992399
// Read the registers.
2400-
let volts = (this.i2c.isMock) ? 3.3 * Math.random() : await this.readWord(regV.reg + (i * 2)) / 1000;
2400+
let volts = (this.i2c.isMock) ? 3.3 * Math.random() : await this.readWord(regV.register + (i * 2)) / 1000;
24012401
if (volts !== input.value) changed = true;
24022402
if (changed) {
24032403
input.value = volts;
2404-
input.raw = (this.i2c.isMock) ? Math.round((1 << 12) * (volts / 3.3)) : await this.readWord(regR.reg + (i * 2));
2404+
input.raw = (this.i2c.isMock) ? Math.round((1 << 12) * (volts / 3.3)) : await this.readWord(regR.register + (i * 2));
24052405
webApp.emitToClients('i2cDataValues', { bus: this.i2c.busNumber, address: this.device.address, values: { inputs: { inAnalog: [input] } } });
24062406
}
24072407
}

0 commit comments

Comments
 (0)