Skip to content

Commit 20e1cfe

Browse files
committed
fix: some inutile stuf and move and renome another
1 parent 6dc82f1 commit 20e1cfe

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/HL/actionneur_capteur/masterI2C.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ def __init__(self,serveur):
2121
self.bus = smbus.SMBus(1) # 1 indicates /dev/i2c-1
2222
self.log.info("I2C: bus ouvert sur /dev/i2c-1")
2323

24-
time.sleep(0.5) # Give some time for the bus to settle
24+
2525

2626
#initialization of i2c send and received
2727
threading.Thread(target=self.start_send, daemon=True).start()
2828
threading.Thread(target=self.start_received, daemon=True).start()
2929

3030
def start_send(self):
3131
"""Envoie vitesse/direction régulièrement au microcontroleur. (toute les frames actuellement)"""
32+
time.sleep(1) # Give some time for the target_speed and direction to be set
3233
self.log.info("Thread I2C loop démarré")
3334
while self.send_running:
3435
try :
35-
data = struct.pack('<ff', float(round(self.serveur.target_speed)), float(round(self.serveur.direction)))
36+
data = struct.pack('<ff', float(self.serveur.target_speed), float(self.serveur.direction))
3637
self.bus.write_i2c_block_data(SLAVE_ADDRESS, 0, list(data))
3738
time.sleep(1e-5) # Short delay to prevent overwhelming the bus
3839
except Exception as e:

0 commit comments

Comments
 (0)