wip
This commit is contained in:
@@ -61,7 +61,7 @@ typedef enum{
|
||||
omstoprestartapertura,
|
||||
omaperto,
|
||||
omchiusura1,
|
||||
|
||||
omemergenza1,
|
||||
omstopchiusura,
|
||||
}omCiclo_st;
|
||||
/* USER CODE END ET */
|
||||
|
||||
@@ -44,6 +44,7 @@ uint8_t ramp(uint8_t mot,uint8_t dir,uint8_t percStart,uint8_t percEnd,uint8_t t
|
||||
#define M3BW 0x200
|
||||
#define M4FW 0x400
|
||||
#define M4BW 0x800
|
||||
#define P1RELEASED 0x1000
|
||||
|
||||
#define M1 1
|
||||
#define M2 2
|
||||
|
||||
@@ -86,8 +86,8 @@ const uint16_t deftab[EE_NUM_VIRTUAL_ADDR]={
|
||||
1, //twch
|
||||
0,
|
||||
0,
|
||||
0x100,//thanem
|
||||
20, //tanem
|
||||
0x150,//thanem
|
||||
30, //tanem
|
||||
60, //m1pwmMan
|
||||
70, //m2pwmMan
|
||||
40, //m3pwmMan
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef enum
|
||||
EE_STATUS_NO_SPACE
|
||||
} EE_Status;
|
||||
|
||||
#define VERSIONE 0x08 //versione software
|
||||
#define VERSIONE 0x01 //versione software
|
||||
/* For compatibility with ST style uint16_t return codes */
|
||||
#define EE_OK ((uint16_t)EE_STATUS_OK)
|
||||
#define EE_ERROR ((uint16_t)EE_STATUS_ERROR)
|
||||
|
||||
@@ -219,14 +219,14 @@ void HAL_SYSTICK_Callback(void) {
|
||||
}
|
||||
} else if (stBuz == bzwarning) {
|
||||
if (nobuz) {
|
||||
if (c1s & 2)
|
||||
if (c1s & 1)
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin,
|
||||
GPIO_PIN_RESET);
|
||||
else
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin,
|
||||
GPIO_PIN_SET);
|
||||
} else {
|
||||
if (c1s & 2)
|
||||
if (c1s & 1)
|
||||
HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_RESET);
|
||||
else
|
||||
HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_SET);
|
||||
@@ -253,6 +253,7 @@ void managePulsanti(void) {
|
||||
} else {
|
||||
if (stPulsanti & P1START) {
|
||||
stPulsanti &= (~P1START);
|
||||
stPulsanti|=P1RELEASED;
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
|
||||
} else if (rtP1 <= 190) {
|
||||
stPulsanti |= P1STOP;
|
||||
@@ -270,7 +271,7 @@ void managePulsanti(void) {
|
||||
stPulsanti |= P2STOP;
|
||||
rtP2 = 200;
|
||||
}
|
||||
stPulsanti &= (P1START | P1STOP | P2START | P2STOP);
|
||||
stPulsanti &= (P1START | P1STOP | P2START | P2STOP |P1RELEASED);
|
||||
if (stPulsanti == 0) {
|
||||
switch (pulsanti & 0x3c) {
|
||||
case 0x00:
|
||||
@@ -313,6 +314,7 @@ void manageCiclo(void) {
|
||||
motMov_st m1, m2, m3, m4;
|
||||
switch (stCiclo) {
|
||||
case omchiuso:
|
||||
stPulsanti &= (~P1RELEASED);
|
||||
if (stPulsanti & P1START) {
|
||||
stBuz = bzwarning;
|
||||
rtCiclo = 0;
|
||||
@@ -329,8 +331,9 @@ void manageCiclo(void) {
|
||||
if ((ch8 > thanem) && (fchiuso == false)) {
|
||||
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET);
|
||||
if (rtAnem == 0) {
|
||||
rtCiclo=0;
|
||||
stBuz = bzmoving;
|
||||
stCiclo = omchiusura1;
|
||||
stCiclo = omemergenza1;
|
||||
(void) m1ch();
|
||||
(void) m2ch();
|
||||
(void) m3ch();
|
||||
@@ -482,10 +485,10 @@ void manageCiclo(void) {
|
||||
}
|
||||
if (stPulsanti & P1STOP)
|
||||
stCiclo = omstopapertura;
|
||||
// if (stPulsanti & P1START) {
|
||||
// stCiclo = omstoprestartchiusura;
|
||||
// rtCiclo = 0;
|
||||
// }
|
||||
if ((stPulsanti & P1START)&&(stPulsanti & P1RELEASED)) {
|
||||
stCiclo = omstoprestartchiusura;
|
||||
rtCiclo = 0;
|
||||
}
|
||||
break;
|
||||
case omstopapertura:
|
||||
SetMotPerc(M1, FW, 0);
|
||||
@@ -511,10 +514,12 @@ void manageCiclo(void) {
|
||||
SetMotPerc(M2, BW, 0);
|
||||
SetMotPerc(M3, BW, 0);
|
||||
SetMotPerc(M4, BW, 0);
|
||||
stBuz = bzoff;
|
||||
if (rtCiclo >= 20)
|
||||
stCiclo = omaperto;
|
||||
break;
|
||||
case omaperto:
|
||||
stPulsanti &= (~P1RELEASED);
|
||||
rtCiclo = 0;
|
||||
if (stPulsanti & P1START) {
|
||||
stBuz = bzmoving;
|
||||
@@ -529,7 +534,7 @@ void manageCiclo(void) {
|
||||
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET);
|
||||
if (rtAnem == 0) {
|
||||
stBuz = bzmoving;
|
||||
stCiclo = omchiusura1;
|
||||
stCiclo = omemergenza1;
|
||||
(void) m1ch();
|
||||
(void) m2ch();
|
||||
(void) m3ch();
|
||||
@@ -599,10 +604,25 @@ void manageCiclo(void) {
|
||||
}
|
||||
if (stPulsanti & P1STOP)
|
||||
stCiclo = omstopchiusura;
|
||||
// if (stPulsanti & P1START) {
|
||||
// stCiclo = omstoprestartapertura;
|
||||
// rtCiclo = 0;
|
||||
// }
|
||||
if ((stPulsanti & P1START)&&(stPulsanti & P1RELEASED)) {
|
||||
stCiclo = omstoprestartapertura;
|
||||
rtCiclo = 0;
|
||||
}
|
||||
break;
|
||||
case omemergenza1:
|
||||
if (rtCiclo >= 10) { //doppo 1 secondi
|
||||
m1 = m1ch();
|
||||
m2 = m2ch();
|
||||
m3 = m3ch();
|
||||
m4 = m4ch();
|
||||
if ((m1 == motStop) && (m2 == motStop) && (m3 == motStop)
|
||||
&& (m4 == motStop)) {
|
||||
stBuz = bzoff;
|
||||
stCiclo = omchiuso;
|
||||
fchiuso = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case omstoprestartapertura:
|
||||
SetMotPerc(M1, FW, 0);
|
||||
@@ -613,6 +633,7 @@ void manageCiclo(void) {
|
||||
SetMotPerc(M2, BW, 0);
|
||||
SetMotPerc(M3, BW, 0);
|
||||
SetMotPerc(M4, BW, 0);
|
||||
stBuz = bzoff;
|
||||
if (rtCiclo >= 20)
|
||||
stCiclo = omchiuso;
|
||||
break;
|
||||
@@ -688,8 +709,10 @@ int main(void) {
|
||||
}
|
||||
loadEE();
|
||||
if (flagPar != VERSIONE) {
|
||||
HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_SET);
|
||||
loadDefault();
|
||||
loadEE();
|
||||
HAL_GPIO_WritePin(GPIOA, BUZ_Pin, GPIO_PIN_RESET);
|
||||
}
|
||||
/* USER CODE END 2 */
|
||||
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3973
workspace/AUTOM10/Debug/AUTOM10_00_200_3.hex
Normal file
3973
workspace/AUTOM10/Debug/AUTOM10_00_200_3.hex
Normal file
File diff suppressed because it is too large
Load Diff
3973
workspace/AUTOM10/Debug/AUTOM10_01_150_3.hex
Normal file
3973
workspace/AUTOM10/Debug/AUTOM10_01_150_3.hex
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
../Core/Src/main.c:149:6:HAL_SYSTICK_Callback 25
|
||||
../Core/Src/main.c:246:6:managePulsanti 23
|
||||
../Core/Src/main.c:312:6:manageCiclo 92
|
||||
../Core/Src/main.c:643:5:main 3
|
||||
../Core/Src/main.c:732:6:SystemClock_Config 4
|
||||
../Core/Src/main.c:776:13:MX_ADC1_Init 7
|
||||
../Core/Src/main.c:852:13:MX_TIM2_Init 9
|
||||
../Core/Src/main.c:924:13:MX_TIM4_Init 9
|
||||
../Core/Src/main.c:994:13:MX_USART1_UART_Init 2
|
||||
../Core/Src/main.c:1023:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:1040:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:1116:6:Error_Handler 1
|
||||
../Core/Src/main.c:313:6:manageCiclo 102
|
||||
../Core/Src/main.c:664:5:main 3
|
||||
../Core/Src/main.c:755:6:SystemClock_Config 4
|
||||
../Core/Src/main.c:799:13:MX_ADC1_Init 7
|
||||
../Core/Src/main.c:875:13:MX_TIM2_Init 9
|
||||
../Core/Src/main.c:947:13:MX_TIM4_Init 9
|
||||
../Core/Src/main.c:1017:13:MX_USART1_UART_Init 2
|
||||
../Core/Src/main.c:1046:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:1063:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:1139:6:Error_Handler 1
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
../Core/Src/main.c:149:6:HAL_SYSTICK_Callback 16 static
|
||||
../Core/Src/main.c:246:6:managePulsanti 8 static
|
||||
../Core/Src/main.c:312:6:manageCiclo 24 static
|
||||
../Core/Src/main.c:643:5:main 8 static
|
||||
../Core/Src/main.c:732:6:SystemClock_Config 88 static
|
||||
../Core/Src/main.c:776:13:MX_ADC1_Init 24 static
|
||||
../Core/Src/main.c:852:13:MX_TIM2_Init 64 static
|
||||
../Core/Src/main.c:924:13:MX_TIM4_Init 64 static
|
||||
../Core/Src/main.c:994:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:1023:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:1040:13:MX_GPIO_Init 40 static
|
||||
../Core/Src/main.c:1116:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
../Core/Src/main.c:313:6:manageCiclo 24 static
|
||||
../Core/Src/main.c:664:5:main 8 static
|
||||
../Core/Src/main.c:755:6:SystemClock_Config 88 static
|
||||
../Core/Src/main.c:799:13:MX_ADC1_Init 24 static
|
||||
../Core/Src/main.c:875:13:MX_TIM2_Init 64 static
|
||||
../Core/Src/main.c:947:13:MX_TIM4_Init 64 static
|
||||
../Core/Src/main.c:1017:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:1046:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:1063:13:MX_GPIO_Init 40 static
|
||||
../Core/Src/main.c:1139:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user