File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/reachy_mini/daemon/backend/robot Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ def decode_hardware_error_byte(err_byte: int) -> list[str]:
513513 err_bits = [i for i in range (8 ) if (err_byte & (1 << i )) != 0 ]
514514 return [bits_to_error [b ] for b in err_bits if b in bits_to_error ]
515515
516- def check_voltage (
516+ def voltage_ok (
517517 id : int ,
518518 allowed_max_voltage : float = 7.3 ,
519519 ) -> bool :
@@ -525,7 +525,7 @@ def check_voltage(
525525 resp = struct .unpack ("h" , bytes (resp_bytes ))[0 ]
526526 voltage : float = resp / 10.0 # in Volts
527527
528- return voltage > allowed_max_voltage
528+ return voltage <= allowed_max_voltage
529529
530530 errors = {}
531531 for name , id in self .c .get_motor_name_id ().items ():
@@ -535,9 +535,12 @@ def check_voltage(
535535 err = decode_hardware_error_byte (err_byte [0 ])
536536 if err :
537537 if "Input Voltage Error" in err :
538- if check_voltage (id ):
538+ if voltage_ok (id ):
539539 err .remove ("Input Voltage Error" )
540- errors [name ] = err
540+
541+ # To avoid logging empty errors like "Motor 1: []"
542+ if len (err ) > 0 :
543+ errors [name ] = err
541544
542545 return errors
543546
You can’t perform that action at this time.
0 commit comments