Skip to content

Commit 8d115c0

Browse files
committed
sns: fixup cse7766 calibration status err
1 parent 766477f commit 8d115c0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

code/espurna/sensors/CSE7766Sensor.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class CSE7766Sensor : public BaseEmonSensor {
195195
}
196196

197197
if ((_data[0] & 0xFC) > 0xF0) {
198-
_error = SENSOR_ERROR_OTHER;
198+
_error = SENSOR_ERROR_VALUE;
199199
#if SENSOR_DEBUG
200200
if (0xF1 == (_data[0] & 0xF1)) DEBUG_MSG_P(PSTR("[SENSOR] CSE7766: Abnormal coefficient storage area\n"));
201201
if (0xF2 == (_data[0] & 0xF2)) DEBUG_MSG_P(PSTR("[SENSOR] CSE7766: Power cycle exceeded range\n"));
@@ -288,9 +288,12 @@ class CSE7766Sensor : public BaseEmonSensor {
288288

289289
uint8_t byte = _serial->read();
290290

291-
// first byte must be 0x55 or 0xF?
291+
// first byte is one one of
292+
// - 0xAA - NOT calibrated
293+
// - 0x55 - calibrated
294+
// - 0xF? - abnormal state
292295
if (0 == _data_index) {
293-
if ((0x55 != byte) && (byte < 0xF0)) {
296+
if ((0xAA != byte) && (0x55 != byte) && (byte < 0xF0)) {
294297
continue;
295298
}
296299

0 commit comments

Comments
 (0)