Skip to content

Commit

Permalink
Merge branch 'release/fw0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
MicBoucinha committed Aug 16, 2021
2 parents 2682075 + adbb982 commit 9bff5c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
27 changes: 9 additions & 18 deletions Firmware/Pump/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ void hwbp_app_initialize(void)
{
/* Define versions */
uint8_t hwH = 1;
uint8_t hwL = 0;
uint8_t hwL = 1;
uint8_t fwH = 0;
uint8_t fwL = 1;
uint8_t fwL = 2;
uint8_t ass = 0;

/* Start core */
Expand Down Expand Up @@ -228,13 +228,6 @@ void core_callback_reset_registers(void)
// TODO: missing calibration values

app_regs.REG_EVT_ENABLE = (B_EVT_STEP_STATE | B_EVT_DIR_STATE | B_EVT_SW_FORWARD_STATE | B_EVT_SW_REVERSE_STATE | B_EVT_INPUT_STATE | B_EVT_PROTOCOL_STATE);

// update switches initial state
if(read_SW_F)
switch_pressed(DIR_FORWARD);

if(read_SW_R)
switch_pressed(DIR_REVERSE);
}

void core_callback_registers_were_reinitialized(void)
Expand All @@ -261,6 +254,13 @@ void core_callback_registers_were_reinitialized(void)

app_write_REG_MOTOR_MICROSTEP(&app_regs.REG_MOTOR_MICROSTEP);
clr_EN_DRIVER;

// update switches initial state
if(read_SW_F)
switch_pressed(DIR_FORWARD);

if(read_SW_R)
switch_pressed(DIR_REVERSE);
}

/************************************************************************/
Expand Down Expand Up @@ -301,13 +301,6 @@ void core_callback_t_before_exec(void)
clear_but_push();
if(read_BUT_PULL)
clear_but_pull();

// update switches initial state
if(read_SW_F)
switch_pressed(DIR_FORWARD);

if(read_SW_R)
switch_pressed(DIR_REVERSE);

if(running_protocol)
{
Expand Down Expand Up @@ -379,8 +372,6 @@ void core_callback_t_before_exec(void)
app_write_REG_DIR_STATE(&app_regs.REG_DIR_STATE);
app_write_REG_STEP_STATE(&app_regs.REG_STEP_STATE);
}

return;
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions Firmware/Pump/app_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,20 @@ bool app_write_REG_DIR_STATE(void *a)
{
uint8_t reg = *((uint8_t*)a);

app_regs.REG_DIR_STATE = reg;

if(reg != curr_dir)
{
curr_dir = reg;
if(app_regs.REG_ENABLE_MOTOR_DRIVER == B_MOTOR_ENABLE)
{
if(app_regs.REG_EVT_ENABLE & B_EVT_DIR_STATE)
core_func_send_event(ADD_REG_DIR_STATE, true);
}
if(app_regs.REG_EVT_ENABLE & B_EVT_DIR_STATE)
core_func_send_event(ADD_REG_DIR_STATE, true);
}

if(curr_dir)
set_DIR;
else
clr_DIR;

app_regs.REG_DIR_STATE = reg;
return true;
}

Expand Down
12 changes: 4 additions & 8 deletions Firmware/Pump/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,20 @@ ISR(PORTC_INT0_vect, ISR_NAKED)
/************************************************************************/
/* EN_DRIVER_UC & BUT_PUSH & BUT_PULL & BUT_RESET */
/************************************************************************/
extern uint8_t but_push_counter_ms;
extern uint16_t but_long_push_counter_ms;
extern uint8_t but_pull_counter_ms;
extern uint16_t but_long_pull_counter_ms;
extern uint8_t but_reset_counter_ms;
extern void clear_but_push();
extern void clear_but_pull();

ISR(PORTD_INT0_vect, ISR_NAKED)
{
if(!(read_BUT_PUSH))
{
but_push_counter_ms = 25;
but_long_push_counter_ms = 500;
clear_but_push();
}

if(!(read_BUT_PULL))
{
but_pull_counter_ms = 25;
but_long_pull_counter_ms = 500;
clear_but_pull();
}

if(!(read_BUT_RESET))
Expand Down

0 comments on commit 9bff5c0

Please sign in to comment.