This commit is contained in:
andrea
2026-04-28 21:24:24 +02:00
parent b0b88baa72
commit 35716fcfb1
72 changed files with 84975 additions and 72686 deletions

View File

@@ -29,6 +29,7 @@ extern uint16_t t2ch;
extern uint16_t t3ch;
extern uint16_t t4ch;
extern uint16_t twch;
extern uint16_t tramp1;
extern uint16_t trampman;
extern uint16_t m1pwmMan;
extern uint16_t m2pwmMan;
@@ -53,7 +54,7 @@ const uint8_t deftab[32]={
10, //t3ap
40, //t4ap
1, //twap
20, //t1ch
27, //t1ch
10, //t2ch
30, //t3ch
1, //t4ch
@@ -61,7 +62,7 @@ const uint8_t deftab[32]={
0,
0,
0,
0,
100, //tramp1
60, //m1pwmMan
70, //m2pwmMan
40, //m3pwmMan
@@ -379,6 +380,7 @@ void loadEE(void){
EEW_Read(T3CH, &t3ch);
EEW_Read(T4CH, &t4ch);
EEW_Read(TWCH, &twch);
EEW_Read(TRAMP1, &tramp1);
EEW_Read(M1PWMMAN, &m1pwmMan);
EEW_Read(M2PWMMAN, &m2pwmMan);
EEW_Read(M3PWMMAN, &m3pwmMan);

View File

@@ -89,6 +89,7 @@ typedef enum
#define T4CH 20 //t4ch
#define TWCH 21 //twch
#define TRAMP1 25 //tramp1
#define M1PWMMAN 26 //m1pwmMan
#define M2PWMMAN 27 //m2pwmMan
#define M3PWMMAN 28 //m3pwmMan

View File

@@ -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;