wip
This commit is contained in:
@@ -79,6 +79,7 @@ volatile uint8_t rtP2=200;
|
||||
volatile uint8_t rtTLC=100;
|
||||
volatile uint16_t rtramp[4];
|
||||
volatile uint16_t rtCiclo;
|
||||
volatile uint16_t rtAnem;
|
||||
uint16_t m1pwmap;
|
||||
uint16_t m1pwmch;
|
||||
uint16_t m2pwmap;
|
||||
@@ -98,7 +99,9 @@ uint16_t m3TimeoutMan;
|
||||
uint16_t m4TimeoutMan;
|
||||
uint16_t twch;
|
||||
uint16_t tramp;
|
||||
uint16_t tramp1;
|
||||
uint16_t tanem;
|
||||
uint16_t thanem;
|
||||
|
||||
uint16_t trampman;
|
||||
uint16_t m1pwmMan;
|
||||
uint16_t m2pwmMan;
|
||||
@@ -122,6 +125,7 @@ uint16_t chM3stop;
|
||||
uint16_t chM4start;
|
||||
uint16_t chM4stop;
|
||||
|
||||
uint16_t flagPar;
|
||||
|
||||
uint16_t mrampstart[4];
|
||||
uint16_t stPulsanti=0;
|
||||
@@ -178,7 +182,7 @@ void HAL_SYSTICK_Callback(void){
|
||||
if(rtramp[i])rtramp[i]--;
|
||||
}
|
||||
if(rtCiclo<0xffff)rtCiclo++;
|
||||
|
||||
if(rtAnem)rtAnem--;
|
||||
//**** gestione buzzer *****************************************************************************
|
||||
if(stBuz==bzmoving){
|
||||
if(nobuz){
|
||||
@@ -375,18 +379,36 @@ void manageCiclo(void){
|
||||
}
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
if(stPulsanti&P1START){
|
||||
stCiclo=omstoprestartchiusura;
|
||||
rtCiclo=0;
|
||||
}
|
||||
break;
|
||||
case omstopapertura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
if(pulsanti==0){
|
||||
SetMotPerc(M1,BW,0);
|
||||
SetMotPerc(M2,BW,0);
|
||||
SetMotPerc(M3,BW,0);
|
||||
SetMotPerc(M4,BW,0); if(pulsanti==0){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omchiuso;
|
||||
stPulsanti&=(~P1STOP);
|
||||
}
|
||||
break;
|
||||
case omstoprestartchiusura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
SetMotPerc(M1,BW,0);
|
||||
SetMotPerc(M2,BW,0);
|
||||
SetMotPerc(M3,BW,0);
|
||||
SetMotPerc(M4,BW,0);
|
||||
if(rtCiclo>=20)stCiclo=omaperto;
|
||||
break;
|
||||
case omaperto:
|
||||
rtCiclo=0;
|
||||
if(stPulsanti&P1START){
|
||||
@@ -395,6 +417,14 @@ void manageCiclo(void){
|
||||
stCiclo=omchiusura1;
|
||||
(void)m1ch();(void)m2ch();(void)m3ch();(void)m4ch();
|
||||
}
|
||||
if(ch8>thanem){
|
||||
if(rtAnem==0){
|
||||
stBuz=bzmoving;
|
||||
stCiclo=omchiusura1;
|
||||
(void)m1ch();(void)m2ch();(void)m3ch();(void)m4ch();
|
||||
}
|
||||
}else rtAnem=tanem;
|
||||
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
else if(stPulsanti&M1FW){
|
||||
stBuz=bzmoving;
|
||||
@@ -439,13 +469,31 @@ void manageCiclo(void){
|
||||
}
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
if(stPulsanti&P1START){
|
||||
stCiclo=omstoprestartapertura;
|
||||
rtCiclo=0;
|
||||
}
|
||||
break;
|
||||
case omstoprestartapertura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
SetMotPerc(M1,BW,0);
|
||||
SetMotPerc(M2,BW,0);
|
||||
SetMotPerc(M3,BW,0);
|
||||
SetMotPerc(M4,BW,0);
|
||||
if(rtCiclo>=20)stCiclo=omchiuso;
|
||||
break;
|
||||
|
||||
case omstopchiusura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
SetMotPerc(M1,BW,0);
|
||||
SetMotPerc(M2,BW,0);
|
||||
SetMotPerc(M3,BW,0);
|
||||
SetMotPerc(M4,BW,0);
|
||||
if(pulsanti==0){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omaperto;
|
||||
@@ -508,6 +556,10 @@ int main(void)
|
||||
for(;;);//errore eeprom
|
||||
}
|
||||
loadEE();
|
||||
if(flagPar!=0x01){
|
||||
loadDefault();
|
||||
loadEE();
|
||||
}
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
|
||||
Reference in New Issue
Block a user