Changement des sens pour s'adapter au nouveau câblage
This commit is contained in:
parent
73bfbecb66
commit
0c8053bd97
18
main.c
18
main.c
@ -107,13 +107,15 @@ void affiche_pas_de_temps(){
|
|||||||
printf(">v_actuelle_tr_s:%f\n", v_actuelle_tr_s);
|
printf(">v_actuelle_tr_s:%f\n", v_actuelle_tr_s);
|
||||||
printf(">v_consigne_tr_s:%f\n", v_consigne_tr_s);
|
printf(">v_consigne_tr_s:%f\n", v_consigne_tr_s);
|
||||||
printf(">contacteur_bas:%d\n", contacteur_bas.pos_valide);
|
printf(">contacteur_bas:%d\n", contacteur_bas.pos_valide);
|
||||||
|
printf(">contacteur_ouvret:%d\n", contacteur_ouvert.pos_valide);
|
||||||
|
printf(">contacteur_ferme:%d\n", contacteur_fermé.pos_valide);
|
||||||
printf(">pos_pas:%d\n", pos_pas);
|
printf(">pos_pas:%d\n", pos_pas);
|
||||||
sleep_ms(20);
|
sleep_ms(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pince_ouvre(){
|
void pince_ouvre(){
|
||||||
gpio_put(PIN_CC_DIR, 1);
|
gpio_put(PIN_CC_DIR, 0);
|
||||||
pwm_set_chan_level(1, PWM_CHAN_B, 60000);
|
pwm_set_chan_level(1, PWM_CHAN_B, 60000);
|
||||||
while(contacteur_ouvert.pos_valide){
|
while(contacteur_ouvert.pos_valide){
|
||||||
contacteur_update(&contacteur_ouvert);
|
contacteur_update(&contacteur_ouvert);
|
||||||
@ -121,13 +123,13 @@ void pince_ouvre(){
|
|||||||
pwm_set_chan_level(1, PWM_CHAN_B, 0);
|
pwm_set_chan_level(1, PWM_CHAN_B, 0);
|
||||||
}
|
}
|
||||||
void pince_ferme(){
|
void pince_ferme(){
|
||||||
gpio_put(PIN_CC_DIR, 0);
|
gpio_put(PIN_CC_DIR, 1);
|
||||||
pwm_set_chan_level(1, PWM_CHAN_B, 60000);
|
pwm_set_chan_level(1, PWM_CHAN_B, 60000);
|
||||||
while(contacteur_fermé.pos_valide){
|
while(contacteur_fermé.pos_valide){
|
||||||
contacteur_update(&contacteur_fermé);
|
contacteur_update(&contacteur_fermé);
|
||||||
}
|
}
|
||||||
pwm_set_chan_level(1, PWM_CHAN_B, 30000);
|
//pwm_set_chan_level(1, PWM_CHAN_B, 30000);
|
||||||
sleep_ms(200);
|
//sleep_ms(200);
|
||||||
pwm_set_chan_level(1, PWM_CHAN_B, 0);
|
pwm_set_chan_level(1, PWM_CHAN_B, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +142,7 @@ void pas_a_pas_stop(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pas_a_pas_descend(){
|
void pas_a_pas_descend(){
|
||||||
gpio_put(PIN_DIR, 0);
|
gpio_put(PIN_DIR, 1);
|
||||||
gpio_put(PIN_ENABLE, 0);
|
gpio_put(PIN_ENABLE, 0);
|
||||||
gpio_set_dir(PIN_STEP, GPIO_OUT);
|
gpio_set_dir(PIN_STEP, GPIO_OUT);
|
||||||
v_consigne_tr_s = vitesse_nominale_tr_s;
|
v_consigne_tr_s = vitesse_nominale_tr_s;
|
||||||
@ -148,7 +150,7 @@ void pas_a_pas_descend(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pas_a_pas_monte(){
|
void pas_a_pas_monte(){
|
||||||
gpio_put(PIN_DIR, 1);
|
gpio_put(PIN_DIR, 0);
|
||||||
gpio_put(PIN_ENABLE, 0);
|
gpio_put(PIN_ENABLE, 0);
|
||||||
gpio_set_dir(PIN_STEP, GPIO_OUT);
|
gpio_set_dir(PIN_STEP, GPIO_OUT);
|
||||||
v_consigne_tr_s = vitesse_nominale_tr_s;
|
v_consigne_tr_s = vitesse_nominale_tr_s;
|
||||||
@ -175,7 +177,7 @@ void main(void)
|
|||||||
contacteur_init(PIN_CONTACTEUR_FERMÉ, &contacteur_fermé);
|
contacteur_init(PIN_CONTACTEUR_FERMÉ, &contacteur_fermé);
|
||||||
contacteur_init(PIN_CONTACTEUR_OUVERT, &contacteur_ouvert);
|
contacteur_init(PIN_CONTACTEUR_OUVERT, &contacteur_ouvert);
|
||||||
|
|
||||||
pince_ouvre();
|
|
||||||
|
|
||||||
|
|
||||||
// Pas à pas
|
// Pas à pas
|
||||||
@ -188,7 +190,7 @@ void main(void)
|
|||||||
gpio_put(PIN_ENABLE, 1);
|
gpio_put(PIN_ENABLE, 1);
|
||||||
multicore_launch_core1(affiche_pas_de_temps);
|
multicore_launch_core1(affiche_pas_de_temps);
|
||||||
|
|
||||||
|
pince_ouvre();
|
||||||
|
|
||||||
//sleep_ms(3000);
|
//sleep_ms(3000);
|
||||||
//printf("kartoffen\n");
|
//printf("kartoffen\n");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user