step interrupt sleep detection fix
This commit is contained in:
parent
6d7e744ddb
commit
4ed28ba27f
@ -17,7 +17,7 @@
|
|||||||
void pse_sp_start_axis(pse_stepper_conf* conf);
|
void pse_sp_start_axis(pse_stepper_conf* conf);
|
||||||
void pse_sp_stop_axis(pse_stepper_conf* conf);
|
void pse_sp_stop_axis(pse_stepper_conf* conf);
|
||||||
void pse_sp_set_dir(pse_stepper_conf* conf, int dir);
|
void pse_sp_set_dir(pse_stepper_conf* conf, int dir);
|
||||||
//int pse_sp_get_dir(pse_stepper_conf* conf);
|
int pse_sp_get_dir(pse_stepper_conf* conf);
|
||||||
void pse_stepper_planer_tick(pse_unit* units, uint8_t units_num);
|
void pse_stepper_planer_tick(pse_unit* units, uint8_t units_num);
|
||||||
|
|
||||||
void pse_sp_start_all(pse_unit* units, int unit_num);
|
void pse_sp_start_all(pse_unit* units, int unit_num);
|
||||||
|
@ -70,7 +70,7 @@ static void unit_home_handler(lv_event_t * e){
|
|||||||
pse_stepper_conf* c = unit->stepper_conf;
|
pse_stepper_conf* c = unit->stepper_conf;
|
||||||
c->stopAtHome = 1;
|
c->stopAtHome = 1;
|
||||||
c->step_max = 1;
|
c->step_max = 1;
|
||||||
pse_sp_set_dir(c, 1);
|
pse_sp_set_dir(c, 0);
|
||||||
pse_sp_start_axis(c);
|
pse_sp_start_axis(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,10 @@ void pse_stepper_planer_tick(pse_unit* units, uint8_t units_num){
|
|||||||
}
|
}
|
||||||
c->tick_counter++;
|
c->tick_counter++;
|
||||||
HAL_GPIO_WritePin(c->STEP_GPIO_Port, c->STEP_GPIO_Pin, state);
|
HAL_GPIO_WritePin(c->STEP_GPIO_Port, c->STEP_GPIO_Pin, state);
|
||||||
/*c->steps_counter += (pse_sp_get_dir(c)?1:-1) * (state?1:0);
|
c->steps_counter += (pse_sp_get_dir(c)?1:-1) * (state?1:0);
|
||||||
if(c->stopAtHome && c->steps_counter == 0){
|
if(c->stopAtHome && c->steps_counter == 0){
|
||||||
pse_sp_stop_axis(c);
|
pse_sp_stop_axis(c);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,9 +58,9 @@ void pse_sp_set_dir(pse_stepper_conf* conf, int dir){
|
|||||||
HAL_GPIO_WritePin(conf->DIR_GPIO_Port, conf->DIR_GPIO_Pin, dir);
|
HAL_GPIO_WritePin(conf->DIR_GPIO_Port, conf->DIR_GPIO_Pin, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*int pse_sp_get_dir(pse_stepper_conf* conf){
|
int pse_sp_get_dir(pse_stepper_conf* conf){
|
||||||
return HAL_GPIO_ReadPin(conf->DIR_GPIO_Port, conf->DIR_GPIO_Pin);
|
return HAL_GPIO_ReadPin(conf->DIR_GPIO_Port, conf->DIR_GPIO_Pin);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void pse_stepper_planer_compute_sps(pse_unit* unit){
|
void pse_stepper_planer_compute_sps(pse_unit* unit){
|
||||||
pse_stepper_conf* c = unit->stepper_conf;
|
pse_stepper_conf* c = unit->stepper_conf;
|
||||||
@ -73,21 +73,22 @@ void pse_stepper_planer_compute_sps(pse_unit* unit){
|
|||||||
|
|
||||||
void pse_sp_start_all(pse_unit* units, int units_num){
|
void pse_sp_start_all(pse_unit* units, int units_num){
|
||||||
HAL_TIM_Base_Start_IT(htim);
|
HAL_TIM_Base_Start_IT(htim);
|
||||||
units_running = units_num;
|
|
||||||
|
|
||||||
for(int i = 0; i < units_num; i++){
|
for(int i = 0; i < units_num; i++){
|
||||||
if(units[i].enabled)
|
if(units[i].enabled){
|
||||||
pse_sp_start_axis(units[i].stepper_conf);
|
pse_sp_start_axis(units[i].stepper_conf);
|
||||||
|
units_running++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void pse_sp_stop_all(pse_unit* units, int units_num){
|
void pse_sp_stop_all(pse_unit* units, int units_num){
|
||||||
HAL_TIM_Base_Stop_IT(htim);
|
|
||||||
units_running = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < units_num; i++){
|
for(int i = 0; i < units_num; i++){
|
||||||
if(units[i].enabled)
|
if(units[i].enabled)
|
||||||
pse_sp_stop_axis(units[i].stepper_conf);
|
pse_sp_stop_axis(units[i].stepper_conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HAL_TIM_Base_Stop_IT(htim);
|
||||||
|
units_running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pse_sp_set_timer(TIM_HandleTypeDef* tim){
|
void pse_sp_set_timer(TIM_HandleTypeDef* tim){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user