wip
This commit is contained in:
@@ -66,6 +66,8 @@ typedef enum{
|
||||
omchiusura10,
|
||||
omchiusura11,
|
||||
omchiusura12,
|
||||
omchiusura13,
|
||||
omchiusura14,
|
||||
omstopchiusura,
|
||||
}omCiclo_st;
|
||||
/* USER CODE END ET */
|
||||
|
||||
@@ -177,7 +177,7 @@ void manageCDC(void){
|
||||
for(i=0;i<32;i++){
|
||||
st=EEW_Read(i, &val);
|
||||
if (st == EE_OK){
|
||||
sprintf((char*)s,"0x%02x=0x%04x ",i,val);
|
||||
sprintf((char*)s,"\n0x%02x=%5d ",i,val);
|
||||
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
|
||||
}else{
|
||||
sprintf((char*)s,"rderr %d ",st);
|
||||
|
||||
@@ -27,14 +27,15 @@ extern uint16_t tramp;
|
||||
extern uint16_t t1ch;
|
||||
extern uint16_t t2ch;
|
||||
extern uint16_t t3ch;
|
||||
extern uint16_t t4ch;
|
||||
extern uint16_t twch;
|
||||
|
||||
const uint8_t deftab[32]={
|
||||
40, //m1pwmap
|
||||
60, //m1pwmch
|
||||
50, //m2pwmap
|
||||
50, //m2pwmch
|
||||
40, //m3pwmap
|
||||
70, //m2pwmap
|
||||
70, //m2pwmch
|
||||
35, //m3pwmap
|
||||
40, //m3pwmch
|
||||
40, //m4pwmap
|
||||
40, //m4pwmch
|
||||
@@ -42,14 +43,15 @@ const uint8_t deftab[32]={
|
||||
20, //m2rampstart
|
||||
20, //m3rampstart
|
||||
20, //m4rampstart
|
||||
26, //t1ap
|
||||
2, //t2ap
|
||||
8, //t3ap
|
||||
28, //t1ap
|
||||
4, //t2ap
|
||||
10, //t3ap
|
||||
40, //t4ap
|
||||
1, //twap
|
||||
30, //t1ch
|
||||
30, //t2ch
|
||||
40, //t3ch
|
||||
20, //t1ch
|
||||
10, //t2ch
|
||||
30, //t3ch
|
||||
1, //t4ch
|
||||
1, //twch
|
||||
0,
|
||||
0,
|
||||
@@ -60,7 +62,6 @@ const uint8_t deftab[32]={
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
10, //tramp
|
||||
};
|
||||
|
||||
@@ -371,6 +372,7 @@ void loadEE(void){
|
||||
EEW_Read(T1CH, &t1ch);
|
||||
EEW_Read(T2CH, &t2ch);
|
||||
EEW_Read(T3CH, &t3ch);
|
||||
EEW_Read(T4CH, &t4ch);
|
||||
EEW_Read(TWCH, &twch);
|
||||
EEW_Read(TRAMP, &tramp);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ typedef enum
|
||||
#define T1CH 17 //t1ch
|
||||
#define T2CH 18 //t2ch
|
||||
#define T3CH 19 //t3ch
|
||||
#define TWCH 20 //twch
|
||||
#define T4CH 20 //t4ch
|
||||
#define TWCH 21 //twch
|
||||
#define TRAMP 31 //tramp
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ uint16_t twap;
|
||||
uint16_t t1ch;
|
||||
uint16_t t2ch;
|
||||
uint16_t t3ch;
|
||||
uint16_t t4ch;
|
||||
uint16_t twch;
|
||||
uint16_t tramp;
|
||||
|
||||
@@ -302,72 +303,72 @@ void manageCiclo(void){
|
||||
case omaperto:
|
||||
if(stPulsanti&P1START){
|
||||
stBuz=bzmoving;
|
||||
(void)ramp(M3,BW,mrampstart[M3-1],m3pwmch,tramp,RAMPINIT);
|
||||
(void)ramp(M1,BW,mrampstart[M1-1],m1pwmch,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura1;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura1:
|
||||
if((ramp(M3,BW,mrampstart[M3-1],m3pwmch,tramp,RAMPRUN)==DONE)&&(ramp(M1,BW,mrampstart[M1-1],m1pwmch,tramp,RAMPRUN)==DONE)){
|
||||
rtCiclo=t1ch;
|
||||
if(ramp(M1,BW,mrampstart[M1-1],m1pwmch,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t4ch;
|
||||
stCiclo=omchiusura2;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura2:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M3,BW,m3pwmch,0,tramp,RAMPINIT);
|
||||
(void)ramp(M1,BW,m1pwmch,0,tramp,RAMPINIT);
|
||||
(void)ramp(M3,BW,mrampstart[M3-1],m3pwmch,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura3;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura3:
|
||||
if((ramp(M3,BW,m3pwmch,0,tramp,RAMPRUN)==DONE)&&(ramp(M1,BW,m1pwmch,0,tramp,RAMPRUN)==DONE)){
|
||||
rtCiclo=twch;
|
||||
if(ramp(M3,BW,mrampstart[M3-1],m3pwmch,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t1ch;
|
||||
stCiclo=omchiusura4;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura4:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M2,FW,mrampstart[M2-1],m2pwmch,tramp,RAMPINIT);
|
||||
(void)ramp(M3,BW,m3pwmch,0,tramp,RAMPINIT);
|
||||
(void)ramp(M1,BW,m1pwmch,0,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura5;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura5:
|
||||
if(ramp(M2,FW,mrampstart[M2-1],m2pwmch,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t2ch;
|
||||
if((ramp(M3,BW,m3pwmch,0,tramp,RAMPRUN)==DONE)&&(ramp(M1,BW,m1pwmch,0,tramp,RAMPRUN)==DONE)){
|
||||
rtCiclo=twch;
|
||||
stCiclo=omchiusura6;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura6:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M2,FW,m2pwmch,0,tramp,RAMPINIT);
|
||||
(void)ramp(M2,FW,mrampstart[M2-1],m2pwmch,tramp,RAMPINIT);
|
||||
(void)ramp(M4,BW,mrampstart[M4-1],m4pwmch,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura7;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura7:
|
||||
if(ramp(M2,FW,m2pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twch;
|
||||
if((ramp(M2,FW,mrampstart[M2-1],m2pwmch,tramp,RAMPRUN)==DONE)&&(ramp(M4,BW,mrampstart[M4-1],m4pwmch,tramp,RAMPRUN)==DONE)){
|
||||
rtCiclo=t3ch;
|
||||
stCiclo=omchiusura8;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura8:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M4,BW,mrampstart[M4-1],m4pwmch,tramp,RAMPINIT);
|
||||
(void)ramp(M2,FW,m2pwmch,0,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura9;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura9:
|
||||
if(ramp(M4,BW,mrampstart[M4-1],m4pwmch,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t3ch;
|
||||
if(ramp(M2,FW,m2pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t2ch;
|
||||
stCiclo=omchiusura10;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
@@ -382,11 +383,25 @@ void manageCiclo(void){
|
||||
case omchiusura11:
|
||||
if(ramp(M4,BW,m4pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twch;
|
||||
stCiclo=omchiusura12;
|
||||
stCiclo=omchiusura14;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura12:
|
||||
if(rtCiclo==0){
|
||||
//(void)ramp(M4,BW,m4pwmch,0,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura14;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura13:
|
||||
if(ramp(M4,BW,m4pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twch;
|
||||
stCiclo=omchiusura14;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura14:
|
||||
if(rtCiclo==0){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omchiuso;
|
||||
|
||||
Reference in New Issue
Block a user