Open dilyanpalauzov opened 2 years ago
HI @dilyanpalauzov is there any chance you could add all your fixes and improvements as one PR and i'll approve it.
Unfortunately I don't have an inverter to test on anymore (Am getting another one soon - the last one died (again)) so if anyone else is also able to test that would be appreciated.
Cheers,
When many inverter_poller at the same time send commands, the result is undefined.
This locks exclusively the configuration file, while the process is running, so that simultaneous instances have to wait until the file is released.
For some reason locking the device /dev/hidraw0 does not work for me, I get sometimes the output from previous runs. I suspect that when
cInverter::query()
does exceed the 2s timeout, it quits, and leaves the response of its commands on the wire. For fd = /dev/hidraw0:tcflush(fd, TCOFLUSH);
has no effect.As a matter of fact, on my system I have increased the timeout in
cInverter::query()
to 15s and now it does always work correctly.Also the program, when called with -1, could exit, while the thread is receiving data, this leaves the next invocation with some ready-data, which it is not expecting.