wip
This commit is contained in:
@@ -20,6 +20,9 @@ extern uint16_t ch6 ;
|
||||
extern uint16_t ch7 ;
|
||||
extern uint16_t ch8 ;
|
||||
extern const uint8_t deftab[];
|
||||
extern omCiclo_st stCiclo;
|
||||
extern omCiclo_st memstCiclo;
|
||||
extern uint8_t stPulsanti;
|
||||
|
||||
bool toHex(char c1,char c2,char c3,char c4,uint16_t* retval){
|
||||
if((c1>='0')&&(c1<='9')){
|
||||
@@ -72,6 +75,7 @@ void manageCDC(void){
|
||||
if (rx < 0) return;
|
||||
//uint8_t out = (uint8_t)c;
|
||||
//if (out >= 'a' && out <= 'z') out -= 32; // to upper
|
||||
|
||||
rxbuf[rxidx]=rx;
|
||||
while (CDC_Transmit_FS(&rxbuf[rxidx], 1) == USBD_BUSY);//echo
|
||||
if((rx==0x0d)||(rx==0x0a)){
|
||||
@@ -86,6 +90,8 @@ void manageCDC(void){
|
||||
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
|
||||
sprintf((char*)s,"\nP=0x%x ch4=%05d ch5=%05d ch6=%05d ch7=%05d ch8=%05d",pulsanti,ch4,ch5,ch6,ch7,ch8);
|
||||
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
|
||||
sprintf((char*)s,"\nstCiclo=%05d stPulsanti=%05d",stCiclo,stPulsanti);
|
||||
while (CDC_Transmit_FS(s, 31) == USBD_BUSY);
|
||||
break;
|
||||
case 'I':
|
||||
sprintf((char*)s,"\nID000000");
|
||||
|
||||
@@ -10,6 +10,25 @@
|
||||
* [2..] Records...
|
||||
*/
|
||||
|
||||
extern uint16_t m1pwmap;
|
||||
extern uint16_t m1pwmch;
|
||||
extern uint16_t m2pwmap;
|
||||
extern uint16_t m2pwmch;
|
||||
extern uint16_t m3pwmap;
|
||||
extern uint16_t m3pwmch;
|
||||
extern uint16_t m4pwmap;
|
||||
extern uint16_t m4pwmch;
|
||||
extern uint16_t t1ap;
|
||||
extern uint16_t t2ap;
|
||||
extern uint16_t t3ap;
|
||||
extern uint16_t t4ap;
|
||||
extern uint16_t twap;
|
||||
extern uint16_t tramp;
|
||||
extern uint16_t t1ch;
|
||||
extern uint16_t t2ch;
|
||||
extern uint16_t t3ch;
|
||||
extern uint16_t twch;
|
||||
|
||||
const uint8_t deftab[32]={
|
||||
40, //m1pwmap
|
||||
60, //m1pwmch
|
||||
@@ -28,6 +47,10 @@ const uint8_t deftab[32]={
|
||||
8, //t3ap
|
||||
40, //t4ap
|
||||
1, //twap
|
||||
30, //t1ch
|
||||
30, //t2ch
|
||||
40, //t3ch
|
||||
1, //twch
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -38,11 +61,7 @@ const uint8_t deftab[32]={
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
10, //tramp
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -334,3 +353,24 @@ uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data)
|
||||
st = EE_PageTransfer(VirtAddress, Data);
|
||||
return (uint16_t)st;
|
||||
}
|
||||
|
||||
void loadEE(void){
|
||||
EEW_Read(M1PWMAP, &m1pwmap);
|
||||
EEW_Read(M1PWMCH, &m1pwmch);
|
||||
EEW_Read(M2PWMAP, &m2pwmap);
|
||||
EEW_Read(M2PWMCH, &m2pwmch);
|
||||
EEW_Read(M3PWMAP, &m3pwmap);
|
||||
EEW_Read(M3PWMCH, &m3pwmch);
|
||||
EEW_Read(M4PWMAP, &m4pwmap);
|
||||
EEW_Read(M4PWMCH, &m4pwmch);
|
||||
EEW_Read(T1AP, &t1ap);
|
||||
EEW_Read(T2AP, &t2ap);
|
||||
EEW_Read(T3AP, &t3ap);
|
||||
EEW_Read(T4AP, &t4ap);
|
||||
EEW_Read(TWAP, &twap);
|
||||
EEW_Read(T1CH, &t1ch);
|
||||
EEW_Read(T2CH, &t2ch);
|
||||
EEW_Read(T3CH, &t3ch);
|
||||
EEW_Read(TWCH, &twch);
|
||||
EEW_Read(TRAMP, &tramp);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,31 @@ typedef enum
|
||||
#define EE_NUM_VIRTUAL_ADDR 32U
|
||||
#define EEW_ADDR(i) (uint16_t)(0x0001 + (i)) // i = 0..31
|
||||
|
||||
|
||||
#define M1PWMAP 0 //m1pwmap
|
||||
#define M1PWMCH 1 //m1pwmch
|
||||
#define M2PWMAP 2 //m2pwmap
|
||||
#define M2PWMCH 3 //m2pwmch
|
||||
#define M3PWMAP 4 //m3pwmap
|
||||
#define M3PWMCH 5 //m3pwmch
|
||||
#define M4PWMAP 6 //m4pwmap
|
||||
#define M4PWMCH 7 //m4pwmch
|
||||
#define M1RAMPSTART 8 //m1rampstart
|
||||
#define M2RAMPSTART 9 //m2rampstart
|
||||
#define M3RAMPSTART 10 //m3rampstart
|
||||
#define M4RAMPSTART 11 //m4rampstart
|
||||
#define T1AP 12 //t1ap
|
||||
#define T2AP 13 //t2ap
|
||||
#define T3AP 14 //t3ap
|
||||
#define T4AP 15 //t4ap
|
||||
#define TWAP 16 //twap
|
||||
#define T1CH 17 //t1ch
|
||||
#define T2CH 18 //t2ch
|
||||
#define T3CH 19 //t3ch
|
||||
#define TWCH 20 //twch
|
||||
#define TRAMP 31 //tramp
|
||||
|
||||
|
||||
/* Virtual address table (defined in eeprom.c, can be customized) */
|
||||
extern const uint16_t EE_VirtAddrs[EE_NUM_VIRTUAL_ADDR];
|
||||
|
||||
@@ -72,7 +97,7 @@ extern const uint16_t EE_VirtAddrs[EE_NUM_VIRTUAL_ADDR];
|
||||
uint16_t EE_Init(void);
|
||||
uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t *Data);
|
||||
uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data);
|
||||
|
||||
void loadEE(void);
|
||||
/* Pseudo-array accessor EEW[idx] */
|
||||
static inline uint16_t EEW_Read(uint8_t idx, uint16_t *value)
|
||||
{
|
||||
|
||||
@@ -31,24 +31,7 @@
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
typedef enum{
|
||||
omchiuso,
|
||||
omapertura1,
|
||||
omapertura2,
|
||||
omapertura3,
|
||||
omapertura4,
|
||||
omapertura5,
|
||||
omapertura6,
|
||||
omstopapertura,
|
||||
omaperto,
|
||||
omchiusura1,
|
||||
omchiusura2,
|
||||
omchiusura3,
|
||||
omchiusura4,
|
||||
omchiusura5,
|
||||
omchiusura6,
|
||||
omstopchiusura,
|
||||
}omCiclo_st;
|
||||
|
||||
typedef enum{
|
||||
bzoff,
|
||||
bzmoving,
|
||||
@@ -61,6 +44,10 @@ typedef enum{
|
||||
#define P1STOP 0x02
|
||||
#define P2START 0x04
|
||||
#define P2STOP 0x08
|
||||
#define M1 1
|
||||
#define M2 2
|
||||
#define M3 3
|
||||
#define M4 4
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
@@ -88,11 +75,33 @@ extern uint16_t ch7 ;
|
||||
extern uint16_t ch8 ;
|
||||
|
||||
uint8_t pulsanti=0;
|
||||
volatile uint8_t rtP1=0;
|
||||
volatile uint8_t rtP2=0;
|
||||
volatile uint8_t rtP1=200;
|
||||
volatile uint8_t rtP2=200;
|
||||
volatile uint16_t rtramp[4];
|
||||
volatile uint16_t rtCiclo;
|
||||
uint16_t m1pwmap;
|
||||
uint16_t m1pwmch;
|
||||
uint16_t m2pwmap;
|
||||
uint16_t m2pwmch;
|
||||
uint16_t m3pwmap;
|
||||
uint16_t m3pwmch;
|
||||
uint16_t m4pwmap;
|
||||
uint16_t m4pwmch;
|
||||
uint16_t t1ap;
|
||||
uint16_t t2ap;
|
||||
uint16_t t3ap;
|
||||
uint16_t t4ap;
|
||||
uint16_t twap;
|
||||
uint16_t t1ch;
|
||||
uint16_t t2ch;
|
||||
uint16_t t3ch;
|
||||
uint16_t twch;
|
||||
uint16_t tramp;
|
||||
|
||||
uint16_t mrampstart[4];
|
||||
uint8_t stPulsanti=0;
|
||||
omCiclo_st stCiclo=omchiuso;
|
||||
omCiclo_st memstCiclo=omchiuso;
|
||||
volatile stBuz_st stBuz=bzoff;
|
||||
/* USER CODE END PV */
|
||||
|
||||
@@ -116,6 +125,7 @@ void HAL_SYSTICK_Callback(void){
|
||||
static uint8_t c1s = 0;
|
||||
static uint8_t inidx=0;
|
||||
static uint8_t inbuf[4];
|
||||
uint8_t i;
|
||||
|
||||
if (++c10ms >= 10) { // 10 ms
|
||||
c10ms = 0;
|
||||
@@ -133,6 +143,9 @@ void HAL_SYSTICK_Callback(void){
|
||||
readAdc();
|
||||
if (++c100ms >= 10) { // 10 ms
|
||||
c100ms = 0; //flag_10ms = 1; // set a flag; do real work in main loop
|
||||
for(i=0;i<4;i++){
|
||||
if(rtramp[i])rtramp[i]--;
|
||||
}
|
||||
//**** 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);
|
||||
@@ -142,6 +155,7 @@ void HAL_SYSTICK_Callback(void){
|
||||
//**************************************************************************************************
|
||||
if (++c1s >= 10) { // 10 ms
|
||||
c1s = 0;
|
||||
if(rtCiclo)rtCiclo--;
|
||||
HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
|
||||
}
|
||||
}
|
||||
@@ -172,55 +186,218 @@ void manageCiclo(void){
|
||||
case omchiuso:
|
||||
if(stPulsanti&P1START){
|
||||
stBuz=bzmoving;
|
||||
(void)ramp(M2,BW,mrampstart[M2-1],m2pwmap,tramp,RAMPINIT);
|
||||
stCiclo=omapertura1;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura1:
|
||||
if(ramp(M2,BW,mrampstart[M2-1],m2pwmap,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t1ap;
|
||||
stCiclo=omapertura2;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura2:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M2,BW,m2pwmap,0,tramp,RAMPINIT);
|
||||
stCiclo=omapertura3;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura3:
|
||||
if(ramp(M2,BW,m2pwmap,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twap;
|
||||
stCiclo=omapertura4;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura4:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M1,FW,mrampstart[M1-1],m1pwmap,tramp,RAMPINIT);
|
||||
stCiclo=omapertura5;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura5:
|
||||
if(ramp(M1,FW,mrampstart[M1-1],m1pwmap,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t2ap;
|
||||
stCiclo=omapertura6;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura6:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M3,FW,mrampstart[M3-1],m3pwmap,tramp,RAMPINIT);
|
||||
stCiclo=omapertura7;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura7:
|
||||
if(ramp(M3,FW,mrampstart[M3-1],m3pwmap,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t3ap;
|
||||
stCiclo=omapertura8;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura8:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M3,FW,m3pwmap,0,tramp,RAMPINIT);
|
||||
(void)ramp(M1,FW,m1pwmap,0,tramp,RAMPINIT);
|
||||
stCiclo=omapertura9;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura9:
|
||||
if((ramp(M3,FW,m3pwmap,0,tramp,RAMPRUN)==DONE)&&(ramp(M1,FW,m1pwmap,0,tramp,RAMPRUN)==DONE)){
|
||||
rtCiclo=twap;
|
||||
stCiclo=omapertura10;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura10:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M4,FW,mrampstart[M4-1],m4pwmap,tramp,RAMPINIT);
|
||||
stCiclo=omapertura11;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura11:
|
||||
if(ramp(M4,FW,mrampstart[M4-1],m4pwmap,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=t4ap;
|
||||
stCiclo=omapertura12;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura12:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M4,FW,m4pwmap,0,tramp,RAMPINIT);
|
||||
stCiclo=omapertura13;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura13:
|
||||
if(ramp(M4,FW,m4pwmap,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twap;
|
||||
stCiclo=omapertura14;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omapertura14:
|
||||
if(rtCiclo==0){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omaperto;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopapertura;
|
||||
break;
|
||||
case omstopapertura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
stBuz=bzoff;
|
||||
stCiclo=omchiuso;
|
||||
stPulsanti&=(~P1STOP);
|
||||
break;
|
||||
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;
|
||||
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);
|
||||
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;
|
||||
stCiclo=omchiusura4;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura4:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M2,FW,mrampstart[M2-1],m2pwmch,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;
|
||||
stCiclo=omchiusura6;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura6:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M2,FW,m2pwmch,0,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura7;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura7:
|
||||
if(ramp(M2,FW,m2pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twch;
|
||||
stCiclo=omchiusura8;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura8:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M4,BW,mrampstart[M4-1],m4pwmch,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;
|
||||
stCiclo=omchiusura10;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura10:
|
||||
if(rtCiclo==0){
|
||||
(void)ramp(M4,BW,m4pwmch,0,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura11;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura11:
|
||||
if(ramp(M4,BW,m4pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
rtCiclo=twch;
|
||||
stCiclo=omchiusura12;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omchiusura12:
|
||||
if(rtCiclo==0){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omchiuso;
|
||||
}
|
||||
if(stPulsanti&P1STOP)stCiclo=omstopchiusura;
|
||||
break;
|
||||
case omstopchiusura:
|
||||
SetMotPerc(M1,FW,0);
|
||||
SetMotPerc(M2,FW,0);
|
||||
SetMotPerc(M3,FW,0);
|
||||
SetMotPerc(M4,FW,0);
|
||||
stBuz=bzoff;
|
||||
stCiclo=omaperto;
|
||||
stPulsanti&=(~P1STOP);
|
||||
@@ -280,6 +457,7 @@ int main(void)
|
||||
if (EE_Init() != EE_OK){
|
||||
for(;;);//errore eeprom
|
||||
}
|
||||
loadEE();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
|
||||
@@ -14,7 +14,8 @@ extern TIM_HandleTypeDef htim1;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
extern TIM_HandleTypeDef htim3;
|
||||
extern TIM_HandleTypeDef htim4;
|
||||
|
||||
extern volatile uint8_t rtramp[4];
|
||||
extern uint8_t mrampstart[4];
|
||||
bool IsPwmRunning(TIM_HandleTypeDef *htim, uint32_t Channel)
|
||||
{
|
||||
HAL_TIM_ChannelStateTypeDef chState = HAL_TIM_GetChannelState(htim, Channel);
|
||||
@@ -242,3 +243,41 @@ void SetMotPerc(uint8_t mot,uint8_t dir,uint8_t perc){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint8_t ramp(uint8_t mot,uint8_t dir,uint8_t percStart,uint8_t percEnd,uint8_t tr,uint8_t mode){
|
||||
static uint8_t memrtramp[4];
|
||||
uint16_t delta;
|
||||
switch(mode){
|
||||
case RAMPINIT:
|
||||
memrtramp[mot-1]=percStart=tr;
|
||||
SetMotPerc(mot,dir,mrampstart[mot-1]);
|
||||
return DONE;
|
||||
case RAMPRUN:
|
||||
if(memrtramp[mot-1]!=rtramp[mot-1]){
|
||||
memrtramp[mot-1]=rtramp[mot-1];
|
||||
if(rtramp[mot-1]){
|
||||
if(mrampstart[mot-1]>percEnd){
|
||||
delta=mrampstart[mot-1]-percEnd;
|
||||
delta=delta*(uint16_t)(tr-rtramp[mot-1]);
|
||||
delta=delta/tr;
|
||||
SetMotPerc(mot,dir,mrampstart[mot-1]-delta);
|
||||
return RUNNING;
|
||||
}else if(mrampstart[mot-1]<percEnd){
|
||||
delta=percEnd-mrampstart[mot-1];
|
||||
delta=delta*(uint16_t)(tr-rtramp[mot-1]);
|
||||
delta=delta/tr;
|
||||
SetMotPerc(mot,dir,mrampstart[mot-1]+delta);
|
||||
return RUNNING;
|
||||
}else{
|
||||
SetMotPerc(mot,dir,percEnd);
|
||||
return DONE;
|
||||
}
|
||||
}else{
|
||||
SetMotPerc(mot,dir,percEnd);
|
||||
return DONE;
|
||||
}
|
||||
}else return RUNNING;
|
||||
break;
|
||||
}
|
||||
return DONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user