Skip to content

Commit

Permalink
state machine unit test passes with new fpp phase 1
Browse files Browse the repository at this point in the history
  • Loading branch information
watney committed Jun 10, 2024
1 parent 7ed6fd1 commit b6bf575
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 45 deletions.
2 changes: 0 additions & 2 deletions FppTest/state_machine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SmTest.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SmTest.fpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SMEvents.fpp"
)

register_fprime_module()
Expand All @@ -13,7 +12,6 @@ set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/test/ut/Tester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/TesterHelpers.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DeviceSm.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SMEvents.fpp"
)
set(UT_MOD_DEPS STest)
register_fprime_ut()
4 changes: 2 additions & 2 deletions FppTest/state_machine/DeviceSm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "stdio.h"
#include "assert.h"
#include "SMEvents.hpp"
#include "DeviceSm.h"
#include "DeviceSm.hpp"


void FppTest::DeviceSm::init()
Expand All @@ -19,7 +19,7 @@ void FppTest::DeviceSm::init()
}


void FppTest::DeviceSm::update(const Svc::SMEvents *e)
void FppTest::DeviceSm::update(const Fw::SMEvents *e)
{
switch (this->state) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef DEVICESM_H_
#define DEVICESM_H_

namespace Svc {
class SMEvents;
namespace Fw {
class SMEvents;
}

namespace FppTest {
Expand Down Expand Up @@ -43,7 +43,7 @@ class DeviceSm {
void * extension;

void init();
void update(const Svc::SMEvents *e);
void update(const Fw::SMEvents *e);

};

Expand Down
3 changes: 3 additions & 0 deletions FppTest/state_machine/Notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fprime-util purge
fprime-util generate --ut -DFPRIME_SKIP_TOOLS_VERSION_CHECK=ON
fprime-util check
14 changes: 0 additions & 14 deletions FppTest/state_machine/SMEvents.fpp

This file was deleted.

2 changes: 1 addition & 1 deletion FppTest/state_machine/SMEvents.hpp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#include "FppTest/state_machine/SMEventsSerializableAc.hpp"
#include "Fw/Types/SMEventsSerializableAc.hpp"
10 changes: 5 additions & 5 deletions FppTest/state_machine/SmTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ SmTest ::~SmTest() {}
// ----------------------------------------------------------------------

void SmTest::schedIn_handler(const NATIVE_INT_TYPE portNum, U32 context) {
Svc::SMEvents event;
Fw::SMEvents event;
event.seteventSignal(DeviceSm::RTI_SIG);

event.setsmId(StateMachine::DEVICE1);
sendEvents_internalInterfaceInvoke(event);
event.setsmId(DEVICE1);
stateMachineInvoke(event);

event.setsmId(StateMachine::DEVICE2);
sendEvents_internalInterfaceInvoke(event);
event.setsmId(DEVICE2);
stateMachineInvoke(event);

}

Expand Down
8 changes: 3 additions & 5 deletions FppTest/state_machine/SmTest.fpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
locate port Svc.Sched at "../../Svc/Sched/Sched.fpp"

module FppTest {

@ A component for testing data product code gen
active component SmTest {


# ----------------------------------------------------------------------
# Types
# ----------------------------------------------------------------------
Expand All @@ -18,11 +17,10 @@ module FppTest {
async input port schedIn: Svc.Sched

state machine DeviceSm

state machine instance device1: DeviceSm
state machine instance device2: DeviceSm



}

}
4 changes: 2 additions & 2 deletions FppTest/state_machine/SmTestComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
namespace FppTest {

namespace StateMachine {
typedef enum {
enum SmId {
DEVICE1,
DEVICE2,
} SmId;
};
};

//! \class SmTestComponentBase
Expand Down
11 changes: 0 additions & 11 deletions FppTest/state_machine/state-machine.fppi

This file was deleted.

6 changes: 6 additions & 0 deletions Fw/Types/Types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ module Fw {
NO_ROOM_LEFT @< No room left in the buffer to serialize data
}

struct SMEvents {
smId : U32
eventSignal: U32
payload: [128] U8
}

@ Deserialization status
enum DeserialStatus {
OK = 0
Expand Down

0 comments on commit b6bf575

Please sign in to comment.