增加一个NDEBUG,去掉assert

This commit is contained in:
godcreator 2024-01-29 11:26:42 +08:00
parent 8f17d6c8af
commit b1b74605b8
4 changed files with 10 additions and 6 deletions

View File

@ -96,9 +96,11 @@ int getFSMCurEvent(FSM *pFSM){
void setEvent(FSM* pFSM){ void setEvent(FSM* pFSM){
assert(pFSM->vtbl.selectEvent); assert(pFSM->vtbl.selectEvent);
pFSM->privateVars.curEvent = pFSM->vtbl.selectEvent(pFSM->data);
int e = pFSM->vtbl.selectEvent(pFSM->data); if(0 == pFSM->privateVars.numChild){
pFSM->privateVars.curEvent = e; return;
}
for (int i = 0; i < pFSM->privateVars.numChild; i++) for (int i = 0; i < pFSM->privateVars.numChild; i++)
{ {

View File

@ -3,8 +3,8 @@
#include "FSM_public.h" #include "FSM_public.h"
#define NDEBUG
#define FSM_LOG_ON // #define FSM_LOG_ON
#ifdef FSM_LOG_ON #ifdef FSM_LOG_ON
#define FSM_LOG(...) printf(__VA_ARGS__) #define FSM_LOG(...) printf(__VA_ARGS__)
#else #else

View File

@ -2,6 +2,8 @@
#define __FSM_PUBLIC_H_ #define __FSM_PUBLIC_H_
#define BASE_FSM(ptr) ((FSM *)(ptr)) #define BASE_FSM(ptr) ((FSM *)(ptr))
#define BASE_PTR (FSM *) #define BASE_PTR (FSM *)

View File

@ -10,11 +10,11 @@
*/ */
static Event selectEvent(KeyFSMData *data){ // 必须重新实现 static Event selectEvent(KeyFSMData *data){ // 必须重新实现
if(data->countDelay == 4){ if(data->countDelay == 10){
return HoldCount4; return HoldCount4;
} }
if(data->countDelay == 3){ if(data->countDelay == 5){
return DelayCount3; return DelayCount3;
} }