update ENV
This commit is contained in:
+1
-14
@@ -8,20 +8,7 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp32doit-devkit-v1]
|
||||
platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
upload_protocol = esp-prog
|
||||
monitor_speed = 115200
|
||||
build_flags = -DCORE_DEBUG_LEVEL=5
|
||||
lib_deps =
|
||||
https://github.com/someweisguy/esp_dmx
|
||||
https://github.com/madhephaestus/ESP32Encoder
|
||||
pkerspe/ESP-FlexyStepper @ ^1.4.3
|
||||
|
||||
|
||||
[env:PCP-v01a]
|
||||
[env:PCB-v01a]
|
||||
platform = espressif32
|
||||
board = featheresp32
|
||||
; change microcontroller to ESP32M4
|
||||
|
||||
+7
-8
@@ -114,7 +114,7 @@ void loop()
|
||||
receiveDMX(); // reception des données DMX
|
||||
|
||||
// mise à jour de la vitesse du moteur si la valeur DMX a changée
|
||||
if (dataChanged[speed_array])
|
||||
if (dataChanged[speed_array] == true)
|
||||
{
|
||||
dataChanged[speed_array] = false;
|
||||
Serial.printf("dmx speed receive => %ld\n", DMX_data[speed_array]);
|
||||
@@ -127,11 +127,9 @@ void loop()
|
||||
{
|
||||
// stepper.setTargetPositionToStop();
|
||||
dataChanged[pos_array] = false;
|
||||
pos_in_step = map(DMX_data[pos_array], 0, 255, min_steps, max_steps);
|
||||
pos_in_step = map(DMX_data[pos_array], 255, 0, min_steps, max_steps);
|
||||
// pos_map(); // fonction pour convertir la valeur DMX en position
|
||||
stepper.setTargetPositionInSteps(pos_in_step);
|
||||
Serial.printf("acceleration => %ld\n", speed_in_accel);
|
||||
Serial.printf("deceleration => %i\n", speed_in_decel);
|
||||
Serial.printf("dmx pos to step => %ld\n", pos_in_step);
|
||||
DMX_data_old[pos_array] = DMX_data[pos_array];
|
||||
last_dmx_change_pos = millis();
|
||||
}
|
||||
@@ -144,7 +142,8 @@ void loop()
|
||||
Serial.println("!!!!!!!!!!!!! home not reached");
|
||||
Serial.printf("codeur pos => %i\n", codeur_pos);
|
||||
// stepper.setTargetPositionInSteps(min_steps - codeur_pos); // home_steps
|
||||
stepper.setTargetPositionRelativeInSteps(-nb_microstep);
|
||||
int step_add = nb_microstep * 2;
|
||||
stepper.setTargetPositionRelativeInSteps(-step_add);
|
||||
delay(100);
|
||||
}
|
||||
else if (pos_in_step >= max_steps && ConfirmedLimitSwitchState != switch_active && stepper.getDirectionOfMotion() == 0)
|
||||
@@ -152,7 +151,8 @@ void loop()
|
||||
Serial.println("!!!!!!!!!!!!! limit not reached");
|
||||
Serial.printf("codeur pos => %i\n", codeur_pos);
|
||||
// stepper.setTargetPositionInSteps(max_steps + (max_steps - codeur_pos)); // limit_steps
|
||||
stepper.setTargetPositionRelativeInSteps(nb_microstep);
|
||||
int step_add = nb_microstep * 2;
|
||||
stepper.setTargetPositionRelativeInSteps(step_add);
|
||||
delay(100);
|
||||
}
|
||||
else if (abs(codeur_pos - pos_in_step) > 100 && stepper.getDirectionOfMotion() == 0)
|
||||
@@ -163,7 +163,6 @@ void loop()
|
||||
stepper.setTargetPositionInSteps(pos_in_step);
|
||||
}
|
||||
}
|
||||
|
||||
// motor_follower(emergency_stop_loss_step); // fonction pour suivre la position du moteur et la perte de pas
|
||||
emergency_check(); // fonction pour la sécurité si un obstacle est détecté par la perte de pas du moteur
|
||||
limit_check(); // fonction pour la sécurité si un obstacle est détecté par le bouton poussoir
|
||||
|
||||
+10
-6
@@ -1,5 +1,5 @@
|
||||
|
||||
#define nb_microstep 8 // nombre de microstep configuré sur le driver moteur
|
||||
#define nb_microstep 8 // nombre de microstep configuré sur le driver moteur
|
||||
#define STEP_PER_REV_MOTOR 200 // nombre de pas par tour du moteur
|
||||
#define CPR_ENCODER 4000 // nombre de pas par tour du codeur optique
|
||||
/*
|
||||
@@ -23,9 +23,11 @@ Nb SW1 SW2 SW3 SW4
|
||||
*/
|
||||
#define SECOND_PER_REV 2 // nombre de seconde pour faire un tour
|
||||
const int STEP_PER_REV = nb_microstep * STEP_PER_REV_MOTOR; // nombre de pas par tour du moteur
|
||||
const int MIN_SPEED = 0; // vitesse minimum du moteur
|
||||
const int MIN_SPEED = 1; // vitesse minimum du moteur
|
||||
const int MAX_SPEED = ((STEP_PER_REV / 2) / SECOND_PER_REV) * nb_microstep; // vitesse maximum du moteur (1/2 révolution par SECOND_PER_REV seconde)
|
||||
const int SPEED_IN_STEPS_PER_SECOND = MAX_SPEED / 2; // vitesse initiale de déplacement du moteur = 1/2 de la vitesse maximum
|
||||
//const int MAX_SPEED = ((STEP_PER_REV / 2) / SECOND_PER_REV) * nb_microstep; // vitesse maximum du moteur (1/2 révolution par SECOND_PER_REV seconde)
|
||||
|
||||
const int SPEED_IN_STEPS_PER_SECOND = STEP_PER_REV; // vitesse initiale de déplacement du moteur = 1/2 de la vitesse maximum
|
||||
const int ACCELERATION_IN_STEPS_PER_SECOND = nb_microstep * 2; // accélération initiale du moteur
|
||||
const int DECELERATION_IN_STEPS_PER_SECOND = nb_microstep; // décélération initiale du moteur
|
||||
int ACC_DEC_REMOVE_STEP = ACCELERATION_IN_STEPS_PER_SECOND + DECELERATION_IN_STEPS_PER_SECOND; // nombre de pas à enlever à la position pour l'accélération et la décélération ?
|
||||
@@ -40,8 +42,8 @@ const int max_offset = nb_microstep * 5; // max offset pour le potentiomètre de
|
||||
|
||||
volatile unsigned long last_dmx_change_pos;
|
||||
|
||||
volatile int speed_in_accel = MAX_SPEED / 10; // variable pour la vitesse d'acceleration
|
||||
volatile int speed_in_decel = DECELERATION_IN_STEPS_PER_SECOND; // variable pour la vitesse de deceleration
|
||||
volatile int speed_in_accel = MAX_SPEED / 10; // variable pour la vitesse d'acceleration
|
||||
volatile int speed_in_decel = DECELERATION_IN_STEPS_PER_SECOND; // variable pour la vitesse de deceleration
|
||||
|
||||
// fonction
|
||||
void targetPositionReachedCallback(long position); // callback function as the target position is reached
|
||||
@@ -66,8 +68,10 @@ void speed_map() // fonction de mapping de la vitesse du moteur avec accélérat
|
||||
|
||||
void pos_map() // fonction de mapping de la position du moteur
|
||||
{
|
||||
int pos_in_step = map(DMX_data[pos_array], 0, 255, min_steps - home_steps, max_steps + limit_steps);
|
||||
int pos_in_step = map(DMX_data[pos_array], 255, 0, min_steps, max_steps);
|
||||
//int pos_in_step = map(DMX_data[pos_array], 0, 255, min_steps - home_steps, max_steps + limit_steps); // fait dans la fonction limit_check
|
||||
stepper.setTargetPositionInSteps(pos_in_step);
|
||||
Serial.printf("dmx pos to step => %ld\n", pos_in_step);
|
||||
}
|
||||
|
||||
void set_min() // fonction pour position minimum de la plage de déplacement du moteur
|
||||
|
||||
Reference in New Issue
Block a user