espurna
espurna copied to clipboard
V9261F does not parse input as frames
ref. https://gitter.im/tinkerman-cat/espurna?at=6179749a2197144e848e48d6
Current parser assumes certain properties of the data, like size and timing, but does not actually try to parse & validate it besides doing the checksum after receiving the largest payload https://github.com/xoseperez/espurna/blob/c95ea71c188f66dc396f482c472d2a3578459066/code/espurna/sensors/V9261FSensor.h#L132-L248 And the sensor code does not seem to always properly split the available data, causing the checksum to fail and thus end up in an error state forever.
Parsing the data as a frame would certainly help out http://www.vangotech.com/uploadpic/151321699962.pdf Using correct serial mode, too - Arduino's 8O1 seem to match the required properties
Also ref. original implementation notes https://tinkerman.cat/post/connected-power-meter Since in case of the sensor code, we deal with an external chip communicating with the sensor and we just listen in
With SoftwareSerial latest version (6.14.1) and following serial init everything works fine.
void begin() {
if (!_dirty) return;
if (_serial) delete _serial;
_serial = new SoftwareSerial(_pin_rx, -1, _inverted);
_serial->enableIntTx(false);
_serial->enableRxGPIOPullup(false);
_serial->begin(V9261F_BAUDRATE, SWSERIAL_8O1);
...