add resurrect for alive checker

This commit is contained in:
Rémi Heredero 2023-08-31 20:01:39 +02:00
parent b95b6619e3
commit 7aab0ef049
2 changed files with 16 additions and 3 deletions

View File

@ -80,8 +80,8 @@ bool ALIVE_processEvent(Event* ev) {
break; break;
case STAL_DEAD: case STAL_DEAD:
if (ev->id == evALborn) { if (ev->id == evALresurrect) {
me->state = STAL_BORN; me->state = STAL_SETUP;
} }
break; break;
@ -238,6 +238,10 @@ void ALIVE_emitStart(ALIVE* me, uint16_t t, int64_t data) {
POST(me, &ALIVE_processEvent, evALstart, t, data); POST(me, &ALIVE_processEvent, evALstart, t, data);
} }
void ALIVE_emitResurrect(ALIVE* me, uint16_t t, int64_t data) {
POST(me, &ALIVE_processEvent, evALresurrect, t, data);
}
/*********** /***********
* SETTERS * * SETTERS *
***********/ ***********/

View File

@ -25,7 +25,8 @@ typedef enum {
evALborn, evALborn,
evALready, evALready,
evALpoll, evALpoll,
evALstart evALstart,
evALresurrect
} ALIVE_EVENTS; } ALIVE_EVENTS;
typedef void (*ALIVE_CALLBACK_FUNCTION)(void*); typedef void (*ALIVE_CALLBACK_FUNCTION)(void*);
@ -162,6 +163,14 @@ void ALIVE_emitPoll(ALIVE* me, uint16_t t, int64_t data);
*/ */
void ALIVE_emitStart(ALIVE* me, uint16_t t, int64_t data); void ALIVE_emitStart(ALIVE* me, uint16_t t, int64_t data);
/**
* Emit the resurrect 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_emitResurrect(ALIVE* me, uint16_t t, int64_t data);
/*********** /***********
* SETTERS * * SETTERS *