From 13098e9112df658f95a11aea19f8f6367dc534f7 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 16 Aug 2025 12:55:29 +0200 Subject: [PATCH] =?UTF-8?q?Avec=20but=C3=A9es=20logicielles=20,=20pas=20de?= =?UTF-8?q?=20multitour=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b0cebb2..0b56fc3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -98,14 +98,14 @@ enum etat_t test_ping() } enum etat_t configure_servomoteur(){ - sms_sts.ServoMode(SERVO_ID); + sms_sts.writeByte(SERVO_ID, SMS_STS_MODE, 3); sms_sts.writeByte(SERVO_ID, 0x09, 0); // Butée min à 0 sms_sts.writeByte(SERVO_ID, 0x0A, 0); // Butée min à 0 - sms_sts.writeByte(SERVO_ID, 0x0B, 0); // Buté max à 0, pour activer le multitour - sms_sts.writeByte(SERVO_ID, 0x0C, 0); // Buté max à 0, pour activer le multitour + sms_sts.writeByte(SERVO_ID, 4095 & 0xFF, 0); // Buté max à 4095 + sms_sts.writeByte(SERVO_ID, (4095>>8) & 0xFF, 0); // Buté max à 4095 - sms_sts.writeByte(SERVO_ID, 0x1E, 3); - sms_sts.writeByte(SERVO_ID, 0x12, 0x7C); // Registre de "Phase", valeur par défaut 108 (0x6C) + sms_sts.writeByte(SERVO_ID, 0x1E, 1); + sms_sts.writeByte(SERVO_ID, 0x12, 0x6C); // Registre de "Phase", valeur par défaut 108 (0x6C) return TERMINE; @@ -123,11 +123,12 @@ enum etat_t mouvement_servomoteur(){ temps_pas_ms = millis(); // On avance ou recule de d'un pas position += pas_servo; + sms_sts.WritePosEx(SERVO_ID, pas_servo, 4800); // si position > 5000 ou position < 0 if(position > 40100 || position < 0){ pas_servo = -pas_servo; } - sms_sts.WritePosEx(SERVO_ID, position, 4800); + } if(millis() - temps_aff_ms > 10 ){ @@ -145,7 +146,7 @@ enum etat_t mouvement_servomoteur(){ } int lire_registre(int servo_id, int registre_adresse){ - return sms_sts.readByte(servo_id, registre_adresse); + return sms_sts.readByte(servo_id, registre_adresse); // Resolution à 1 } void lire_tous_les_registres(int servo_id){