From 0d766220edce901b3086da8679a0584850b27634 Mon Sep 17 00:00:00 2001 From: Klagarge Date: Fri, 25 Aug 2023 18:35:01 +0200 Subject: [PATCH] implement alive_checker --- 306-controller_interface.X/app/factory/factory.c | 13 +++---------- .../middleware/alive_checker.c | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/306-controller_interface.X/app/factory/factory.c b/306-controller_interface.X/app/factory/factory.c index 63150e8..2f62bfd 100644 --- a/306-controller_interface.X/app/factory/factory.c +++ b/306-controller_interface.X/app/factory/factory.c @@ -78,23 +78,16 @@ void Factory_init() { ALIVE_CHECKER_init(ACjoy()); } -void foo(uint8_t a, uint8_t b, uint32_t c){ - if(b){ - LED_on(l1()); - } else { - LED_off(l1()); - } - CAN_Send(a, b, c); -} - //connect objects if required void Factory_build() { ECAN_SetRXBnInterruptHandler(CAN_newMsg); - CAN_onReceiveCan(foo); + CAN_onReceiveCan(CM_processIncome); WATCHDOG_onAlive(WDcontroller(), CM_CONTROLLER_ALIVE, NULL); ALIVE_CHECKER_onSetup(ACjoy(), CM_JOY_SETUP, NULL); ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME); + ALIVE_CHECKER_onBorn(ACjoy(), LED_on, l1()); + ALIVE_CHECKER_onDead(ACjoy(), LED_off, l1()); } diff --git a/306-controller_interface.X/middleware/alive_checker.c b/306-controller_interface.X/middleware/alive_checker.c index 7dace84..00466a4 100644 --- a/306-controller_interface.X/middleware/alive_checker.c +++ b/306-controller_interface.X/middleware/alive_checker.c @@ -168,7 +168,7 @@ void ALIVE_CHECKER_setAliveTime(ALIVE_CHECKER* me, uint8_t v) { } void ALIVE_CHECKER_setIsAlive(ALIVE_CHECKER* me, bool v) { - me->aliveTime = v; + me->isAlive = v; } void ALIVE_CHECKER_ISALIVE(ALIVE_CHECKER* me) {