@@ -229,7 +229,7 @@ def __init__(self, pdo_node, com_record, map_array):
229229 self ._task = None
230230
231231 def __repr__ (self ) -> str :
232- cob = f"0x{ self .cob_id :X} " if self .cob_id is not None else "Unassigned"
232+ cob = f"0x{ self .cob_id :X} " if self .cob_id else "Unassigned"
233233 return f"<{ type (self ).__qualname__ } { self .name !r} at COB-ID { cob } >"
234234
235235 def __getitem_by_index (self , value ):
@@ -493,7 +493,7 @@ def subscribe(self) -> None:
493493 associated with read() or save(), if the local PDO setup is
494494 known to match what's stored on the node.
495495 """
496- if self .enabled and self .cob_id is not None :
496+ if self .enabled and self .cob_id :
497497 logger .info ("Subscribing to enabled PDO 0x%X on the network" , self .cob_id )
498498 self .pdo_node .network .subscribe (self .cob_id , self .on_message )
499499
@@ -541,7 +541,7 @@ def add_variable(
541541
542542 def transmit (self ) -> None :
543543 """Transmit the message once."""
544- if self .cob_id is None :
544+ if not self .cob_id :
545545 raise ValueError ("A valid COB-ID has not been configured" )
546546 self .pdo_node .network .send_message (self .cob_id , self .data )
547547
@@ -562,7 +562,7 @@ def start(self, period: Optional[float] = None) -> None:
562562
563563 if not self .period :
564564 raise ValueError ("A valid transmission period has not been given" )
565- if self .cob_id is None :
565+ if not self .cob_id :
566566 raise ValueError ("A valid COB-ID has not been configured" )
567567 logger .info ("Starting %s with a period of %s seconds" , self .name , self .period )
568568
@@ -584,7 +584,7 @@ def remote_request(self) -> None:
584584 """Send a remote request for the transmit PDO.
585585 Silently ignore if not allowed.
586586 """
587- if self .enabled and self .rtr_allowed and self .cob_id is not None :
587+ if self .enabled and self .rtr_allowed and self .cob_id :
588588 self .pdo_node .network .send_message (self .cob_id , bytes (), remote = True )
589589
590590 def wait_for_reception (self , timeout : float = 10 ) -> float :
0 commit comments