Open zalexua opened 2 years ago
proof on more way
# python
Python 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> v=0
>>> v = v or print(v);
0
>>> v=3
>>> v = v or print(v);
>>>
Hmm that's unfortunate, I am undecided if I should go back to the double line approach
if _v_out is None:
_v_out = self.read(R.V_OUT)
or replace or
with if not None else
, which turns
_v_out = _v_out or self.read(R.V_OUT)
into
_v_out = _v_out if not None else self.read(R.V_OUT)
It would reduce line count, but it's less readable
I actually already switched to 2-lines style already in my local branch, fixed all places already. Should do a pull request soon, with some other additions.So, you could just wait, if that approach will be acceptable by you.
Add debug (2ndline) to this function:
observe this output when running "riden" (power output if OFF):
while we should expect only these, for calls "init" and "update":
As a proof, when I turn power output ON (which is R.V_OUT), then "reg: 10: len: 1" line is not printed.
those single registers reading happened for registers which have 0 (zero) as current value. so construction:
works incorrectly when function input value is set to 0 (zero). While approach used before refactoring works correctly: