|
|
|
|
@@ -36,6 +36,7 @@
|
|
|
|
|
typedef enum{
|
|
|
|
|
bzoff,
|
|
|
|
|
bzmoving,
|
|
|
|
|
bzwarning,
|
|
|
|
|
}stBuz_st;
|
|
|
|
|
/* USER CODE END PTD */
|
|
|
|
|
|
|
|
|
|
@@ -109,6 +110,7 @@ uint16_t t3ch;
|
|
|
|
|
uint16_t t4ch;
|
|
|
|
|
uint16_t twch;
|
|
|
|
|
uint16_t tramp;
|
|
|
|
|
uint16_t tramp1;
|
|
|
|
|
uint16_t trampman;
|
|
|
|
|
uint16_t m1pwmMan;
|
|
|
|
|
uint16_t m2pwmMan;
|
|
|
|
|
@@ -171,6 +173,8 @@ void HAL_SYSTICK_Callback(void){
|
|
|
|
|
//**** gestione buzzer *****************************************************************************
|
|
|
|
|
if(stBuz==bzmoving){
|
|
|
|
|
if(c1s>=5)HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_RESET);else HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_SET);
|
|
|
|
|
}else if(stBuz==bzwarning){
|
|
|
|
|
if(c1s&2)HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_RESET);else HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_SET);
|
|
|
|
|
}else{//bzoff
|
|
|
|
|
HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_RESET);
|
|
|
|
|
}
|
|
|
|
|
@@ -201,7 +205,7 @@ void managePulsanti(void){
|
|
|
|
|
else if(rtP2<=190)stPulsanti|=P2STOP;
|
|
|
|
|
rtP2=200;
|
|
|
|
|
}
|
|
|
|
|
stPulsanti&=(!(M1FW|M1BW|M3FW|M3BW|M4FW|M4BW));
|
|
|
|
|
stPulsanti&=(P1START|P1STOP|P2START|P2STOP);
|
|
|
|
|
if(stPulsanti==0){
|
|
|
|
|
switch(pulsanti&0x3c){
|
|
|
|
|
case 0x00:
|
|
|
|
|
@@ -239,43 +243,43 @@ void manageCiclo(void){
|
|
|
|
|
switch(stCiclo){
|
|
|
|
|
case omchiuso:
|
|
|
|
|
if(stPulsanti&P1START){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M2,BW,mrampstart[M2-1],m2pwmap,tramp,RAMPINIT);
|
|
|
|
|
stCiclo=omapertura1;
|
|
|
|
|
stBuz=bzwarning;
|
|
|
|
|
rtCiclo=3;
|
|
|
|
|
stCiclo=omapertura0;
|
|
|
|
|
}else if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
|
|
|
|
else if(stPulsanti&M1FW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M1,FW,mrampstart[M1-1],m1pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM1fw1;
|
|
|
|
|
}else if(stPulsanti&M1BW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M1,BW,mrampstart[M1-1],m1pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM1bw1;
|
|
|
|
|
}else if(stPulsanti&M2FW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M2,FW,mrampstart[M2-1],m2pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM2fw1;
|
|
|
|
|
}else if(stPulsanti&M2BW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M2,BW,mrampstart[M2-1],m2pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM2bw1;
|
|
|
|
|
}else if(stPulsanti&M3FW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M3,FW,mrampstart[M3-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM3fw1;
|
|
|
|
|
}else if(stPulsanti&M3BW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M3,BW,mrampstart[M3-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM3bw1;
|
|
|
|
|
}else if(stPulsanti&M4FW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M4,FW,mrampstart[M4-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM4fw1;
|
|
|
|
|
}else if(stPulsanti&M4BW){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M4,BW,mrampstart[M4-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
stCiclo=omM4bw1;
|
|
|
|
|
}
|
|
|
|
|
// else if(stPulsanti&M1FW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M1,FW,mrampstart[M1-1],m1pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM1fw1;
|
|
|
|
|
// }else if(stPulsanti&M1BW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M1,BW,mrampstart[M1-1],m1pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM1bw1;
|
|
|
|
|
// }else if(stPulsanti&M2FW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M2,FW,mrampstart[M2-1],m2pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM2fw1;
|
|
|
|
|
// }else if(stPulsanti&M2BW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M2,BW,mrampstart[M2-1],m2pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM2bw1;
|
|
|
|
|
// }else if(stPulsanti&M3FW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M3,FW,mrampstart[M3-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM3fw1;
|
|
|
|
|
// }else if(stPulsanti&M3BW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M3,BW,mrampstart[M3-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM3bw1;
|
|
|
|
|
// }else if(stPulsanti&M4FW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M4,FW,mrampstart[M4-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM4fw1;
|
|
|
|
|
// }else if(stPulsanti&M4BW){
|
|
|
|
|
// stBuz=bzmoving;
|
|
|
|
|
// (void)ramp(M4,BW,mrampstart[M4-1],m3pwmMan,trampman,RAMPINIT);
|
|
|
|
|
// stCiclo=omM4bw1;
|
|
|
|
|
// }
|
|
|
|
|
break;
|
|
|
|
|
case omM1fw1:
|
|
|
|
|
(void)ramp(M1,FW,mrampstart[M1-1],m1pwmMan,trampman,RAMPRUN);
|
|
|
|
|
@@ -355,6 +359,13 @@ void manageCiclo(void){
|
|
|
|
|
stCiclo=omaperto;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case omapertura0:
|
|
|
|
|
if(rtCiclo==0){
|
|
|
|
|
stBuz=bzmoving;
|
|
|
|
|
(void)ramp(M2,BW,mrampstart[M2-1],m2pwmap,tramp,RAMPINIT);
|
|
|
|
|
stCiclo=omapertura1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case omapertura1:
|
|
|
|
|
if(ramp(M2,BW,mrampstart[M2-1],m2pwmap,tramp,RAMPRUN)==DONE){
|
|
|
|
|
rtCiclo=t1ap;
|
|
|
|
|
|