Merge branch 'feature/refactor-alive' into develop
This commit is contained in:
commit
af8b515578
@ -37,7 +37,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
|
||||
CAR_CST.CONTROL_ALIVE_TIME = tmpData.separate.byte3;
|
||||
MEM_write_1_byte(MEMADD_CONTROL_STEERING_MODE, CAR_CST.CONTROL_STEERING_MODE);
|
||||
MEM_write_1_byte(MEMADD_CONTROL_ALIVE_TIME, CAR_CST.CONTROL_ALIVE_TIME);
|
||||
WATCHDOG_setTime(WDcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
|
||||
ALIVE_setAliveTime(ALcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
|
||||
}
|
||||
|
||||
if(idMsg == 0x1) { // CONTROL_SPEED_FACTOR
|
||||
@ -78,7 +78,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
|
||||
MEM_write_1_byte(MEMADD_JOYSTICK_PARAM2, CAR_CST.JOYSTICK_PARAM2);
|
||||
MEM_write_1_byte(MEMADD_JOYSTICK_ALIVE_TIME, CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
|
||||
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
CM_JOY_SETUP(NULL);
|
||||
|
||||
}
|
||||
@ -107,15 +107,15 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){
|
||||
|
||||
if(idMsg == 0xF) { // JOY_ALIVE
|
||||
// - - - -
|
||||
ALIVE_CHECKER_ISALIVE(ACjoy());
|
||||
if(ACjoy()->state == STAC_DEAD){
|
||||
ALIVE_ISALIVE(ALjoy());
|
||||
if(ALjoy()->state == STAL_DEAD){
|
||||
CAR_CST.JOYSTICK_MODE = MEM_read_1_byte(MEMADD_JOYSTICK_MODE);
|
||||
CAR_CST.JOYSTICK_PARAM1 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM1);
|
||||
CAR_CST.JOYSTICK_PARAM2 = MEM_read_1_byte(MEMADD_JOYSTICK_PARAM2);
|
||||
CAR_CST.JOYSTICK_ALIVE_TIME = MEM_read_1_byte(MEMADD_JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_CHECKER_emitBorn(ACjoy(), 0, 0);
|
||||
ALIVE_CHECKER_emitReady(ACjoy(), 100, 0);
|
||||
ALIVE_setAliveTime(ALjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
ALIVE_emitBorn(ALjoy(), 0, 0);
|
||||
ALIVE_emitReady(ALjoy(), 100, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -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
|
259
306-controller_interface.X/middleware/alive.c
Normal file
259
306-controller_interface.X/middleware/alive.c
Normal file
@ -0,0 +1,259 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file alive.c
|
||||
*/
|
||||
|
||||
#include "alive.h"
|
||||
|
||||
void ALIVE_init(ALIVE* me){
|
||||
me->state = STAL_INIT;
|
||||
me->isAlive = false;
|
||||
me->checker = false;
|
||||
me->sender = false;
|
||||
me->haveBreak = true;
|
||||
me->aliveTime = 10;
|
||||
me->setup.f = NULL;
|
||||
me->born.f = NULL;
|
||||
me->wait.f = NULL;
|
||||
me->dead.f = NULL;
|
||||
me->alive.f = NULL;
|
||||
me->break_cb.f = NULL;
|
||||
}
|
||||
|
||||
void ALIVE_startBehaviourChecker(ALIVE* me){
|
||||
POST(me, &ALIVE_processEvent, evALinitChecker, 0, 0);
|
||||
}
|
||||
|
||||
void ALIVE_startBehaviourSender(ALIVE* me){
|
||||
POST(me, &ALIVE_processEvent, evALinitSender, 0, 0);
|
||||
}
|
||||
|
||||
bool ALIVE_processEvent(Event* ev) {
|
||||
bool processed = false;
|
||||
ALIVE* me = (ALIVE*)Event_getTarget(ev);
|
||||
ALIVE_STATES oldState = me->state;
|
||||
evIDT evid = Event_getId(ev);
|
||||
uint64_t data = Event_getData(ev);
|
||||
|
||||
switch (me->state) { // onState
|
||||
case STAL_INIT:
|
||||
if (ev->id == evALinitChecker) {
|
||||
me->state = STAL_SETUP;
|
||||
}
|
||||
if (ev->id == evALinitSender) {
|
||||
me->state = STAL_ALIVE;
|
||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_SETUP:
|
||||
if (ev->id == evALborn) {
|
||||
me->state = STAL_BORN;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_BORN:
|
||||
if (ev->id == evALready) {
|
||||
me->state = STAL_WAIT;
|
||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_WAIT:
|
||||
if (ev->id == evALpoll) {
|
||||
|
||||
if (me->aliveTime == 0) {
|
||||
if (me->haveBreak){
|
||||
me->state = STAL_BREAK;
|
||||
}
|
||||
} else if (me->isAlive){
|
||||
me->state = STAL_WAIT;
|
||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
||||
} else {
|
||||
me->state = STAL_DEAD;
|
||||
}
|
||||
me->isAlive = false;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_DEAD:
|
||||
if (ev->id == evALborn) {
|
||||
me->state = STAL_BORN;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_ALIVE:
|
||||
if (ev->id == evALpoll) {
|
||||
if (me->alive.f != NULL) {
|
||||
me->alive.f(me->alive.p);
|
||||
}
|
||||
if (me->aliveTime == 0) {
|
||||
if (me->haveBreak){
|
||||
me->state == STAL_BREAK;
|
||||
}
|
||||
} else {
|
||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_BREAK:
|
||||
if (ev->id == evALstart) {
|
||||
ALIVE_emitPoll(me, me->aliveTime*10, 0);
|
||||
if (me->checker) {
|
||||
me->state = STAL_WAIT;
|
||||
}
|
||||
if (me->sender) {
|
||||
me->state = STAL_ALIVE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(oldState != me->state){
|
||||
switch (oldState) { // onExit
|
||||
case STAL_INIT:
|
||||
break;
|
||||
|
||||
case STAL_SETUP:
|
||||
break;
|
||||
|
||||
case STAL_BORN:
|
||||
break;
|
||||
|
||||
case STAL_WAIT:
|
||||
break;
|
||||
|
||||
case STAL_DEAD:
|
||||
break;
|
||||
|
||||
case STAL_ALIVE:
|
||||
break;
|
||||
|
||||
case STAL_BREAK:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (me->state) { // onEntry
|
||||
case STAL_INIT:
|
||||
break;
|
||||
|
||||
case STAL_SETUP:
|
||||
if (me->setup.f != NULL) {
|
||||
me->setup.f(me->setup.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_BORN:
|
||||
if (me->born.f != NULL) {
|
||||
me->born.f(me->born.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_WAIT:
|
||||
if (me->wait.f != NULL) {
|
||||
me->wait.f(me->wait.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_DEAD:
|
||||
if (me->dead.f != NULL) {
|
||||
me->dead.f(me->dead.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAL_ALIVE:
|
||||
break;
|
||||
|
||||
case STAL_BREAK:
|
||||
if (me->break_cb.f != NULL) {
|
||||
me->break_cb.f(me->break_cb.p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
void ALIVE_onSetup(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->setup.f = f;
|
||||
me->setup.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_onBorn(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->born.f = f;
|
||||
me->born.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_onWait(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->wait.f = f;
|
||||
me->wait.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_onDead(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->dead.f = f;
|
||||
me->dead.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_onAlive(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->alive.f = f;
|
||||
me->alive.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_onBreak(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p) {
|
||||
me->break_cb.f = f;
|
||||
me->break_cb.p = p;
|
||||
}
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
void ALIVE_emitInitSender(ALIVE* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_processEvent, evALinitSender, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_emitBorn(ALIVE* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_processEvent, evALborn, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_emitReady(ALIVE* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_processEvent, evALready, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_emitPoll(ALIVE* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_processEvent, evALpoll, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_emitStart(ALIVE* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_processEvent, evALstart, t, data);
|
||||
}
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void ALIVE_setIsAlive(ALIVE* me, bool v) {
|
||||
me->isAlive = v;
|
||||
}
|
||||
|
||||
void ALIVE_setHaveBreak(ALIVE* me, bool v) {
|
||||
me->haveBreak = v;
|
||||
}
|
||||
|
||||
void ALIVE_setAliveTime(ALIVE* me, uint8_t v) {
|
||||
me->aliveTime = v;
|
||||
}
|
||||
|
||||
void ALIVE_ISALIVE(ALIVE* me) {
|
||||
ALIVE_setIsAlive(me, true);
|
||||
}
|
178
306-controller_interface.X/middleware/alive.h
Normal file
178
306-controller_interface.X/middleware/alive.h
Normal file
@ -0,0 +1,178 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file alive.h
|
||||
*/
|
||||
#ifndef ALIVE_H
|
||||
#define ALIVE_H
|
||||
|
||||
#include "../xf/xf.h"
|
||||
|
||||
typedef enum {
|
||||
STAL_INIT,
|
||||
STAL_SETUP,
|
||||
STAL_BORN,
|
||||
STAL_WAIT,
|
||||
STAL_DEAD,
|
||||
STAL_ALIVE,
|
||||
STAL_BREAK
|
||||
} ALIVE_STATES;
|
||||
|
||||
typedef enum {
|
||||
evALinitChecker = 15,
|
||||
evALinitSender,
|
||||
evALborn,
|
||||
evALready,
|
||||
evALpoll,
|
||||
evALstart
|
||||
} ALIVE_EVENTS;
|
||||
|
||||
typedef void (*ALIVE_CALLBACK_FUNCTION)(void*);
|
||||
typedef struct {
|
||||
ALIVE_CALLBACK_FUNCTION f; // function
|
||||
void* p; // param(s)
|
||||
} ALIVE_CALLBACK;
|
||||
|
||||
typedef struct {
|
||||
ALIVE_STATES state;
|
||||
bool isAlive;
|
||||
bool checker;
|
||||
bool sender;
|
||||
bool haveBreak;
|
||||
uint8_t aliveTime;
|
||||
ALIVE_CALLBACK setup;
|
||||
ALIVE_CALLBACK born;
|
||||
ALIVE_CALLBACK wait;
|
||||
ALIVE_CALLBACK dead;
|
||||
ALIVE_CALLBACK alive;
|
||||
ALIVE_CALLBACK break_cb;
|
||||
} ALIVE;
|
||||
|
||||
/**
|
||||
* Initialize the ALIVE
|
||||
* @param me the ALIVE itself
|
||||
*/
|
||||
void ALIVE_init(ALIVE* me);
|
||||
|
||||
/**
|
||||
* Start the ALIVE state machine for checker part
|
||||
* @param me the ALIVE itself
|
||||
*/
|
||||
void ALIVE_startBehaviourChecker(ALIVE* me);
|
||||
|
||||
/**
|
||||
* Start the ALIVE state machine for sender part
|
||||
* @param me the ALIVE itself
|
||||
*/
|
||||
void ALIVE_startBehaviourSender(ALIVE* me);
|
||||
|
||||
/**
|
||||
* Process the event
|
||||
* @param ev the event to process
|
||||
* @return true if the event is processed
|
||||
*/
|
||||
bool ALIVE_processEvent(Event* ev);
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state setup
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onSetup(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state born
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onBorn(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state wait
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onWait(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state dead
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onDead(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state alive
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onAlive(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE is entering state break
|
||||
* @param me the ALIVE itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_onBreak(ALIVE* me, ALIVE_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
/**
|
||||
* Emit the born event
|
||||
* @param me the ALIVE itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_emitBorn(ALIVE* me, uint16_t t, int64_t data);
|
||||
|
||||
/**
|
||||
* Emit the ready event
|
||||
* @param me the ALIVE itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_emitReady(ALIVE* me, uint16_t t, int64_t data);
|
||||
|
||||
/**
|
||||
* Emit the poll event
|
||||
* @param me the ALIVE itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_emitPoll(ALIVE* me, uint16_t t, int64_t data);
|
||||
|
||||
/**
|
||||
* Emit the start event
|
||||
* @param me the ALIVE itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_emitStart(ALIVE* me, uint16_t t, int64_t data);
|
||||
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void ALIVE_setIsAlive(ALIVE* me, bool v);
|
||||
|
||||
void ALIVE_setHaveBreak(ALIVE* me, bool v);
|
||||
|
||||
void ALIVE_setAliveTime(ALIVE* me, uint8_t v);
|
||||
|
||||
void ALIVE_ISALIVE(ALIVE* me);
|
||||
|
||||
#endif
|
@ -1,176 +0,0 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file alive_checker.c
|
||||
*/
|
||||
|
||||
#include "alive_checker.h"
|
||||
|
||||
void ALIVE_CHECKER_init(ALIVE_CHECKER* me){
|
||||
me->state = STAC_INIT;
|
||||
me->isAlive = false;
|
||||
me->aliveTime = 10;
|
||||
me->setup.f = NULL;
|
||||
me->born.f = NULL;
|
||||
me->wait.f = NULL;
|
||||
me->dead.f = NULL;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_startBehaviour(ALIVE_CHECKER* me){
|
||||
POST(me, &ALIVE_CHECKER_processEvent, evACinit, 0, 0);
|
||||
}
|
||||
|
||||
bool ALIVE_CHECKER_processEvent(Event* ev) {
|
||||
bool processed = false;
|
||||
ALIVE_CHECKER* me = (ALIVE_CHECKER*)Event_getTarget(ev);
|
||||
ALIVE_CHECKER_STATES oldState = me->state;
|
||||
evIDT evid = Event_getId(ev);
|
||||
uint64_t data = Event_getData(ev);
|
||||
|
||||
switch (me->state) { // onState
|
||||
case STAC_INIT:
|
||||
if (ev->id == evACinit) {
|
||||
me->state = STAC_SETUP;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_SETUP:
|
||||
if (ev->id == evACborn) {
|
||||
me->state = STAC_BORN;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_BORN:
|
||||
if (ev->id == evACready) {
|
||||
me->state = STAC_WAIT;
|
||||
ALIVE_CHECKER_emitPoll(me, me->aliveTime*10, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_WAIT:
|
||||
if (ev->id == evACpoll) {
|
||||
if (me->isAlive) {
|
||||
me->state = STAC_WAIT;
|
||||
ALIVE_CHECKER_emitPoll(me, me->aliveTime*10, 0);
|
||||
} else {
|
||||
me->state = STAC_DEAD;
|
||||
}
|
||||
me->isAlive = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_DEAD:
|
||||
if(ev->id == evACborn) {
|
||||
me->state = STAC_BORN;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(oldState != me->state){
|
||||
switch (oldState) { // onExit
|
||||
case STAC_INIT:
|
||||
break;
|
||||
|
||||
case STAC_SETUP:
|
||||
break;
|
||||
|
||||
case STAC_BORN:
|
||||
break;
|
||||
|
||||
case STAC_WAIT:
|
||||
break;
|
||||
|
||||
case STAC_DEAD:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (me->state) { // onEntry
|
||||
case STAC_INIT:
|
||||
break;
|
||||
|
||||
case STAC_SETUP:
|
||||
if (me->setup.f != NULL) {
|
||||
me->setup.f(me->setup.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_BORN:
|
||||
if (me->born.f != NULL) {
|
||||
me->born.f(me->born.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_WAIT:
|
||||
if (me->wait.f != NULL) {
|
||||
me->wait.f(me->wait.p);
|
||||
}
|
||||
break;
|
||||
|
||||
case STAC_DEAD:
|
||||
if (me->dead.f != NULL) {
|
||||
me->dead.f(me->dead.p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
void ALIVE_CHECKER_onSetup(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p) {
|
||||
me->setup.f = f;
|
||||
me->setup.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_onBorn(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p) {
|
||||
me->born.f = f;
|
||||
me->born.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_onWait(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p) {
|
||||
me->wait.f = f;
|
||||
me->wait.p = p;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_onDead(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p) {
|
||||
me->dead.f = f;
|
||||
me->dead.p = p;
|
||||
}
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
void ALIVE_CHECKER_emitBorn(ALIVE_CHECKER* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_CHECKER_processEvent, evACborn, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_emitReady(ALIVE_CHECKER* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_CHECKER_processEvent, evACready, t, data);
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_emitPoll(ALIVE_CHECKER* me, uint16_t t, int64_t data) {
|
||||
POST(me, &ALIVE_CHECKER_processEvent, evACpoll, t, data);
|
||||
}
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void ALIVE_CHECKER_setAliveTime(ALIVE_CHECKER* me, uint8_t v) {
|
||||
me->aliveTime = v;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_setIsAlive(ALIVE_CHECKER* me, bool v) {
|
||||
me->isAlive = v;
|
||||
}
|
||||
|
||||
void ALIVE_CHECKER_ISALIVE(ALIVE_CHECKER* me) {
|
||||
ALIVE_CHECKER_setIsAlive(me, true);
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file alive_checker.h
|
||||
*/
|
||||
#ifndef ALIVE_CHECKER_H
|
||||
#define ALIVE_CHECKER_H
|
||||
|
||||
#include "../xf/xf.h"
|
||||
|
||||
typedef enum {
|
||||
STAC_INIT,
|
||||
STAC_SETUP,
|
||||
STAC_BORN,
|
||||
STAC_WAIT,
|
||||
STAC_DEAD
|
||||
} ALIVE_CHECKER_STATES;
|
||||
|
||||
typedef enum {
|
||||
evACinit = 15,
|
||||
evACborn,
|
||||
evACready,
|
||||
evACpoll
|
||||
} ALIVE_CHECKER_EVENTS;
|
||||
|
||||
typedef void (*ALIVE_CHECKER_CALLBACK_FUNCTION)(void*);
|
||||
typedef struct {
|
||||
ALIVE_CHECKER_CALLBACK_FUNCTION f; // function
|
||||
void* p; // param(s)
|
||||
} ALIVE_CHECKER_CALLBACK;
|
||||
|
||||
typedef struct {
|
||||
ALIVE_CHECKER_STATES state;
|
||||
bool isAlive;
|
||||
uint8_t aliveTime;
|
||||
ALIVE_CHECKER_CALLBACK setup;
|
||||
ALIVE_CHECKER_CALLBACK born;
|
||||
ALIVE_CHECKER_CALLBACK wait;
|
||||
ALIVE_CHECKER_CALLBACK dead;
|
||||
} ALIVE_CHECKER;
|
||||
|
||||
/**
|
||||
* Initialize the ALIVE_CHECKER
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
*/
|
||||
void ALIVE_CHECKER_init(ALIVE_CHECKER* me);
|
||||
|
||||
/**
|
||||
* Start the ALIVE_CHECKER state machine
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
*/
|
||||
void ALIVE_CHECKER_startBehaviour(ALIVE_CHECKER* me);
|
||||
|
||||
/**
|
||||
* Process the event
|
||||
* @param ev the event to process
|
||||
* @return true if the event is processed
|
||||
*/
|
||||
bool ALIVE_CHECKER_processEvent(Event* ev);
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE_CHECKER is entering state setup
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_CHECKER_onSetup(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE_CHECKER is entering state born
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_CHECKER_onBorn(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE_CHECKER is entering state wait
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_CHECKER_onWait(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the ALIVE_CHECKER is entering state dead
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void ALIVE_CHECKER_onDead(ALIVE_CHECKER* me, ALIVE_CHECKER_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
/**
|
||||
* Emit the born event
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_CHECKER_emitBorn(ALIVE_CHECKER* me, uint16_t t, int64_t data);
|
||||
|
||||
/**
|
||||
* Emit the ready event
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_CHECKER_emitReady(ALIVE_CHECKER* me, uint16_t t, int64_t data);
|
||||
|
||||
/**
|
||||
* Emit the poll event
|
||||
* @param me the ALIVE_CHECKER itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void ALIVE_CHECKER_emitPoll(ALIVE_CHECKER* me, uint16_t t, int64_t data);
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void ALIVE_CHECKER_setAliveTime(ALIVE_CHECKER* me, uint8_t v);
|
||||
void ALIVE_CHECKER_setIsAlive(ALIVE_CHECKER* me, bool v);
|
||||
void ALIVE_CHECKER_ISALIVE(ALIVE_CHECKER* me); // Use this one when you receive CAN message
|
||||
|
||||
#endif
|
@ -1,90 +0,0 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file watchdog.c
|
||||
*/
|
||||
|
||||
#include "watchdog.h"
|
||||
|
||||
void WATCHDOG_init(WATCHDOG* me){
|
||||
me->state = STWD_INIT;
|
||||
me->time = 10;
|
||||
me->alive.f = NULL;
|
||||
}
|
||||
|
||||
void WATCHDOG_startBehaviour(WATCHDOG* me){
|
||||
POST(me, &WATCHDOG_processEvent, evWDinit, 0, 0);
|
||||
}
|
||||
|
||||
bool WATCHDOG_processEvent(Event* ev) {
|
||||
bool processed = false;
|
||||
WATCHDOG* me = (WATCHDOG*)Event_getTarget(ev);
|
||||
WATCHDOG_STATES oldState = me->state;
|
||||
evIDT evid = Event_getId(ev);
|
||||
uint64_t data = Event_getData(ev);
|
||||
|
||||
switch (me->state) { // onState
|
||||
case STWD_INIT:
|
||||
if (ev->id == evWDinit) {
|
||||
me->state = STWD_ALIVE;
|
||||
WATCHDOG_emitPoll(me, 10*me->time, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case STWD_ALIVE:
|
||||
if (ev->id == evWDpoll) {
|
||||
WATCHDOG_emitPoll(me, 10*me->time, 0);
|
||||
if (me->alive.f != NULL) {
|
||||
me->alive.f(me->alive.p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(oldState != me->state){
|
||||
switch (oldState) { // onExit
|
||||
case STWD_INIT:
|
||||
break;
|
||||
|
||||
case STWD_ALIVE:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (me->state) { // onEntry
|
||||
case STWD_INIT:
|
||||
break;
|
||||
|
||||
case STWD_ALIVE:
|
||||
break;
|
||||
}
|
||||
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
void WATCHDOG_onAlive(WATCHDOG* me, WATCHDOG_CALLBACK_FUNCTION f, void* p) {
|
||||
me->alive.f = f;
|
||||
me->alive.p = p;
|
||||
}
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
void WATCHDOG_emitPoll(WATCHDOG* me, uint16_t t, int64_t data) {
|
||||
POST(me, &WATCHDOG_processEvent, evWDpoll, t, data);
|
||||
}
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void WATCHDOG_setTime(WATCHDOG* me, uint8_t v) {
|
||||
me->time = v;
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/**
|
||||
* @author Rémi Heredero
|
||||
* @version 1.0.0
|
||||
* @date August 2023
|
||||
* @file watchdog.h
|
||||
*/
|
||||
#ifndef WATCHDOG_H
|
||||
#define WATCHDOG_H
|
||||
|
||||
#include "../xf/xf.h"
|
||||
|
||||
typedef enum {
|
||||
STWD_INIT,
|
||||
STWD_ALIVE
|
||||
} WATCHDOG_STATES;
|
||||
|
||||
typedef enum {
|
||||
evWDinit = 20,
|
||||
evWDpoll
|
||||
} WATCHDOG_EVENTS;
|
||||
|
||||
typedef void (*WATCHDOG_CALLBACK_FUNCTION)(void*);
|
||||
typedef struct {
|
||||
WATCHDOG_CALLBACK_FUNCTION f; // function
|
||||
void* p; // param(s)
|
||||
} WATCHDOG_CALLBACK;
|
||||
|
||||
typedef struct {
|
||||
WATCHDOG_STATES state;
|
||||
uint8_t time;
|
||||
WATCHDOG_CALLBACK alive;
|
||||
} WATCHDOG;
|
||||
|
||||
/**
|
||||
* Initialize the WATCHDOG
|
||||
* @param me the WATCHDOG itself
|
||||
*/
|
||||
void WATCHDOG_init(WATCHDOG* me);
|
||||
|
||||
/**
|
||||
* Start the WATCHDOG state machine
|
||||
* @param me the WATCHDOG itself
|
||||
*/
|
||||
void WATCHDOG_startBehaviour(WATCHDOG* me);
|
||||
|
||||
/**
|
||||
* Process the event
|
||||
* @param ev the event to process
|
||||
* @return true if the event is processed
|
||||
*/
|
||||
bool WATCHDOG_processEvent(Event* ev);
|
||||
|
||||
/*************
|
||||
* Callbacks *
|
||||
*************/
|
||||
|
||||
/**
|
||||
* Set the callback function to call when the WATCHDOG is entering state alive
|
||||
* @param me the WATCHDOG itself
|
||||
* @param f the function to call
|
||||
* @param p the param(s) to pass to the function
|
||||
*/
|
||||
void WATCHDOG_onAlive(WATCHDOG* me, WATCHDOG_CALLBACK_FUNCTION f, void* p);
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
/**
|
||||
* Emit the poll event
|
||||
* @param me the WATCHDOG itself
|
||||
* @param t time to wait in ms before triggering event
|
||||
* @param data data to put on the event for XF
|
||||
*/
|
||||
void WATCHDOG_emitPoll(WATCHDOG* me, uint16_t t, int64_t data);
|
||||
|
||||
/***********
|
||||
* SETTERS *
|
||||
***********/
|
||||
|
||||
void WATCHDOG_setTime(WATCHDOG* me, uint8_t v);
|
||||
|
||||
#endif
|
@ -26,8 +26,7 @@
|
||||
</logicalFolder>
|
||||
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
|
||||
<itemPath>middleware/can_interface.h</itemPath>
|
||||
<itemPath>middleware/alive_checker.h</itemPath>
|
||||
<itemPath>middleware/watchdog.h</itemPath>
|
||||
<itemPath>middleware/alive.h</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="xf" displayName="xf" projectFiles="true">
|
||||
<itemPath>xf/event.h</itemPath>
|
||||
@ -63,8 +62,7 @@
|
||||
</logicalFolder>
|
||||
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
|
||||
<itemPath>middleware/can_interface.c</itemPath>
|
||||
<itemPath>middleware/alive_checker.c</itemPath>
|
||||
<itemPath>middleware/watchdog.c</itemPath>
|
||||
<itemPath>middleware/alive.c</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="xf" displayName="xf" projectFiles="true">
|
||||
<itemPath>xf/event.c</itemPath>
|
||||
@ -94,7 +92,7 @@
|
||||
<platformTool>PICkit3PlatformTool</platformTool>
|
||||
<languageToolchain>XC8</languageToolchain>
|
||||
<languageToolchainVersion>2.41</languageToolchainVersion>
|
||||
<platform>2</platform>
|
||||
<platform>3</platform>
|
||||
</toolsSet>
|
||||
<packs>
|
||||
<pack name="PIC18F-K_DFP" vendor="Microchip" version="1.7.134"/>
|
||||
|
BIN
UML/alive.pdf
BIN
UML/alive.pdf
Binary file not shown.
287
UML/alive.uxf
287
UML/alive.uxf
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="15.0.0">
|
||||
<zoom_level>15</zoom_level>
|
||||
<zoom_level>14</zoom_level>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>30</y>
|
||||
<w>30</w>
|
||||
<h>30</h>
|
||||
<x>714</x>
|
||||
<y>28</y>
|
||||
<w>56</w>
|
||||
<h>56</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=initial</panel_attributes>
|
||||
<additional_attributes/>
|
||||
@ -15,47 +15,48 @@
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>45</y>
|
||||
<w>90</w>
|
||||
<h>105</h>
|
||||
<x>462</x>
|
||||
<y>70</y>
|
||||
<w>308</w>
|
||||
<h>154</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evInit</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
|
||||
evInitChecker</panel_attributes>
|
||||
<additional_attributes>200.0;10.0;200.0;50.0;10.0;50.0;10.0;90.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>390</x>
|
||||
<y>120</y>
|
||||
<w>285</w>
|
||||
<h>90</h>
|
||||
<x>350</x>
|
||||
<y>196</y>
|
||||
<w>266</w>
|
||||
<h>112</h>
|
||||
</coordinates>
|
||||
<panel_attributes>SETUP
|
||||
--
|
||||
/entry: sendParamsOnCan</panel_attributes>
|
||||
/entry: sendParamsOnCan
|
||||
/entry: checker = true</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>195</y>
|
||||
<w>105</w>
|
||||
<h>105</h>
|
||||
<x>462</x>
|
||||
<y>294</y>
|
||||
<w>98</w>
|
||||
<h>98</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evBorn</panel_attributes>
|
||||
m1=evBorn</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>390</x>
|
||||
<y>270</y>
|
||||
<w>285</w>
|
||||
<h>90</h>
|
||||
<x>350</x>
|
||||
<y>364</y>
|
||||
<w>266</w>
|
||||
<h>84</h>
|
||||
</coordinates>
|
||||
<panel_attributes>BORN
|
||||
--
|
||||
@ -65,10 +66,10 @@ evBorn</panel_attributes>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>390</x>
|
||||
<y>420</y>
|
||||
<w>285</w>
|
||||
<h>120</h>
|
||||
<x>350</x>
|
||||
<y>504</y>
|
||||
<w>266</w>
|
||||
<h>112</h>
|
||||
</coordinates>
|
||||
<panel_attributes>WAIT
|
||||
--
|
||||
@ -80,22 +81,22 @@ isAlive = false</panel_attributes>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>345</y>
|
||||
<w>120</w>
|
||||
<h>105</h>
|
||||
<x>462</x>
|
||||
<y>434</y>
|
||||
<w>112</w>
|
||||
<h>98</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evReady</panel_attributes>
|
||||
m1=evReady</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>390</x>
|
||||
<y>720</y>
|
||||
<w>285</w>
|
||||
<h>90</h>
|
||||
<x>350</x>
|
||||
<y>784</y>
|
||||
<w>266</w>
|
||||
<h>84</h>
|
||||
</coordinates>
|
||||
<panel_attributes>DEAD
|
||||
--
|
||||
@ -105,94 +106,166 @@ evReady</panel_attributes>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>525</y>
|
||||
<w>105</w>
|
||||
<h>105</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evPoll</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>495</x>
|
||||
<y>600</y>
|
||||
<w>60</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=decision</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>645</y>
|
||||
<w>90</w>
|
||||
<h>105</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=[else]</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>315</x>
|
||||
<y>465</y>
|
||||
<x>280</x>
|
||||
<y>546</y>
|
||||
<w>210</w>
|
||||
<h>210</h>
|
||||
<h>182</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=[isAlive]</panel_attributes>
|
||||
<additional_attributes>120.0;110.0;10.0;110.0;10.0;10.0;50.0;10.0</additional_attributes>
|
||||
m1=evPoll\n[isAlive]</panel_attributes>
|
||||
<additional_attributes>80.0;50.0;80.0;110.0;10.0;110.0;10.0;10.0;50.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>660</x>
|
||||
<y>135</y>
|
||||
<w>210</w>
|
||||
<h>405</h>
|
||||
<x>224</x>
|
||||
<y>392</y>
|
||||
<w>336</w>
|
||||
<h>560</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evDisable</panel_attributes>
|
||||
<additional_attributes>10.0;250.0;60.0;250.0;60.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>255</x>
|
||||
<y>300</y>
|
||||
<w>300</w>
|
||||
<h>600</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
evBorn</panel_attributes>
|
||||
m1=evBorn</panel_attributes>
|
||||
<additional_attributes>180.0;340.0;180.0;380.0;10.0;380.0;10.0;10.0;90.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>660</x>
|
||||
<y>495</y>
|
||||
<w>120</w>
|
||||
<h>315</h>
|
||||
<x>462</x>
|
||||
<y>602</y>
|
||||
<w>112</w>
|
||||
<h>210</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-</panel_attributes>
|
||||
<additional_attributes>10.0;190.0;60.0;190.0;60.0;10.0</additional_attributes>
|
||||
<panel_attributes>lt=->
|
||||
m1=evPoll\n[default]</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;130.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>660</x>
|
||||
<y>315</y>
|
||||
<w>120</w>
|
||||
<h>45</h>
|
||||
<x>728</x>
|
||||
<y>70</y>
|
||||
<w>308</w>
|
||||
<h>154</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;60.0;10.0</additional_attributes>
|
||||
<panel_attributes>lt=->
|
||||
evInitSender</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;50.0;200.0;50.0;200.0;90.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>784</x>
|
||||
<y>252</y>
|
||||
<w>224</w>
|
||||
<h>140</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evPoll\n[else]</panel_attributes>
|
||||
<additional_attributes>100.0;40.0;100.0;70.0;10.0;70.0;10.0;10.0;60.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLNote</id>
|
||||
<coordinates>
|
||||
<x>784</x>
|
||||
<y>28</y>
|
||||
<w>140</w>
|
||||
<h>56</h>
|
||||
</coordinates>
|
||||
<panel_attributes>read time on
|
||||
EPROM</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>868</x>
|
||||
<y>196</y>
|
||||
<w>266</w>
|
||||
<h>112</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ALIVE
|
||||
--
|
||||
\entry: sender = true
|
||||
--
|
||||
sendAliveOnCan</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>868</x>
|
||||
<y>518</y>
|
||||
<w>266</w>
|
||||
<h>84</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..
|
||||
BREAK
|
||||
-..
|
||||
</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>994</x>
|
||||
<y>294</y>
|
||||
<w>210</w>
|
||||
<h>252</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..>
|
||||
m1=evPoll\n[time==0]\n[haveBreak]</panel_attributes>
|
||||
<additional_attributes>60.0;10.0;60.0;110.0;10.0;110.0;10.0;160.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>560</x>
|
||||
<y>546</y>
|
||||
<w>336</w>
|
||||
<h>182</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..>
|
||||
m1=evPoll\n[time==0]\n[haveBreak]</panel_attributes>
|
||||
<additional_attributes>10.0;50.0;10.0;110.0;90.0;110.0;180.0;10.0;220.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>602</x>
|
||||
<y>546</y>
|
||||
<w>420</w>
|
||||
<h>182</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..>
|
||||
m1=evStart\n[checker]</panel_attributes>
|
||||
<additional_attributes>220.0;40.0;220.0;110.0;150.0;110.0;60.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>1078</x>
|
||||
<y>252</y>
|
||||
<w>182</w>
|
||||
<h>476</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..>
|
||||
m1=evStart\n[sender]</panel_attributes>
|
||||
<additional_attributes>10.0;250.0;10.0;320.0;110.0;320.0;110.0;10.0;40.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLNote</id>
|
||||
<coordinates>
|
||||
<x>868</x>
|
||||
<y>728</y>
|
||||
<w>266</w>
|
||||
<h>154</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=..
|
||||
break part can be disable
|
||||
with setHaveBreak(false)
|
||||
|
||||
not all childrens have a break
|
||||
for time at 0</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
</diagram>
|
||||
|
BIN
UML/can_sequence.png
Normal file
BIN
UML/can_sequence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user