Skip to content

Commit

Permalink
fix subscribe and unsubscribe to idx pin
Browse files Browse the repository at this point in the history
  • Loading branch information
madcowswe committed Apr 25, 2019
1 parent 7190e08 commit 1196026
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Firmware/Board/v3/Src/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ bool GPIO_subscribe(GPIO_TypeDef* GPIO_port, uint16_t GPIO_pin,
GPIO_InitStruct.Pull = pull_up_down;
HAL_GPIO_Init(GPIO_port, &GPIO_InitStruct);

// Clear any previous triggers
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_pin);
// Enable interrupt
HAL_NVIC_SetPriority(get_irq_number(GPIO_pin), 0, 0);
HAL_NVIC_EnableIRQ(get_irq_number(GPIO_pin));
Expand Down
1 change: 1 addition & 0 deletions Firmware/MotorControl/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ bool Encoder::run_index_search() {
if (!config_.idx_search_unidirectional && axis_->motor_.config_.direction == 0) {
axis_->motor_.config_.direction = 1;
}
set_idx_subscribe();

bool orig_finish_on_enc_idx = axis_->config_.lockin.finish_on_enc_idx;
axis_->config_.lockin.finish_on_enc_idx = true;
Expand Down

0 comments on commit 1196026

Please sign in to comment.