espurna icon indicating copy to clipboard operation
espurna copied to clipboard

V9261F does not parse input as frames

Open mcspr opened this issue 2 years ago • 1 comments

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

mcspr avatar Oct 27 '21 21:10 mcspr

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);
...

Demonic098 avatar Nov 08 '21 11:11 Demonic098