From ffa109fbccf419af8faa644523266f1d87d32da0 Mon Sep 17 00:00:00 2001 From: Artur Silva Date: Wed, 13 Nov 2024 12:08:49 +0000 Subject: [PATCH 1/2] Correct OUT00 limit switch wrong toggling --- Firmware/Pump/app.c | 29 +++++++++++++++++------------ Firmware/Pump/interrupts.c | 4 ++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Firmware/Pump/app.c b/Firmware/Pump/app.c index aa368a0..52d61e4 100644 --- a/Firmware/Pump/app.c +++ b/Firmware/Pump/app.c @@ -30,7 +30,7 @@ void hwbp_app_initialize(void) uint8_t hwH = 1; uint8_t hwL = 1; uint8_t fwH = 1; - uint8_t fwL = 0; + uint8_t fwL = 1; uint8_t ass = 0; /* Start core */ @@ -234,6 +234,9 @@ void core_callback_initialize_hardware(void) { clr_EN_DRIVER; } + + clear_sw_f(); + clear_sw_r(); } void core_callback_reset_registers(void) @@ -438,12 +441,13 @@ void core_callback_t_1ms(void) core_func_send_event(ADD_REG_SW_FORWARD_STATE, true); if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) - { - if(read_SW_F) + set_OUT00; + //{ + //if(read_SW_F) set_OUT00; - else - clr_OUT00; - } + //else + //clr_OUT00; + //} } } } @@ -461,12 +465,13 @@ void core_callback_t_1ms(void) core_func_send_event(ADD_REG_SW_REVERSE_STATE, true); if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) - { - if(read_SW_R) - set_OUT00; - else - clr_OUT00; - } + set_OUT00; + //{ + //if(read_SW_R) + //set_OUT00; + //else + //clr_OUT00; + //} } } } diff --git a/Firmware/Pump/interrupts.c b/Firmware/Pump/interrupts.c index 93307f7..be45460 100644 --- a/Firmware/Pump/interrupts.c +++ b/Firmware/Pump/interrupts.c @@ -91,6 +91,8 @@ ISR(PORTC_INT0_vect, ISR_NAKED) app_regs.REG_SW_FORWARD_STATE = 0; if(app_regs.REG_EVT_ENABLE & B_EVT_SW_FORWARD_STATE) core_func_send_event(ADD_REG_SW_FORWARD_STATE, true); + if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) + clr_OUT00; } clear_sw_f(); } @@ -102,6 +104,8 @@ ISR(PORTC_INT0_vect, ISR_NAKED) app_regs.REG_SW_REVERSE_STATE = 0; if(app_regs.REG_EVT_ENABLE & B_EVT_SW_REVERSE_STATE) core_func_send_event(ADD_REG_SW_REVERSE_STATE, true); + if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) + clr_OUT00; } clear_sw_r(); } From 34bd6671e6535efe083d3e7b40873c1636ef5d51 Mon Sep 17 00:00:00 2001 From: Artur Silva Date: Fri, 20 Dec 2024 08:22:26 +0000 Subject: [PATCH 2/2] Clean code --- Firmware/Pump/app.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Firmware/Pump/app.c b/Firmware/Pump/app.c index 52d61e4..73c44b0 100644 --- a/Firmware/Pump/app.c +++ b/Firmware/Pump/app.c @@ -442,12 +442,6 @@ void core_callback_t_1ms(void) if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) set_OUT00; - //{ - //if(read_SW_F) - set_OUT00; - //else - //clr_OUT00; - //} } } } @@ -466,12 +460,6 @@ void core_callback_t_1ms(void) if((app_regs.REG_DO0_CONFIG & MSK_OUT0_CONF) == GM_OUT0_SWLIMIT) set_OUT00; - //{ - //if(read_SW_R) - //set_OUT00; - //else - //clr_OUT00; - //} } } }