merge alive_checker and watchdog to alive class
This commit is contained in:
@ -30,12 +30,12 @@ LED* l8() {
|
||||
return &theFactory.l8_;
|
||||
}
|
||||
|
||||
WATCHDOG* WDcontroller(){
|
||||
return &theFactory.WDcontroller_;
|
||||
ALIVE* ALcontroller(){
|
||||
return &theFactory.ALcontroller_;
|
||||
}
|
||||
|
||||
ALIVE_CHECKER* ACjoy() {
|
||||
return &theFactory.ACjoy_;
|
||||
ALIVE* ALjoy(){
|
||||
return &theFactory.ALjoy_;
|
||||
}
|
||||
|
||||
|
||||
@ -67,10 +67,10 @@ void Factory_init() {
|
||||
MEM_init();
|
||||
|
||||
// TODO init watchdog with EPROM CST
|
||||
WATCHDOG_init(WDcontroller());
|
||||
WATCHDOG_setTime(WDcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
|
||||
ALIVE_init(ALcontroller());
|
||||
ALIVE_setAliveTime(ALcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
|
||||
|
||||
ALIVE_CHECKER_init(ACjoy());
|
||||
ALIVE_init(ALjoy());
|
||||
}
|
||||
|
||||
//connect objects if required
|
||||
@ -78,20 +78,22 @@ void Factory_build() {
|
||||
ECAN_SetRXBnInterruptHandler(CAN_newMsg);
|
||||
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());
|
||||
ALIVE_onAlive(ALcontroller(), CM_CONTROLLER_ALIVE, NULL);
|
||||
|
||||
ALIVE_onSetup(ALjoy(), CM_JOY_SETUP, NULL);
|
||||
ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_onBorn(ALjoy(), LED_on, l1());
|
||||
ALIVE_onDead(ALjoy(), LED_off, l1());
|
||||
|
||||
}
|
||||
|
||||
//start all state machines
|
||||
void Factory_start() {
|
||||
CAN_startBehaviour();
|
||||
WATCHDOG_startBehaviour(WDcontroller());
|
||||
ALIVE_CHECKER_startBehaviour(ACjoy());
|
||||
ALIVE_CHECKER_emitBorn(ACjoy(), 100, 0);
|
||||
ALIVE_CHECKER_emitReady(ACjoy(), 200, 0);
|
||||
|
||||
ALIVE_startBehaviourSender(ALcontroller());
|
||||
ALIVE_startBehaviourChecker(ALjoy());
|
||||
ALIVE_emitBorn(ALjoy(), 100, 0);
|
||||
ALIVE_emitReady(ALjoy(), 200, 0);
|
||||
|
||||
}
|
||||
|
@ -16,9 +16,8 @@
|
||||
#include "../can_message.h"
|
||||
#include "../../board/led/led.h"
|
||||
#include "../../board/button/button.h"
|
||||
#include "../../middleware/alive_checker.h"
|
||||
#include "../../middleware/alive.h"
|
||||
#include "../../middleware/can_interface.h"
|
||||
#include "../../middleware/watchdog.h"
|
||||
#include "../../middleware/eeprom.h"
|
||||
|
||||
|
||||
@ -32,8 +31,8 @@ typedef struct {
|
||||
LED l7_;
|
||||
LED l8_;
|
||||
|
||||
WATCHDOG WDcontroller_;
|
||||
ALIVE_CHECKER ACjoy_;
|
||||
ALIVE ALcontroller_;
|
||||
ALIVE ALjoy_;
|
||||
|
||||
} Factory;
|
||||
|
||||
@ -52,8 +51,8 @@ LED* l6();
|
||||
LED* l7();
|
||||
LED* l8();
|
||||
|
||||
WATCHDOG* WDcontroller();
|
||||
ALIVE_CHECKER* ACjoy();
|
||||
ALIVE* ALcontroller();
|
||||
ALIVE* ALjoy();
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user