wip
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "eeprom.h"
|
||||
#include "pwm.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
extern TIM_HandleTypeDef htim1;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
@@ -19,10 +20,11 @@ extern uint16_t ch5 ;
|
||||
extern uint16_t ch6 ;
|
||||
extern uint16_t ch7 ;
|
||||
extern uint16_t ch8 ;
|
||||
extern const uint8_t deftab[];
|
||||
extern const uint16_t deftab[];
|
||||
extern omCiclo_st stCiclo;
|
||||
extern omCiclo_st memstCiclo;
|
||||
extern uint8_t stPulsanti;
|
||||
extern bool nobuz;
|
||||
|
||||
bool toHex(char c1,char c2,char c3,char c4,uint16_t* retval){
|
||||
if((c1>='0')&&(c1<='9')){
|
||||
@@ -97,6 +99,21 @@ void manageCDC(void){
|
||||
sprintf((char*)s,"\nID000000");
|
||||
while (CDC_Transmit_FS(s, 9) == USBD_BUSY);
|
||||
break;
|
||||
case 'b':
|
||||
if(rxidx==2){
|
||||
if(rxbuf[1]=='0'){
|
||||
nobuz=false;
|
||||
}else if(rxbuf[1]=='1'){
|
||||
nobuz=true;
|
||||
}else{
|
||||
sprintf((char*)s,"\nb0|1");
|
||||
while (CDC_Transmit_FS(s, 5) == USBD_BUSY);
|
||||
}
|
||||
}else{
|
||||
sprintf((char*)s,"\nb0|1");
|
||||
while (CDC_Transmit_FS(s, 5) == USBD_BUSY);
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if(rxidx==8){
|
||||
if((rxbuf[1]>='1')&&(rxbuf[1]<='4')){
|
||||
@@ -194,9 +211,9 @@ void manageCDC(void){
|
||||
}
|
||||
}else if(rxbuf[1]=='x'){
|
||||
if(rxidx==2){
|
||||
for(i=0;i<32;i++){
|
||||
for(i=0;i<EE_NUM_VIRTUAL_ADDR;i++){
|
||||
st=EEW_Write(i,deftab[i]);
|
||||
if (st == EE_OK)sprintf((char*)s,"\ndone 0x%02x=0x%04x",i,deftab[i]);
|
||||
if (st == EE_OK)sprintf((char*)s,"\ndone %d=%d",i,deftab[i]);
|
||||
else sprintf((char*)s,"\nee write error %d", st);
|
||||
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "adc.h"
|
||||
#include "debug.h"
|
||||
#include "mot.h"
|
||||
#include <stdbool.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -127,6 +128,7 @@ uint16_t stPulsanti=0;
|
||||
omCiclo_st stCiclo=omchiuso;
|
||||
omCiclo_st memstCiclo=omchiuso;
|
||||
volatile stBuz_st stBuz=bzoff;
|
||||
bool nobuz=false;
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@@ -179,16 +181,24 @@ 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);
|
||||
if(nobuz){
|
||||
if(c1s>=5)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>=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);
|
||||
if(nobuz){
|
||||
if(c1s&2)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)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);
|
||||
}
|
||||
//**************************************************************************************************
|
||||
if (++c1s >= 10) { // 1 s
|
||||
c1s = 0;
|
||||
HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
|
||||
//HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,10 +207,16 @@ void HAL_SYSTICK_Callback(void){
|
||||
void managePulsanti(void){
|
||||
if(pulsanti&INP1){
|
||||
if(rtP1==0)stPulsanti|=P1START;
|
||||
else{
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin, GPIO_PIN_SET);
|
||||
}
|
||||
}else{
|
||||
if(stPulsanti&P1START)stPulsanti&=(~P1START);
|
||||
else if(rtP1<=190){
|
||||
if(stPulsanti&P1START){
|
||||
stPulsanti&=(~P1START);
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin, GPIO_PIN_RESET);
|
||||
}else if(rtP1<=190){
|
||||
stPulsanti|=P1STOP;
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin, GPIO_PIN_RESET);
|
||||
}
|
||||
rtP1=200;
|
||||
}
|
||||
@@ -375,7 +391,7 @@ void manageCiclo(void){
|
||||
rtCiclo=0;
|
||||
if(stPulsanti&P1START){
|
||||
stBuz=bzmoving;
|
||||
(void)ramp(M1,BW,mrampstart[M1-1],m1pwmch,tramp,RAMPINIT);
|
||||
//(void)ramp(M1,BW,mrampstart[M1-1],m1pwmch,tramp,RAMPINIT);
|
||||
stCiclo=omchiusura1;
|
||||
(void)m1ch();(void)m2ch();(void)m3ch();(void)m4ch();
|
||||
}
|
||||
@@ -416,7 +432,8 @@ void manageCiclo(void){
|
||||
break;
|
||||
case omchiusura1:
|
||||
if(rtCiclo>=10){//doppo 1 secondi
|
||||
if((m1ch()==motStop)&&(m2ch()==motStop)&&(m3ch()==motStop)&&(m4ch()==motStop)){
|
||||
m1=m1ch();m2=m2ch();m3=m3ch();m4=m4ch();
|
||||
if((m1==motStop)&&(m2==motStop)&&(m3==motStop)&&(m4==motStop)){
|
||||
stBuz=bzoff;
|
||||
stCiclo=omchiuso;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ motMov_st m4ch(void){
|
||||
}
|
||||
break;
|
||||
case motStopRamp:
|
||||
if(ramp(43,FW,m4pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
if(ramp(M4,FW,m4pwmch,0,tramp,RAMPRUN)==DONE){
|
||||
m4st=motStop;
|
||||
}
|
||||
break;
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
../Core/Src/eeprom.h:121:24:EEW_Read 1
|
||||
../Core/Src/eeprom.h:126:24:EEW_Write 1
|
||||
../Core/Src/cdc_int.c:27:6:toHex 17
|
||||
../Core/Src/cdc_int.c:63:6:manageCDC 71
|
||||
../Core/Src/cdc_int.c:29:6:toHex 17
|
||||
../Core/Src/cdc_int.c:65:6:manageCDC 75
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
../Core/Src/eeprom.h:121:24:EEW_Read 16 static
|
||||
../Core/Src/eeprom.h:126:24:EEW_Write 16 static
|
||||
../Core/Src/cdc_int.c:27:6:toHex 16 static
|
||||
../Core/Src/cdc_int.c:63:6:manageCDC 184 static
|
||||
../Core/Src/cdc_int.c:29:6:toHex 16 static
|
||||
../Core/Src/cdc_int.c:65:6:manageCDC 184 static
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
../Core/Src/main.c:146:6:HAL_SYSTICK_Callback 20
|
||||
../Core/Src/main.c:197:6:managePulsanti 23
|
||||
../Core/Src/main.c:247:6:manageCiclo 83
|
||||
../Core/Src/main.c:446:5:main 2
|
||||
../Core/Src/main.c:530:6:SystemClock_Config 4
|
||||
../Core/Src/main.c:578:13:MX_ADC1_Init 7
|
||||
../Core/Src/main.c:661:13:MX_TIM2_Init 9
|
||||
../Core/Src/main.c:737:13:MX_TIM4_Init 9
|
||||
../Core/Src/main.c:811:13:MX_USART1_UART_Init 2
|
||||
../Core/Src/main.c:842:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:860:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:936:6:Error_Handler 1
|
||||
../Core/Src/main.c:148:6:HAL_SYSTICK_Callback 24
|
||||
../Core/Src/main.c:207:6:managePulsanti 23
|
||||
../Core/Src/main.c:263:6:manageCiclo 83
|
||||
../Core/Src/main.c:464:5:main 2
|
||||
../Core/Src/main.c:548:6:SystemClock_Config 4
|
||||
../Core/Src/main.c:596:13:MX_ADC1_Init 7
|
||||
../Core/Src/main.c:679:13:MX_TIM2_Init 9
|
||||
../Core/Src/main.c:755:13:MX_TIM4_Init 9
|
||||
../Core/Src/main.c:829:13:MX_USART1_UART_Init 2
|
||||
../Core/Src/main.c:860:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:878:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:954:6:Error_Handler 1
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
../Core/Src/main.c:146:6:HAL_SYSTICK_Callback 16 static
|
||||
../Core/Src/main.c:197:6:managePulsanti 4 static
|
||||
../Core/Src/main.c:247:6:manageCiclo 16 static
|
||||
../Core/Src/main.c:446:5:main 8 static
|
||||
../Core/Src/main.c:530:6:SystemClock_Config 88 static
|
||||
../Core/Src/main.c:578:13:MX_ADC1_Init 24 static
|
||||
../Core/Src/main.c:661:13:MX_TIM2_Init 64 static
|
||||
../Core/Src/main.c:737:13:MX_TIM4_Init 64 static
|
||||
../Core/Src/main.c:811:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:842:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:860:13:MX_GPIO_Init 40 static
|
||||
../Core/Src/main.c:936:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
../Core/Src/main.c:148:6:HAL_SYSTICK_Callback 16 static
|
||||
../Core/Src/main.c:207:6:managePulsanti 8 static
|
||||
../Core/Src/main.c:263:6:manageCiclo 24 static
|
||||
../Core/Src/main.c:464:5:main 8 static
|
||||
../Core/Src/main.c:548:6:SystemClock_Config 88 static
|
||||
../Core/Src/main.c:596:13:MX_ADC1_Init 24 static
|
||||
../Core/Src/main.c:679:13:MX_TIM2_Init 64 static
|
||||
../Core/Src/main.c:755:13:MX_TIM4_Init 64 static
|
||||
../Core/Src/main.c:829:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:860:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:878:13:MX_GPIO_Init 40 static
|
||||
../Core/Src/main.c:954:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
../Core/Src/mot.c:39:11:m1ap 10
|
||||
../Core/Src/mot.c:76:11:m2ap 10
|
||||
../Core/Src/mot.c:113:11:m3ap 10
|
||||
../Core/Src/mot.c:150:11:m4ap 10
|
||||
../Core/Src/mot.c:187:11:m1ch 10
|
||||
../Core/Src/mot.c:224:11:m2ch 10
|
||||
../Core/Src/mot.c:261:11:m3ch 10
|
||||
../Core/Src/mot.c:298:11:m4ch 10
|
||||
../Core/Src/mot.c:43:11:m1ap 11
|
||||
../Core/Src/mot.c:87:11:m2ap 11
|
||||
../Core/Src/mot.c:131:11:m3ap 11
|
||||
../Core/Src/mot.c:175:11:m4ap 11
|
||||
../Core/Src/mot.c:219:11:m1ch 11
|
||||
../Core/Src/mot.c:263:11:m2ch 11
|
||||
../Core/Src/mot.c:308:11:m3ch 11
|
||||
../Core/Src/mot.c:353:11:m4ch 11
|
||||
|
||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
../Core/Src/mot.c:39:11:m1ap 16 static
|
||||
../Core/Src/mot.c:76:11:m2ap 16 static
|
||||
../Core/Src/mot.c:113:11:m3ap 16 static
|
||||
../Core/Src/mot.c:150:11:m4ap 16 static
|
||||
../Core/Src/mot.c:187:11:m1ch 16 static
|
||||
../Core/Src/mot.c:224:11:m2ch 16 static
|
||||
../Core/Src/mot.c:261:11:m3ch 16 static
|
||||
../Core/Src/mot.c:298:11:m4ch 16 static
|
||||
../Core/Src/mot.c:43:11:m1ap 120 static
|
||||
../Core/Src/mot.c:87:11:m2ap 120 static
|
||||
../Core/Src/mot.c:131:11:m3ap 120 static
|
||||
../Core/Src/mot.c:175:11:m4ap 120 static
|
||||
../Core/Src/mot.c:219:11:m1ch 120 static
|
||||
../Core/Src/mot.c:263:11:m2ch 120 static
|
||||
../Core/Src/mot.c:308:11:m3ch 120 static
|
||||
../Core/Src/mot.c:353:11:m4ch 120 static
|
||||
|
||||
Reference in New Issue
Block a user