From a563640a1434312c2b891a11d49158bd266b9ba1 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:07:17 -0400 Subject: [PATCH 01/46] Add load switch component --- .../Components/CMakeLists.txt | 1 + .../Components/LoadSwitch/CMakeLists.txt | 36 ++++++++++ .../Components/LoadSwitch/LoadSwitch.cpp | 28 ++++++++ .../Components/LoadSwitch/LoadSwitch.fpp | 60 +++++++++++++++++ .../Components/LoadSwitch/LoadSwitch.hpp | 42 ++++++++++++ .../Components/LoadSwitch/docs/sdd.md | 67 +++++++++++++++++++ 6 files changed, 234 insertions(+) create mode 100644 FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp create mode 100644 FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index b881a4a6..186ac4e0 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -8,3 +8,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") diff --git a/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt b/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt new file mode 100644 index 00000000..5be47b2d --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/LoadSwitch.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/LoadSwitchTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp new file mode 100644 index 00000000..7476eba7 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -0,0 +1,28 @@ +// ====================================================================== +// \title LoadSwitch.cpp +// \author kyang25 +// \brief cpp file for LoadSwitch component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(compName) {} + +LoadSwitch ::~LoadSwitch() {} + +// ---------------------------------------------------------------------- +// Handler implementations for commands +// ---------------------------------------------------------------------- + +void LoadSwitch ::TODO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp new file mode 100644 index 00000000..32ce8d7e --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -0,0 +1,60 @@ +module Components { + @ A generic load switch for controlling power to components + active component LoadSwitch { + + # One async command/port is required for active components + # This should be overridden by the developers with a useful command/port + @ TODO + async command TODO opcode 0 + + ############################################################################## + #### Uncomment the following examples to start customizing your component #### + ############################################################################## + + # @ Example async command + # async command COMMAND_NAME(param_name: U32) + + # @ Example telemetry counter + # telemetry ExampleCounter: U64 + + # @ Example event + # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + + # @ Example port: receiving calls from the rate group + # sync input port run: Svc.Sched + + # @ Example parameter + # param PARAMETER_NAME: U32 + + ############################################################################### + # Standard AC Ports: Required for Channels, Events, Commands, and Parameters # + ############################################################################### + @ Port for requesting the current time + time get port timeCaller + + @ Port for sending command registrations + command reg port cmdRegOut + + @ Port for receiving commands + command recv port cmdIn + + @ Port for sending command responses + command resp port cmdResponseOut + + @ Port for sending textual representation of events + text event port logTextOut + + @ Port for sending events to downlink + event port logOut + + @ Port for sending telemetry channels to downlink + telemetry port tlmOut + + @ Port to return the value of a parameter + param get port prmGetOut + + @Port to set the value of a parameter + param set port prmSetOut + + } +} \ No newline at end of file diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp new file mode 100644 index 00000000..ae2e61d4 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -0,0 +1,42 @@ +// ====================================================================== +// \title LoadSwitch.hpp +// \author kyang25 +// \brief hpp file for LoadSwitch component implementation class +// ====================================================================== + +#ifndef Components_LoadSwitch_HPP +#define Components_LoadSwitch_HPP + +#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" + +namespace Components { + +class LoadSwitch final : public LoadSwitchComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct LoadSwitch object + LoadSwitch(const char* const compName //!< The component name + ); + + //! Destroy LoadSwitch object + ~LoadSwitch(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for commands + // ---------------------------------------------------------------------- + + //! Handler implementation for command TODO + //! + //! TODO + void TODO_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md new file mode 100644 index 00000000..ccd6de36 --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -0,0 +1,67 @@ +# Components::LoadSwitch + +A generic load switch for controlling power to components + +## Usage Examples +Add usage examples here + +### Diagrams +Add diagrams here + +### Typical Usage +And the typical usage of the component here + +## Class Diagram +Add a class diagram here + +## Port Descriptions +| Name | Description | +|---|---| +|---|---| + +## Component States +| Name | Description | +|-------|--------------------------------------| +| Off | No power to the component | +| On | Power supplied to the component | +| Error | An error occurred in the load switch | + +## Sequence Diagrams +Add sequence diagrams here + +## Parameters +| Name | Description | +|---|---| +|---|---| + +## Commands +| Name | Description | +|---|---| +|---|---| + +## Events +| Name | Description | +|---|---| +|---|---| + +## Telemetry +| Name | Description | +|---|---| +|---|---| + +## Unit Tests +Add unit test descriptions in the chart below +| Name | Description | Output | Coverage | +|---|---|---|---| +|---|---|---|---| + +## Requirements +Add requirements in the chart below +| Name | Description | Validation | +|---|---|---| +|---|---|---| + +## Change Log +| Date | Description | +|---|---| +|---| Initial Draft | \ No newline at end of file From 5d5648faba04dcca61c5d1a31c46c573ebe884a6 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:11:39 -0400 Subject: [PATCH 02/46] Fix tables --- FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index ccd6de36..92c0064d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -50,13 +50,11 @@ Add sequence diagrams here |---|---| ## Unit Tests -Add unit test descriptions in the chart below | Name | Description | Output | Coverage | |---|---|---|---| |---|---|---|---| ## Requirements -Add requirements in the chart below | Name | Description | Validation | |---|---|---| |---|---|---| From 8f00e037a3783a5b4ab39be9f86b8792d92dd479 Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:33:26 -0400 Subject: [PATCH 03/46] Sarah Kevin MoMata Squad Load Switch --- .../Components/LoadSwitch/LoadSwitch.fpp | 5 +++++ .../Components/LoadSwitch/docs/sdd.md | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 32ce8d7e..de5f76a0 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -13,15 +13,20 @@ module Components { # @ Example async command # async command COMMAND_NAME(param_name: U32) + async command TURN_ON() + async command TURN_OFF() # @ Example telemetry counter # telemetry ExampleCounter: U64 + telemetry IsOn: Fw.On # @ Example event # event ExampleStateEvent(example_state: Fw.On) severity activity high id 0 format "State set to {}" + event StatusChanged($state: Fw.On) severity activity high id 1 format "Load switch state changed to {}" # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched + output port Status: Fw.On # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index 92c0064d..0537abb4 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -9,7 +9,7 @@ Add usage examples here Add diagrams here ### Typical Usage -And the typical usage of the component here +The load switch would be used whenever a sensor is to be turned on or off. ## Class Diagram Add a class diagram here @@ -17,7 +17,7 @@ Add a class diagram here ## Port Descriptions | Name | Description | |---|---| -|---|---| +| Status | Boolean value displaying whether the load switch is on or not. | ## Component States | Name | Description | @@ -37,17 +37,18 @@ Add sequence diagrams here ## Commands | Name | Description | |---|---| -|---|---| +| On | Turn on power to the component | +| Off | Turn off power to the component | ## Events | Name | Description | |---|---| -|---|---| +| StatusChanged | Emits event whenever the status of the load switch changes | ## Telemetry | Name | Description | |---|---| -|---|---| +| IsOn | Returns whether the load switch is supplying power to the component or not | ## Unit Tests | Name | Description | Output | Coverage | @@ -62,4 +63,4 @@ Add sequence diagrams here ## Change Log | Date | Description | |---|---| -|---| Initial Draft | \ No newline at end of file +| 10-22-2025 | Sarah, Kevin, and MoMata's first commit | \ No newline at end of file From 628fcbe5e4bbabddeb7fdafb68025c0298890e11 Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:42:09 -0400 Subject: [PATCH 04/46] Sarah Kevin and MoMata fixed a bug --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index de5f76a0..b6167b85 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -4,8 +4,6 @@ module Components { # One async command/port is required for active components # This should be overridden by the developers with a useful command/port - @ TODO - async command TODO opcode 0 ############################################################################## #### Uncomment the following examples to start customizing your component #### @@ -26,7 +24,7 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - output port Status: Fw.On + output port Status: Drv.GpioRead # @ Example parameter # param PARAMETER_NAME: U32 From 91b25fe9bbbccc5929a3cc4d70defe65b15bb15a Mon Sep 17 00:00:00 2001 From: sarah Date: Wed, 22 Oct 2025 20:43:39 -0400 Subject: [PATCH 05/46] Commit farming --- .../Components/LoadSwitch/LoadSwitch.cpp | 9 +++++++-- .../Components/LoadSwitch/LoadSwitch.hpp | 17 ++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 7476eba7..a4c28a8d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.cpp -// \author kyang25 +// \author sarah // \brief cpp file for LoadSwitch component implementation class // ====================================================================== @@ -20,7 +20,12 @@ LoadSwitch ::~LoadSwitch() {} // Handler implementations for commands // ---------------------------------------------------------------------- -void LoadSwitch ::TODO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { +void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { + // TODO + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); +} + +void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { // TODO this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index ae2e61d4..92e5dc3d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.hpp -// \author kyang25 +// \author sarah // \brief hpp file for LoadSwitch component implementation class // ====================================================================== @@ -29,12 +29,15 @@ class LoadSwitch final : public LoadSwitchComponentBase { // Handler implementations for commands // ---------------------------------------------------------------------- - //! Handler implementation for command TODO - //! - //! TODO - void TODO_cmdHandler(FwOpcodeType opCode, //!< The opcode - U32 cmdSeq //!< The command sequence number - ) override; + //! Handler implementation for command TURN_ON + void TURN_ON_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; + + //! Handler implementation for command TURN_OFF + void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode + U32 cmdSeq //!< The command sequence number + ) override; }; } // namespace Components From 076bf65e67e655de525ade13b85b4d8a2a27f7b0 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 22 Oct 2025 21:13:52 -0400 Subject: [PATCH 06/46] Added mcp23017 to v5 dtsi --- .../proves_flight_control_board_v5.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 397708c7..41715c98 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -137,4 +137,20 @@ zephyr_udc0: &usbd { lsb-microamp = <100>; label = "INA219"; }; + mcp23017: mcp23017@20 { + compatible = "microchip,mcp23017"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + + // GPIO line names for traceability + gpio-line-names = "FACE4_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", + "FACE3_ENABLE", "FACE5_ENABLE", "READONLY", "CHARGE", + "ENABLE_Heater", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", + "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3"; + + reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + + ngpios = <16>; + }; }; From 24a2e97777035706e14dd9e7eef9e49ebf97cb4b Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Thu, 23 Oct 2025 12:53:24 -0400 Subject: [PATCH 07/46] Rough initial implementation + add to topology --- .../Components/LoadSwitch/LoadSwitch.cpp | 16 ++++++++++++++-- .../Components/LoadSwitch/LoadSwitch.hpp | 11 +++++++++++ .../Top/ReferenceDeploymentPackets.fppi | 4 ++++ .../Top/ReferenceDeploymentTopology.cpp | 3 +++ .../ReferenceDeployment/Top/instances.fpp | 5 +++++ .../ReferenceDeployment/Top/topology.fpp | 2 ++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index a4c28a8d..c8420616 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -21,13 +21,25 @@ LoadSwitch ::~LoadSwitch() {} // ---------------------------------------------------------------------- void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - // TODO + gpio_pin_set(m_device, m_pinNum, 1); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON); + // I think some code needed to send this status to the port as well this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - // TODO + gpio_pin_set(m_device, m_pinNum, 0); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF); + // I think some code needed to send this status to the port as well this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } + +// This is meant to be used in Topology.cpp to configure the pin and device +void LoadSwitch ::pin_configuration(const struct device* device, uint8_t pinNum) { + this->m_pinNum = pinNum; + this->m_device = device; + gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_INACTIVE); +} + } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 92e5dc3d..585e193d 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -8,6 +8,7 @@ #define Components_LoadSwitch_HPP #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +#include namespace Components { @@ -24,6 +25,12 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Destroy LoadSwitch object ~LoadSwitch(); + // ---------------------------------------------------------------------- + // Configuration Meant to be used in ***Topology.cpp + // ---------------------------------------------------------------------- + + void pin_configuration(const struct device* device, uint8_t pinNum); + private: // ---------------------------------------------------------------------- // Handler implementations for commands @@ -38,6 +45,10 @@ class LoadSwitch final : public LoadSwitchComponentBase { void TURN_OFF_cmdHandler(FwOpcodeType opCode, //!< The opcode U32 cmdSeq //!< The command sequence number ) override; + + uint8_t m_pinNum; + static const struct device* m_device; + }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index 4c2e3fc1..566f68a1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -55,7 +55,11 @@ telemetry packets ReferenceDeploymentPackets { } + } omit { + # Needs to be added appropriately later + loadSwitch1.IsOn + CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions CdhCore.version.LibraryVersion02 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 21306966..156660ee 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -16,6 +16,8 @@ static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire0), gpios); static const struct gpio_dt_spec burnwire1Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire1), gpios); +static const struct device *mcp23017_dev = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); + // Allows easy reference to objects in FPP/autocoder required namespaces using namespace ReferenceDeployment; @@ -59,6 +61,7 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + loadSwitch1.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index bdbb36a8..133cc7d3 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -35,6 +35,11 @@ module ReferenceDeployment { queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 4 + + instance loadSwitch1: Components.LoadSwitch base id 0x10003000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 # ---------------------------------------------------------------------- # Queued component instances diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 89626e35..3a25a838 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -42,6 +42,8 @@ module ReferenceDeployment { instance comSplitterTelemetry # For UART sideband communication instance comDriver + + instance loadSwitch1 # ---------------------------------------------------------------------- # Pattern graph specifiers From 3761180c517bcd262c6dd8deb908e352f62ea0b4 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Thu, 23 Oct 2025 12:56:14 -0400 Subject: [PATCH 08/46] Ion even know any mane --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index c8420616..ed53998b 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -8,6 +8,7 @@ namespace Components { +const struct device* LoadSwitch::m_device = nullptr; // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- From 3fec032d319372e918a1503ac7a6403e61a6ff75 Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:25:28 -0800 Subject: [PATCH 09/46] Working Device Tree (But F Prime Crash) --- .../Components/LoadSwitch/LoadSwitch.cpp | 1 + .../Components/LoadSwitch/LoadSwitch.hpp | 4 +- .../proves_flight_control_board_v5.dtsi | 112 +++++++++++++++++- 3 files changed, 115 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 351e2ea5..e92b1aea 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -5,6 +5,7 @@ // ====================================================================== #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp" +#include namespace Components { diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index bb4288b3..12d79c01 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -7,9 +7,11 @@ #ifndef Components_LoadSwitch_HPP #define Components_LoadSwitch_HPP -#include #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +// Forward declare Zephyr types to avoid header conflicts +struct device; + namespace Components { class LoadSwitch final : public LoadSwitchComponentBase { diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index 4aa68723..d4db1c0d 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -178,8 +178,118 @@ zephyr_udc0: &usbd { "ENABLE_Heater", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3"; - reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; ngpios = <16>; }; }; + +// GPIO Expander IO +/ { + + // Define the GPIO outputs based on your schematic + gpio_outputs { + compatible = "gpio-leds"; // Using gpio-leds as a convenient container + + face4_enable: face4-enable { + + gpios = <&mcp23017 8 GPIO_ACTIVE_HIGH>; // GPB0 + label = "FACE4_ENABLE"; + }; + + face0_enable: face0-enable { + + gpios = <&mcp23017 9 GPIO_ACTIVE_HIGH>; // GPB1 + label = "FACE0_ENABLE"; + }; + + face1_enable: face1-enable { + + gpios = <&mcp23017 10 GPIO_ACTIVE_HIGH>; // GPB2 + label = "FACE1_ENABLE"; + }; + + face2_enable: face2-enable { + + gpios = <&mcp23017 11 GPIO_ACTIVE_HIGH>; // GPB3 + label = "FACE2_ENABLE"; + }; + + face3_enable: face3-enable { + + gpios = <&mcp23017 12 GPIO_ACTIVE_HIGH>; // GPB4 + label = "FACE3_ENABLE"; + }; + + face5_enable: face5-enable { + + gpios = <&mcp23017 13 GPIO_ACTIVE_HIGH>; // GPB5 + label = "FACE5_ENABLE"; + }; + + enable_heater: enable-heater { + + gpios = <&mcp23017 0 GPIO_ACTIVE_HIGH>; // GPA0 + label = "ENABLE_Heater"; + }; + + payload_pwr_enable: payload-pwr-enable { + + gpios = <&mcp23017 1 GPIO_ACTIVE_HIGH>; // GPA1 + label = "PAYLOAD_PWR_ENABLE"; + }; + + fire_deploy2_b: fire-deploy2-b { + + gpios = <&mcp23017 2 GPIO_ACTIVE_HIGH>; // GPA2 + label = "FIRE_DEPLOY2_B"; + }; + + payload_batt_enable: payload-batt-enable { + + gpios = <&mcp23017 3 GPIO_ACTIVE_HIGH>; // GPA3 + label = "PAYLOAD_BATT_ENABLE"; + }; + }; + + // Define GPIO inputs + gpio_inputs { + compatible = "gpio-keys"; + + charge: charge { + + gpios = <&mcp23017 16 GPIO_ACTIVE_HIGH>; // GPB7 + label = "CHARGE"; + }; + + readonly: readonly { + + gpios = <&mcp23017 15 GPIO_ACTIVE_HIGH>; // GPB6 + label = "READONLY"; + }; + + rf2_io2: rf2-io2 { + + gpios = <&mcp23017 4 GPIO_ACTIVE_HIGH>; // GPA4 + label = "RF2_IO2"; + }; + + rf2_io1: rf2-io1 { + + gpios = <&mcp23017 5 GPIO_ACTIVE_HIGH>; // GPA5 + label = "RF2_IO1"; + }; + + rf2_io0: rf2-io0 { + + gpios = <&mcp23017 6 GPIO_ACTIVE_HIGH>; // GPA6 + label = "RF2_IO0"; + }; + + rf2_io3: rf2-io3 { + + gpios = <&mcp23017 7 GPIO_ACTIVE_HIGH>; // GPA7 + label = "RF2_IO3"; + }; + }; +}; From 09c61fdc4284ec3690e3e7b4dddcc035de2f93fa Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:33:58 -0800 Subject: [PATCH 10/46] Update CommandDispatcherImplCfg.hpp Fixed the Crashes! --- .../project/config/CommandDispatcherImplCfg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp index ab88a46b..350367d4 100644 --- a/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp +++ b/FprimeZephyrReference/project/config/CommandDispatcherImplCfg.hpp @@ -11,7 +11,7 @@ // Define configuration values for dispatcher enum { - CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 50, // !< The size of the table holding opcodes to dispatch + CMD_DISPATCHER_DISPATCH_TABLE_SIZE = 100, // !< The size of the table holding opcodes to dispatch CMD_DISPATCHER_SEQUENCER_TABLE_SIZE = 10, // !< The size of the table holding commands in progress }; From b5544e72a29ec50fe48ecca11732e4597469210a Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Tue, 4 Nov 2025 11:13:29 -0500 Subject: [PATCH 11/46] Update Submodules --- lib/fprime | 2 +- lib/fprime-zephyr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fprime b/lib/fprime index 064b6455..626473fc 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit 064b64553f1c0dce5afd43453bbf58993004e1e2 +Subproject commit 626473fc4e89e491d43ad95bb0d1b7727014c80d diff --git a/lib/fprime-zephyr b/lib/fprime-zephyr index 11c2a109..dc83bef6 160000 --- a/lib/fprime-zephyr +++ b/lib/fprime-zephyr @@ -1 +1 @@ -Subproject commit 11c2a109c0225745237c46a0f45902ffc598500b +Subproject commit dc83bef61c25c65d3854cf65b045daf42a6a58f9 From 5351c58c7df7578d7488d40d5ccc28142590a07a Mon Sep 17 00:00:00 2001 From: Michael Pham <61564344+Mikefly123@users.noreply.github.com> Date: Tue, 4 Nov 2025 16:42:40 -0800 Subject: [PATCH 12/46] Revert "Update Submodules" This reverts commit b5544e72a29ec50fe48ecca11732e4597469210a. --- lib/fprime | 2 +- lib/fprime-zephyr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fprime b/lib/fprime index 626473fc..064b6455 160000 --- a/lib/fprime +++ b/lib/fprime @@ -1 +1 @@ -Subproject commit 626473fc4e89e491d43ad95bb0d1b7727014c80d +Subproject commit 064b64553f1c0dce5afd43453bbf58993004e1e2 diff --git a/lib/fprime-zephyr b/lib/fprime-zephyr index dc83bef6..11c2a109 160000 --- a/lib/fprime-zephyr +++ b/lib/fprime-zephyr @@ -1 +1 @@ -Subproject commit dc83bef61c25c65d3854cf65b045daf42a6a58f9 +Subproject commit 11c2a109c0225745237c46a0f45902ffc598500b From 91322979dc50c046eb73caf3e859d5b609d7c54c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:09:53 +0000 Subject: [PATCH 13/46] Initial plan From 72c314d3b32165e9af87afe91811bca291b41e0c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:17:34 +0000 Subject: [PATCH 14/46] Reset m_totalAttempts in resetDeploymentState to fix integration test failures Co-authored-by: Mikefly123 <61564344+Mikefly123@users.noreply.github.com> --- .../Components/AntennaDeployer/AntennaDeployer.cpp | 1 + .../Components/AntennaDeployer/AntennaDeployer.fpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp index 933b64df..e008c1b1 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp @@ -219,6 +219,7 @@ void AntennaDeployer ::resetDeploymentState() { this->m_state = DeploymentState::IDLE; this->m_currentAttempt = 0; this->m_ticksInState = 0; + this->m_totalAttempts = 0; this->m_stopRequested = false; this->m_successDetected = false; this->m_lastDistanceValid = false; diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp index a882c08f..00980d02 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp @@ -28,7 +28,7 @@ module Components { ###################################################################### # Telemetry ###################################################################### - @ Counts the number of deployment attempts across boots + @ Counts the number of deployment attempts in the current deployment session telemetry DeployAttemptCount: U32 @ Tracks the last observed distance reading From 55f96f5575b2fc2fe4b2ba962097750723c26251 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:20:07 +0000 Subject: [PATCH 15/46] Fix integration test failures - final status Co-authored-by: Mikefly123 <61564344+Mikefly123@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From e5afec120cc0ab5bbab18ed0ce38cfee374cd307 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:20:54 +0000 Subject: [PATCH 16/46] Remove CodeQL artifact and update gitignore Co-authored-by: Mikefly123 <61564344+Mikefly123@users.noreply.github.com> --- .gitignore | 1 + _codeql_detected_source_root | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 _codeql_detected_source_root diff --git a/.gitignore b/.gitignore index 352a9f89..35c3901a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ settings.ini **/*.egg-info/ bin/ +_codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root deleted file mode 120000 index 945c9b46..00000000 --- a/_codeql_detected_source_root +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file From 46e660460cc7cb7e39e6d7aae99335afd88a27be Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 20:35:23 -0500 Subject: [PATCH 17/46] Add Reset port functionality --- .../Components/LoadSwitch/LoadSwitch.cpp | 10 ++++++++++ .../Components/LoadSwitch/LoadSwitch.fpp | 5 +++++ .../Components/LoadSwitch/LoadSwitch.hpp | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index e92b1aea..b61ff198 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -18,6 +18,16 @@ LoadSwitch ::LoadSwitch(const char* const compName) : LoadSwitchComponentBase(co LoadSwitch ::~LoadSwitch() {} +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +void LoadSwitch ::Reset_handler(FwIndexType portNum) { + gpio_pin_set(m_device, m_pinNum, 0); + k_sleep(K_MSEC(100)); + gpio_pin_set(m_device, m_pinNum, 1); +} + // ---------------------------------------------------------------------- // Handler implementations for commands // ---------------------------------------------------------------------- diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index ff564b24..d00d49b1 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -26,6 +26,11 @@ module Components { # sync input port run: Svc.Sched output port Status: Drv.GpioRead + + # Input that will be used by other components if they want to force a reset + # (off and on again) of the load switch + async input port Reset: Fw.Signal + # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 12d79c01..bc94e4ea 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -8,6 +8,7 @@ #define Components_LoadSwitch_HPP #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +#include // Forward declare Zephyr types to avoid header conflicts struct device; @@ -48,6 +49,18 @@ class LoadSwitch final : public LoadSwitchComponentBase { U32 cmdSeq //!< The command sequence number ) override; + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for Reset + void Reset_handler(FwIndexType portNum //!< The port number + ) override; + + // ---------------------------------------------------------------------- + // Member variables + // ---------------------------------------------------------------------- + uint8_t m_pinNum; static const struct device* m_device; }; From 98326f2630f9f875847e97ddab3fc6714d498337 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:54:13 -0500 Subject: [PATCH 18/46] Add remaining load switch instances --- .../Top/ReferenceDeploymentTopology.cpp | 9 ++++- .../ReferenceDeployment/Top/instances.fpp | 37 ++++++++++++++++++- .../ReferenceDeployment/Top/topology.fpp | 9 ++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 7f242a01..da089523 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -61,7 +61,14 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); - loadSwitch1.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 + face4LoadSwitch.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 + face0LoadSwitch.pin_configuration(mcp23017_dev, 1); // Pin 1 on MCP23017 + face1LoadSwitch.pin_configuration(mcp23017_dev, 2); // Pin 2 on MCP23017 + face2LoadSwitch.pin_configuration(mcp23017_dev, 3); // Pin 3 on MCP23017 + face3LoadSwitch.pin_configuration(mcp23017_dev, 4); // Pin 4 on MCP23017 + face5LoadSwitch.pin_configuration(mcp23017_dev, 5); // Pin 5 on MCP23017 + payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 7); // Pin 7 on MCP23017 + payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 9); // Pin 9 on MCP23017 } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 19d28754..f98c69b6 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,7 +37,42 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance loadSwitch1: Components.LoadSwitch base id 0x10004000 \ + instance face4LoadSwitch: Components.LoadSwitch base id 0x10014000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face0LoadSwitch: Components.LoadSwitch base id 0x10010000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face1LoadSwitch: Components.LoadSwitch base id 0x10011000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face2LoadSwitch: Components.LoadSwitch base id 0x10012000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face3LoadSwitch: Components.LoadSwitch base id 0x10013000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance face5LoadSwitch: Components.LoadSwitch base id 0x10015000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10016000 \ + queue size Default.QUEUE_SIZE \ + stack size Default.STACK_SIZE \ + priority 5 + + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10017000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 9b0cd82b..d96a5013 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -44,7 +44,14 @@ module ReferenceDeployment { # For UART sideband communication instance comDriver - instance loadSwitch1 + instance face4LoadSwitch + instance face0LoadSwitch + instance face1LoadSwitch + instance face2LoadSwitch + instance face3LoadSwitch + instance face5LoadSwitch + instance payloadPowerLoadSwitch + instance payloadBatteryLoadSwitch instance fsSpace From 9c72d7a550bcec6c6c16b4cfe0a7f1fb5451f502 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 21:11:02 -0500 Subject: [PATCH 19/46] Small updates to extra loadSwitch instances, update max packets - Max packets from 8 to 9 --- .../Top/ReferenceDeploymentPackets.fppi | 13 ++++++++++--- .../ReferenceDeployment/Top/instances.fpp | 18 +++++++++--------- .../project/config/TlmPacketizerCfg.hpp | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index e3097dab..ec186e21 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -61,11 +61,18 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.antennaDeployer.LastDistance } + packet LoadSwitches id 9 group 4 { + ReferenceDeployment.face4LoadSwitch.IsOn + ReferenceDeployment.face0LoadSwitch.IsOn + ReferenceDeployment.face1LoadSwitch.IsOn + ReferenceDeployment.face2LoadSwitch.IsOn + ReferenceDeployment.face3LoadSwitch.IsOn + ReferenceDeployment.face5LoadSwitch.IsOn + ReferenceDeployment.payloadPowerLoadSwitch.IsOn + ReferenceDeployment.payloadBatteryLoadSwitch.IsOn + } } omit { - # Needs to be added appropriately later - loadSwitch1.IsOn - CdhCore.cmdDisp.CommandErrors # Only has one library, no custom versions CdhCore.version.LibraryVersion02 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index f98c69b6..016dee51 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,47 +37,47 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance face4LoadSwitch: Components.LoadSwitch base id 0x10014000 \ + instance face4LoadSwitch: Components.LoadSwitch base id 0x10003000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face0LoadSwitch: Components.LoadSwitch base id 0x10010000 \ + instance face0LoadSwitch: Components.LoadSwitch base id 0x10004000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face1LoadSwitch: Components.LoadSwitch base id 0x10011000 \ + instance face1LoadSwitch: Components.LoadSwitch base id 0x10005000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face2LoadSwitch: Components.LoadSwitch base id 0x10012000 \ + instance face2LoadSwitch: Components.LoadSwitch base id 0x10006000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face3LoadSwitch: Components.LoadSwitch base id 0x10013000 \ + instance face3LoadSwitch: Components.LoadSwitch base id 0x10007000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance face5LoadSwitch: Components.LoadSwitch base id 0x10015000 \ + instance face5LoadSwitch: Components.LoadSwitch base id 0x10008000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10016000 \ + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10009000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x10017000 \ + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1000A000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 - instance prmDb: Svc.PrmDb base id 0x10003000 \ + instance prmDb: Svc.PrmDb base id 0x1000B000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 5 diff --git a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp index 3c11895d..e86a06c9 100644 --- a/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp +++ b/FprimeZephyrReference/project/config/TlmPacketizerCfg.hpp @@ -16,7 +16,7 @@ #include namespace Svc { -static const FwChanIdType MAX_PACKETIZER_PACKETS = 8; +static const FwChanIdType MAX_PACKETIZER_PACKETS = 9; static const FwChanIdType TLMPACKETIZER_NUM_TLM_HASH_SLOTS = 15; // !< Number of slots in the hash table. // Works best when set to about twice the number of components producing telemetry From d7fce15cb716d9acb0ec37453beee03042a3b4a5 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Wed, 5 Nov 2025 21:13:19 -0500 Subject: [PATCH 20/46] Remove output read port, add output write port --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index d00d49b1..8a166d55 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -24,7 +24,11 @@ module Components { # @ Example port: receiving calls from the rate group # sync input port run: Svc.Sched - output port Status: Drv.GpioRead + #output port Status: Drv.GpioRead + #We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already! + + @ Port sending calls to the GPIO driver + output port gpioSet: Drv.GpioWrite # Input that will be used by other components if they want to force a reset From 4dff326e78590c0de76c915b044adc89a2d5315e Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Fri, 7 Nov 2025 18:00:08 -0500 Subject: [PATCH 21/46] Modify LoadSwitch to use ZephyrGpioDriver Component --- .../Components/LoadSwitch/LoadSwitch.cpp | 24 ++++++++----------- .../Components/LoadSwitch/LoadSwitch.hpp | 12 ---------- .../Top/ReferenceDeploymentTopology.cpp | 2 ++ 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index b61ff198..a40e015a 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -9,7 +9,6 @@ namespace Components { -const struct device* LoadSwitch::m_device = nullptr; // ---------------------------------------------------------------------- // Component construction and destruction // ---------------------------------------------------------------------- @@ -23,9 +22,13 @@ LoadSwitch ::~LoadSwitch() {} // ---------------------------------------------------------------------- void LoadSwitch ::Reset_handler(FwIndexType portNum) { - gpio_pin_set(m_device, m_pinNum, 0); + this->gpioSet_out(0, Fw::Logic::LOW); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF); + this->tlmWrite_IsOn(Fw::On::OFF); k_sleep(K_MSEC(100)); - gpio_pin_set(m_device, m_pinNum, 1); + this->gpioSet_out(0, Fw::Logic::HIGH); + this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON); + this->tlmWrite_IsOn(Fw::On::ON); } // ---------------------------------------------------------------------- @@ -33,24 +36,17 @@ void LoadSwitch ::Reset_handler(FwIndexType portNum) { // ---------------------------------------------------------------------- void LoadSwitch ::TURN_ON_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - gpio_pin_set(m_device, m_pinNum, 1); + this->gpioSet_out(0, Fw::Logic::HIGH); this->log_ACTIVITY_HI_StatusChanged(Fw::On::ON); - // I think some code needed to send this status to the port as well + this->tlmWrite_IsOn(Fw::On::ON); this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } void LoadSwitch ::TURN_OFF_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - gpio_pin_set(m_device, m_pinNum, 0); + this->gpioSet_out(0, Fw::Logic::LOW); this->log_ACTIVITY_HI_StatusChanged(Fw::On::OFF); - // I think some code needed to send this status to the port as well + this->tlmWrite_IsOn(Fw::On::OFF); this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } -// This is meant to be used in Topology.cpp to configure the pin and device -void LoadSwitch ::pin_configuration(const struct device* device, uint8_t pinNum) { - this->m_pinNum = pinNum; - this->m_device = device; - gpio_pin_configure(m_device, m_pinNum, GPIO_OUTPUT_INACTIVE); -} - } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index bc94e4ea..e3a5cf92 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -28,12 +28,6 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Destroy LoadSwitch object ~LoadSwitch(); - // ---------------------------------------------------------------------- - // Configuration Meant to be used in ***Topology.cpp - // ---------------------------------------------------------------------- - - void pin_configuration(const struct device* device, uint8_t pinNum); - private: // ---------------------------------------------------------------------- // Handler implementations for commands @@ -57,12 +51,6 @@ class LoadSwitch final : public LoadSwitchComponentBase { void Reset_handler(FwIndexType portNum //!< The port number ) override; - // ---------------------------------------------------------------------- - // Member variables - // ---------------------------------------------------------------------- - - uint8_t m_pinNum; - static const struct device* m_device; }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index da089523..978d5f12 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -61,6 +61,7 @@ void configureTopology() { gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + /* face4LoadSwitch.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 face0LoadSwitch.pin_configuration(mcp23017_dev, 1); // Pin 1 on MCP23017 face1LoadSwitch.pin_configuration(mcp23017_dev, 2); // Pin 2 on MCP23017 @@ -69,6 +70,7 @@ void configureTopology() { face5LoadSwitch.pin_configuration(mcp23017_dev, 5); // Pin 5 on MCP23017 payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 7); // Pin 7 on MCP23017 payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 9); // Pin 9 on MCP23017 + */ } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment From 3d91f1ef399d9aac85a83f48c75327958acdf549 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Fri, 7 Nov 2025 18:05:51 -0500 Subject: [PATCH 22/46] Modify gpioDriver name for watchdog for clarity --- .../ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp | 2 +- FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp | 2 +- FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 978d5f12..33d01b8a 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -58,7 +58,7 @@ void configureTopology() { rateGroup10Hz.configure(rateGroup10HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup10HzContext)); rateGroup1Hz.configure(rateGroup1HzContext, FW_NUM_ARRAY_ELEMENTS(rateGroup1HzContext)); - gpioDriver.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioWatchdog.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); /* diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 016dee51..6b6a4c29 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -98,7 +98,7 @@ module ReferenceDeployment { instance comDriver: Zephyr.ZephyrUartDriver base id 0x10013000 - instance gpioDriver: Zephyr.ZephyrGpioDriver base id 0x10014000 + instance gpioWatchdog: Zephyr.ZephyrGpioDriver base id 0x10014000 instance watchdog: Components.Watchdog base id 0x10015000 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index d96a5013..6de451e0 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -26,7 +26,7 @@ module ReferenceDeployment { instance rateGroupDriver instance timer instance lora - instance gpioDriver + instance gpioWatchdog instance gpioBurnwire0 instance gpioBurnwire1 instance watchdog From 60951531d7d5aad1d3f18330fec3fad463fa6121 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Fri, 7 Nov 2025 18:36:49 -0500 Subject: [PATCH 23/46] Instances of GPIO Drivers, connected to load switches in topology --- .../Top/ReferenceDeploymentTopology.cpp | 27 +++++++++++-------- .../ReferenceDeployment/Top/instances.fpp | 19 ++++++++++++- .../ReferenceDeployment/Top/topology.fpp | 21 ++++++++++++++- 3 files changed, 54 insertions(+), 13 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp index 33d01b8a..d1b81510 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp @@ -16,7 +16,14 @@ static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios); static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire0), gpios); static const struct gpio_dt_spec burnwire1Gpio = GPIO_DT_SPEC_GET(DT_NODELABEL(burnwire1), gpios); -static const struct device* mcp23017_dev = DEVICE_DT_GET(DT_NODELABEL(mcp23017)); +static const struct gpio_dt_spec face0LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face0_enable), gpios); +static const struct gpio_dt_spec face1LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face1_enable), gpios); +static const struct gpio_dt_spec face2LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face2_enable), gpios); +static const struct gpio_dt_spec face3LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face3_enable), gpios); +static const struct gpio_dt_spec face4LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face4_enable), gpios); +static const struct gpio_dt_spec face5LoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(face5_enable), gpios); +static const struct gpio_dt_spec payloadPowerLoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(payload_pwr_enable), gpios); +static const struct gpio_dt_spec payloadBatteryLoadSwitchGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(payload_batt_enable), gpios); // Allows easy reference to objects in FPP/autocoder required namespaces using namespace ReferenceDeployment; @@ -61,16 +68,14 @@ void configureTopology() { gpioWatchdog.open(ledGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire0.open(burnwire0Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); gpioBurnwire1.open(burnwire1Gpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); - /* - face4LoadSwitch.pin_configuration(mcp23017_dev, 0); // Pin 0 on MCP23017 - face0LoadSwitch.pin_configuration(mcp23017_dev, 1); // Pin 1 on MCP23017 - face1LoadSwitch.pin_configuration(mcp23017_dev, 2); // Pin 2 on MCP23017 - face2LoadSwitch.pin_configuration(mcp23017_dev, 3); // Pin 3 on MCP23017 - face3LoadSwitch.pin_configuration(mcp23017_dev, 4); // Pin 4 on MCP23017 - face5LoadSwitch.pin_configuration(mcp23017_dev, 5); // Pin 5 on MCP23017 - payloadPowerLoadSwitch.pin_configuration(mcp23017_dev, 7); // Pin 7 on MCP23017 - payloadBatteryLoadSwitch.pin_configuration(mcp23017_dev, 9); // Pin 9 on MCP23017 - */ + gpioface4LS.open(face4LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioface0LS.open(face0LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioface1LS.open(face1LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioface2LS.open(face2LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioface3LS.open(face3LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioface5LS.open(face5LoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioPayloadPowerLS.open(payloadPowerLoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); + gpioPayloadBatteryLS.open(payloadBatteryLoadSwitchGpio, Zephyr::ZephyrGpioDriver::GpioConfiguration::OUT); } // Public functions for use in main program are namespaced with deployment name ReferenceDeployment diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 6b6a4c29..441454d8 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -128,5 +128,22 @@ module ReferenceDeployment { instance antennaDeployer: Components.AntennaDeployer base id 0x10029000 - instance fsSpace: Components.FsSpace base id 0x10030000 + instance gpioface4LS: Zephyr.ZephyrGpioDriver base id 0x1002A000 + + instance gpioface0LS: Zephyr.ZephyrGpioDriver base id 0x1002B000 + + instance gpioface1LS: Zephyr.ZephyrGpioDriver base id 0x1002C000 + + instance gpioface2LS: Zephyr.ZephyrGpioDriver base id 0x1002D000 + + instance gpioface3LS: Zephyr.ZephyrGpioDriver base id 0x1002E000 + + instance gpioface5LS: Zephyr.ZephyrGpioDriver base id 0x1002F000 + + instance gpioPayloadPowerLS: Zephyr.ZephyrGpioDriver base id 0x10030000 + + instance gpioPayloadBatteryLS: Zephyr.ZephyrGpioDriver base id 0x10031000 + + instance fsSpace: Components.FsSpace base id 0x10032000 + } diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 6de451e0..ca45badb 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -29,6 +29,14 @@ module ReferenceDeployment { instance gpioWatchdog instance gpioBurnwire0 instance gpioBurnwire1 + instance gpioface0LS + instance gpioface1LS + instance gpioface2LS + instance gpioface3LS + instance gpioface4LS + instance gpioface5LS + instance gpioPayloadPowerLS + instance gpioPayloadBatteryLS instance watchdog instance prmDb instance rtcManager @@ -151,7 +159,18 @@ module ReferenceDeployment { connections Watchdog { - watchdog.gpioSet -> gpioDriver.gpioWrite + watchdog.gpioSet -> gpioWatchdog.gpioWrite + } + + connections LoadSwitches { + face4LoadSwitch.gpioSet -> gpioface4LS.gpioWrite + face0LoadSwitch.gpioSet -> gpioface0LS.gpioWrite + face1LoadSwitch.gpioSet -> gpioface1LS.gpioWrite + face2LoadSwitch.gpioSet -> gpioface2LS.gpioWrite + face3LoadSwitch.gpioSet -> gpioface3LS.gpioWrite + face5LoadSwitch.gpioSet -> gpioface5LS.gpioWrite + payloadPowerLoadSwitch.gpioSet -> gpioPayloadPowerLS.gpioWrite + payloadBatteryLoadSwitch.gpioSet -> gpioPayloadBatteryLS.gpioWrite } connections BurnwireGpio { From 2b9f0a91db381c6337f23bba206a858a5938afac Mon Sep 17 00:00:00 2001 From: Ethan Hu Date: Fri, 7 Nov 2025 18:42:05 -0500 Subject: [PATCH 24/46] First implementation load_switch_test --- .../test/int/load_switch_test.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 FprimeZephyrReference/test/int/load_switch_test.py diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py new file mode 100644 index 00000000..e1f7a651 --- /dev/null +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -0,0 +1,82 @@ +""" +load_switch_test.py: + +Integration tests for the Load-Switch component. +""" + +import time + +import pytest +from common import proves_send_and_assert_command +from fprime_gds.common.data_types.ch_data import ChData +from fprime_gds.common.testing_fw.api import IntegrationTestAPI + +loadswitch = "ReferenceDeployment.loadswitch" + +@pytest.fixture(autouse=True) +def ensure_loadswitch_off(fprime_test_api: IntegrationTestAPI, start_gds): + """Ensure LoadSwitch starts in OFF state""" + turn_off(fprime_test_api) + yield + turn_off(fprime_test_api) + +def turn_on(fprime_test_api: IntegrationTestAPI): + """Helper function to turn on the loadswitch""" + proves_send_and_assert_command( + fprime_test_api, + f"{loadswitch}.TURN_ON", + ) + +def turn_off(fprime_test_api: IntegrationTestAPI): + """Helper function to turn off the loadswitch""" + proves_send_and_assert_command( + fprime_test_api, + f"{loadswitch}.TURN_OFF" + ) + +def get_is_on(fprime_test_api: IntegrationTestAPI) -> int: + """Helper function to request packet and get fresh IsOn telemetry""" + proves_send_and_assert_command( + fprime_test_api, + "CdhCore.tlmSend.SEND_PKT", + ["9"], + ) + result: ChData = fprime_test_api.assert_telemetry( + f"{loadswitch}.IsOn", start="NOW", timeout=3 + ) + return result.get_val() + +def test_01_loadswitch_telemetry_basic(fprime_test_api: IntegrationTestAPI, start_gds): + """Test that we can read IsOn telemetry""" + value = get_is_on(fprime_test_api) + assert value in (0, 1), f"IsOn should be 0 or 1, got {value}" + +def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): + """ + Test TURN_ON command sets GPIO high, emits ON event, and updates telemetry + """ + + # Send turn_on command + turn_on(fprime_test_api) + + # Confirm Load-Switch turned ON + fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[1], timeout=2) + + # Confirm telemetry IsOn is 1 + value = get_is_on(fprime_test_api) + assert value == 1, f"Expected IsOn = 1 after TURN_ON, got {value}" + +def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): + """ + Test TURN_OFF command sets GPIO low, emits OFF event, and updates telemetry + """ + + # Send turn_on command + turn_off(fprime_test_api) + + # Confirm Load-Switch turned OFF + fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[0], timeout=2) + + # Confirm telemetry IsOn is 0 + value = get_is_on(fprime_test_api) + assert value == 0, f"Expected IsOn = 0 after TURN_OFF, got {value}" \ No newline at end of file From b65806baa19cca0646c361e8b2106ffed71b4c8c Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Fri, 7 Nov 2025 18:56:47 -0500 Subject: [PATCH 25/46] Labels for devicetree gpios fixed --- .../proves_flight_control_board_v5.dtsi | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi index d4db1c0d..e8934b63 100644 --- a/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi +++ b/boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi @@ -166,22 +166,40 @@ zephyr_udc0: &usbd { lsb-microamp = <100>; label = "INA219"; }; - mcp23017: mcp23017@20 { - compatible = "microchip,mcp23017"; - reg = <0x20>; - gpio-controller; - #gpio-cells = <2>; - - // GPIO line names for traceability - gpio-line-names = "FACE4_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", - "FACE3_ENABLE", "FACE5_ENABLE", "READONLY", "CHARGE", - "ENABLE_Heater", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", - "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3"; - - reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; - - ngpios = <16>; - }; + mcp23017: mcp23017@20 { + compatible = "microchip,mcp23017"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + + /* gpio-line-names must match the numeric indexes used below. The + * topology and gpio nodes expect the following mapping (index : name): + * 0: ENABLE_HEATER (GPA0) + * 1: PAYLOAD_PWR_ENABLE (GPA1) + * 2: FIRE_DEPLOY2_B (GPA2) + * 3: PAYLOAD_BATT_ENABLE (GPA3) + * 4: RF2_IO2 (GPA4) + * 5: RF2_IO1 (GPA5) + * 6: RF2_IO0 (GPA6) + * 7: RF2_IO3 (GPA7) + * 8: FACE4_ENABLE (GPB0) + * 9: FACE0_ENABLE (GPB1) + * 10: FACE1_ENABLE (GPB2) + * 11: FACE2_ENABLE (GPB3) + * 12: FACE3_ENABLE (GPB4) + * 13: FACE5_ENABLE (GPB5) + * 14: READONLY (GPB6) + * 15: CHARGE (GPB7) + */ + gpio-line-names = "ENABLE_HEATER", "PAYLOAD_PWR_ENABLE", "FIRE_DEPLOY2_B", "PAYLOAD_BATT_ENABLE", + "RF2_IO2", "RF2_IO1", "RF2_IO0", "RF2_IO3", + "FACE4_ENABLE", "FACE0_ENABLE", "FACE1_ENABLE", "FACE2_ENABLE", + "FACE3_ENABLE", "FACE5_ENABLE", "READONLY", "CHARGE"; + + reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + + ngpios = <16>; + }; }; // GPIO Expander IO From 6f76ed34b615635e8ccca10434c170e27d3b7679 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Fri, 7 Nov 2025 19:06:33 -0500 Subject: [PATCH 26/46] Update sdd --- .../Components/LoadSwitch/docs/LoadSwitch.svg | 1 + .../Components/LoadSwitch/docs/sdd.md | 77 ++++++++----------- 2 files changed, 33 insertions(+), 45 deletions(-) create mode 100644 FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg b/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg new file mode 100644 index 00000000..6bd701fe --- /dev/null +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg @@ -0,0 +1 @@ +LoadSwitchResettimeCallercmdRegOutcmdIncmdResponseOutlogTextOutlogOuttlmOutprmGetOutprmSetOutgpioSet \ No newline at end of file diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md index c1bbcfe8..51d9dec6 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/sdd.md @@ -1,66 +1,53 @@ # Components::LoadSwitch -A generic load switch for controlling power to components +![LoadSwitch](LoadSwitch.svg) -## Usage Examples -Add usage examples here +## Overview -### Diagrams -Add diagrams here +The `LoadSwitch` component is an active F' component that controls a single load switch output +through the `gpioSet` output port (connected to the platform's GPIO driver). It exposes two +async commands to turn the switch on and off, telemetry reporting the current state, and an +async `Reset` input which toggles the switch (off, short delay, on). -### Typical Usage -The load switch would be used whenever a sensor is to be turned on or off. +## Responsibility -## Class Diagram -Add a class diagram here +- Control the power rail for a connected peripheral by asserting/deasserting a GPIO. +- Report state changes via an event and telemetry channel. -## Port Descriptions -| Name | Description | -|---|---| -| Status | Boolean value displaying whether the load switch is on or not. | +## External interface -## Component States -| Name | Description | -|-------|--------------------------------------| -| Off | No power to the component | -| On | Power supplied to the component | -| Error | An error occurred in the load switch | +### Commands -## Sequence Diagrams -Add sequence diagrams here +| Name | Description | Implementation notes | +|---|---|---| +| TURN_ON | Turn on the associated power rail | `TURN_ON_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::HIGH)`, emits `StatusChanged` (ON), updates `IsOn` telemetry, replies OK. | +| TURN_OFF | Turn off the associated power rail | `TURN_OFF_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::LOW)`, emits `StatusChanged` (OFF), updates `IsOn` telemetry, replies OK. | -## Parameters -| Name | Description | -|---|---| -|---|---| +### Telemetry -## Commands -| Name | Description | -|---|---| -| On | Turn on power to the component | -| Off | Turn off power to the component | +| Name | Type | Description | +|---|---:|---| +| IsOn | Fw.On | Current power state; written after commands and on Reset handling. | -## Events -| Name | Description | -|---|---| -| StatusChanged | Emits event whenever the status of the load switch changes | +### Events -## Telemetry -| Name | Description | -|---|---| -| IsOn | Returns whether the load switch is supplying power to the component or not | +| Name | Severity | ID | Format | +|---|---|---:|---| +| StatusChanged | activity high | 1 | "Load switch state changed to {}" | -## Unit Tests -| Name | Description | Output | Coverage | -|---|---|---|---| +The component logs the `StatusChanged` event whenever the switch transitions due to a command or a Reset. + +### Ports + +| Port name | Direction | Port type | Notes | |---|---|---|---| +| gpioSet | output | Drv.GpioWrite | Used to write the physical GPIO. Implementation always uses index 0 (`gpioSet_out(0, ...)`). | +| Reset | input (async) | Fw.Signal | Causes the component to perform a hardware reset sequence: LOW -> wait 100ms -> HIGH. | -## Requirements -| Name | Description | Validation | -|---|---|---| -|---|---|---| ## Change Log + | Date | Description | |---|---| | 10-22-2025 | Sarah, Kevin, and MoMata's first commit | +| 11-07-2025 | Updated SDD to match implementation in `LoadSwitch.cpp/.hpp/.fpp` (commands, telemetry, event, ports, reset behavior). | From 6d010cb94f4d519794e6dad5e99a0516b9414a17 Mon Sep 17 00:00:00 2001 From: robertpendergrast Date: Mon, 10 Nov 2025 20:02:50 -0500 Subject: [PATCH 27/46] Moises made them active lmao --- .../Components/LoadSwitch/LoadSwitch.fpp | 8 +-- .../ReferenceDeployment/Top/instances.fpp | 55 ++++++------------- 2 files changed, 20 insertions(+), 43 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 8a166d55..3a19d287 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -1,6 +1,6 @@ module Components { @ A generic load switch for controlling power to components - active component LoadSwitch { + passive component LoadSwitch { # One async command/port is required for active components # This should be overridden by the developers with a useful command/port @@ -11,8 +11,8 @@ module Components { # @ Example async command # async command COMMAND_NAME(param_name: U32) - async command TURN_ON() - async command TURN_OFF() + sync command TURN_ON() + sync command TURN_OFF() # @ Example telemetry counter # telemetry ExampleCounter: U64 @@ -33,7 +33,7 @@ module Components { # Input that will be used by other components if they want to force a reset # (off and on again) of the load switch - async input port Reset: Fw.Signal + sync input port Reset: Fw.Signal # @ Example parameter # param PARAMETER_NAME: U32 diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 441454d8..e427bd83 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -37,45 +37,6 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance face4LoadSwitch: Components.LoadSwitch base id 0x10003000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance face0LoadSwitch: Components.LoadSwitch base id 0x10004000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance face1LoadSwitch: Components.LoadSwitch base id 0x10005000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance face2LoadSwitch: Components.LoadSwitch base id 0x10006000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance face3LoadSwitch: Components.LoadSwitch base id 0x10007000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance face5LoadSwitch: Components.LoadSwitch base id 0x10008000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10009000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 - - instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1000A000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 5 instance prmDb: Svc.PrmDb base id 0x1000B000 \ queue size Default.QUEUE_SIZE \ @@ -146,4 +107,20 @@ module ReferenceDeployment { instance fsSpace: Components.FsSpace base id 0x10032000 + instance face4LoadSwitch: Components.LoadSwitch base id 0x10033000 + + instance face0LoadSwitch: Components.LoadSwitch base id 0x10034000 + + instance face1LoadSwitch: Components.LoadSwitch base id 0x10035000 + + instance face2LoadSwitch: Components.LoadSwitch base id 0x10036000 + + instance face3LoadSwitch: Components.LoadSwitch base id 0x10037000 + + instance face5LoadSwitch: Components.LoadSwitch base id 0x10038000 + + instance payloadPowerLoadSwitch: Components.LoadSwitch base id 0x10039000 + + instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1003A000 + } From 58d2293aa69ea6d04186214d6a0d07d1cdb1b246 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 01:34:19 -0800 Subject: [PATCH 28/46] corrected merge errors --- FprimeZephyrReference/Components/CMakeLists.txt | 4 ---- .../ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi | 1 + FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index dd336b49..6d9f085f 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -11,8 +11,4 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PowerMonitor/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LoadSwitch/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AntennaDeployer/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FsSpace/") diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi index e7128a88..7c0bd5b1 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi +++ b/FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentPackets.fppi @@ -70,6 +70,7 @@ telemetry packets ReferenceDeploymentPackets { ReferenceDeployment.face5LoadSwitch.IsOn ReferenceDeployment.payloadPowerLoadSwitch.IsOn ReferenceDeployment.payloadBatteryLoadSwitch.IsOn + } packet PowerMonitor id 10 group 4 { ReferenceDeployment.ina219SysManager.Voltage diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 221efde2..d2ff5dfd 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -123,8 +123,6 @@ module ReferenceDeployment { instance payloadBatteryLoadSwitch: Components.LoadSwitch base id 0x1003A000 - instance fsSpace: Components.FsSpace base id 0x1003B000 - instance powerMonitor: Components.PowerMonitor base id 0x1003C000 instance ina219SysManager: Drv.Ina219Manager base id 0x1003D000 From 1664683654d497086dc350b750d6fcd6d43fd173 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 01:35:33 -0800 Subject: [PATCH 29/46] appease linter --- .../Components/LoadSwitch/LoadSwitch.fpp | 6 +++--- .../Components/LoadSwitch/LoadSwitch.hpp | 3 +-- .../Components/LoadSwitch/docs/LoadSwitch.svg | 2 +- .../test/int/load_switch_test.py | 16 +++++++++------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp index 3a19d287..284d3657 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.fpp @@ -26,12 +26,12 @@ module Components { # sync input port run: Svc.Sched #output port Status: Drv.GpioRead #We will not be putting a Drv.GpioRead port here, we are using the Gpio Driver component which has this already! - + @ Port sending calls to the GPIO driver output port gpioSet: Drv.GpioWrite - - # Input that will be used by other components if they want to force a reset + + # Input that will be used by other components if they want to force a reset # (off and on again) of the load switch sync input port Reset: Fw.Signal diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index e3a5cf92..698e2808 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -7,8 +7,8 @@ #ifndef Components_LoadSwitch_HPP #define Components_LoadSwitch_HPP -#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" #include +#include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" // Forward declare Zephyr types to avoid header conflicts struct device; @@ -50,7 +50,6 @@ class LoadSwitch final : public LoadSwitchComponentBase { //! Handler implementation for Reset void Reset_handler(FwIndexType portNum //!< The port number ) override; - }; } // namespace Components diff --git a/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg b/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg index 6bd701fe..a3cfb121 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg +++ b/FprimeZephyrReference/Components/LoadSwitch/docs/LoadSwitch.svg @@ -1 +1 @@ -LoadSwitchResettimeCallercmdRegOutcmdIncmdResponseOutlogTextOutlogOuttlmOutprmGetOutprmSetOutgpioSet \ No newline at end of file +LoadSwitchResettimeCallercmdRegOutcmdIncmdResponseOutlogTextOutlogOuttlmOutprmGetOutprmSetOutgpioSet diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index e1f7a651..314052b3 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -4,8 +4,6 @@ Integration tests for the Load-Switch component. """ -import time - import pytest from common import proves_send_and_assert_command from fprime_gds.common.data_types.ch_data import ChData @@ -13,6 +11,7 @@ loadswitch = "ReferenceDeployment.loadswitch" + @pytest.fixture(autouse=True) def ensure_loadswitch_off(fprime_test_api: IntegrationTestAPI, start_gds): """Ensure LoadSwitch starts in OFF state""" @@ -20,6 +19,7 @@ def ensure_loadswitch_off(fprime_test_api: IntegrationTestAPI, start_gds): yield turn_off(fprime_test_api) + def turn_on(fprime_test_api: IntegrationTestAPI): """Helper function to turn on the loadswitch""" proves_send_and_assert_command( @@ -27,12 +27,11 @@ def turn_on(fprime_test_api: IntegrationTestAPI): f"{loadswitch}.TURN_ON", ) + def turn_off(fprime_test_api: IntegrationTestAPI): """Helper function to turn off the loadswitch""" - proves_send_and_assert_command( - fprime_test_api, - f"{loadswitch}.TURN_OFF" - ) + proves_send_and_assert_command(fprime_test_api, f"{loadswitch}.TURN_OFF") + def get_is_on(fprime_test_api: IntegrationTestAPI) -> int: """Helper function to request packet and get fresh IsOn telemetry""" @@ -46,11 +45,13 @@ def get_is_on(fprime_test_api: IntegrationTestAPI) -> int: ) return result.get_val() + def test_01_loadswitch_telemetry_basic(fprime_test_api: IntegrationTestAPI, start_gds): """Test that we can read IsOn telemetry""" value = get_is_on(fprime_test_api) assert value in (0, 1), f"IsOn should be 0 or 1, got {value}" + def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): """ Test TURN_ON command sets GPIO high, emits ON event, and updates telemetry @@ -66,6 +67,7 @@ def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): value = get_is_on(fprime_test_api) assert value == 1, f"Expected IsOn = 1 after TURN_ON, got {value}" + def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): """ Test TURN_OFF command sets GPIO low, emits OFF event, and updates telemetry @@ -79,4 +81,4 @@ def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): # Confirm telemetry IsOn is 0 value = get_is_on(fprime_test_api) - assert value == 0, f"Expected IsOn = 0 after TURN_OFF, got {value}" \ No newline at end of file + assert value == 0, f"Expected IsOn = 0 after TURN_OFF, got {value}" From a6a6e0ce4d5538a120ba6aa7d99362eae17a513a Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 01:55:08 -0800 Subject: [PATCH 30/46] fixed the queue build error bc of linter --- .clang-format | 1 + FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 65fb646f..f9639a0a 100644 --- a/.clang-format +++ b/.clang-format @@ -3,3 +3,4 @@ BasedOnStyle: Chromium IndentWidth: 4 ColumnLimit: 120 AccessModifierOffset: -2 +SortIncludes: false diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index 698e2808..d66e5fa8 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -7,8 +7,8 @@ #ifndef Components_LoadSwitch_HPP #define Components_LoadSwitch_HPP -#include #include "FprimeZephyrReference/Components/LoadSwitch/LoadSwitchComponentAc.hpp" +#include // Forward declare Zephyr types to avoid header conflicts struct device; From 009516d15753d5d59147ba0104e7decf347102bc Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 10:45:43 -0800 Subject: [PATCH 31/46] fixed burnwire incremnentation --- FprimeZephyrReference/Components/Burnwire/Burnwire.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 581678c6..c883e63a 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -53,8 +53,7 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { U32 timeout = this->paramGet_SAFETY_TIMER(valid); if (this->m_state == Fw::On::ON) { - this->m_safetyCounter++; - if (this->m_safetyCounter == 1) { + if (this->m_safetyCounter == 0) { this->gpioSet_out(0, Fw::Logic::HIGH); this->gpioSet_out(1, Fw::Logic::HIGH); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON); @@ -63,7 +62,10 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { if (this->m_safetyCounter >= timeout) { stopBurn(); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::OFF); + return; } + + this->m_safetyCounter++; } } From 4629c30babb2c45464b8fc3bde3e7888ed6310cd Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 10:52:39 -0800 Subject: [PATCH 32/46] changed increments --- FprimeZephyrReference/Components/Burnwire/Burnwire.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index c883e63a..ce6b146e 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -53,19 +53,18 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { U32 timeout = this->paramGet_SAFETY_TIMER(valid); if (this->m_state == Fw::On::ON) { - if (this->m_safetyCounter == 0) { + this->m_safetyCounter++; + if (this->m_safetyCounter == 1) { this->gpioSet_out(0, Fw::Logic::HIGH); this->gpioSet_out(1, Fw::Logic::HIGH); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::ON); } if (this->m_safetyCounter >= timeout) { + this->m_safetyCounter++; stopBurn(); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::OFF); - return; } - - this->m_safetyCounter++; } } From 4708db945046756bad090e64ef84610e2149c97f Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 11:15:09 -0800 Subject: [PATCH 33/46] move invrement --- FprimeZephyrReference/Components/Burnwire/Burnwire.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index ce6b146e..6db23589 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -54,6 +54,8 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { if (this->m_state == Fw::On::ON) { this->m_safetyCounter++; + printk("safety counter: %u\n", this->m_safetyCounter); + printk("Burnwire safety counter: %u\n", this->m_safetyCounter); if (this->m_safetyCounter == 1) { this->gpioSet_out(0, Fw::Logic::HIGH); this->gpioSet_out(1, Fw::Logic::HIGH); @@ -61,7 +63,6 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { } if (this->m_safetyCounter >= timeout) { - this->m_safetyCounter++; stopBurn(); this->log_ACTIVITY_HI_SafetyTimerStatus(Fw::On::OFF); } From d37d7b360568ec46e1663a3b7ad507505d092917 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 11:19:13 -0800 Subject: [PATCH 34/46] ading inclused --- FprimeZephyrReference/Components/Burnwire/Burnwire.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 6db23589..9444b6dc 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -4,6 +4,8 @@ // ====================================================================== #include "FprimeZephyrReference/Components/Burnwire/Burnwire.hpp" +#include +#include namespace Components { From c72137d5aa8edc64ed455dbee3f68baf5f1c95e9 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 11:24:01 -0800 Subject: [PATCH 35/46] remove the degugs --- FprimeZephyrReference/Components/Burnwire/Burnwire.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 9444b6dc..581678c6 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -4,8 +4,6 @@ // ====================================================================== #include "FprimeZephyrReference/Components/Burnwire/Burnwire.hpp" -#include -#include namespace Components { @@ -56,8 +54,6 @@ void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { if (this->m_state == Fw::On::ON) { this->m_safetyCounter++; - printk("safety counter: %u\n", this->m_safetyCounter); - printk("Burnwire safety counter: %u\n", this->m_safetyCounter); if (this->m_safetyCounter == 1) { this->gpioSet_out(0, Fw::Logic::HIGH); this->gpioSet_out(1, Fw::Logic::HIGH); From 6e58bb900d49b1e3217cb95e68b4f94b641dc456 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 11:52:45 -0800 Subject: [PATCH 36/46] formal burnwire timer --- .../Components/Burnwire/Burnwire.cpp | 24 ++++++++++++++++++- .../Components/Burnwire/Burnwire.hpp | 4 ++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 581678c6..0b8b391a 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -5,6 +5,9 @@ #include "FprimeZephyrReference/Components/Burnwire/Burnwire.hpp" +#include +#include + namespace Components { // ---------------------------------------------------------------------- @@ -14,6 +17,7 @@ namespace Components { Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName) { this->m_safetyCounter = 0; this->m_state = Fw::On::OFF; + this->m_timerRunning = false; } Burnwire ::~Burnwire() {} @@ -34,6 +38,9 @@ void Burnwire::startBurn() { this->m_safetyCounter = 0; this->m_state = Fw::On::ON; + this->m_burnTimer.start(); + this->m_timerRunning = true; + Fw::ParamValid valid; U32 timeout = this->paramGet_SAFETY_TIMER(valid); this->log_ACTIVITY_HI_SafetyTimerState(timeout); @@ -44,8 +51,23 @@ void Burnwire::stopBurn() { this->gpioSet_out(0, Fw::Logic::LOW); this->gpioSet_out(1, Fw::Logic::LOW); + const U32 countedSeconds = this->m_safetyCounter.load(); + + U32 elapsedSeconds = countedSeconds; + if (this->m_timerRunning) { + this->m_burnTimer.stop(); + const U32 elapsedUsec = this->m_burnTimer.getDiffUsec(); + + if (elapsedUsec != std::numeric_limits::max()) { + const U32 roundedSeconds = static_cast((elapsedUsec + 500000U) / 1000000U); + elapsedSeconds = std::max(elapsedSeconds, roundedSeconds); + } + + this->m_timerRunning = false; + } + this->m_state = Fw::On::OFF; - this->log_ACTIVITY_LO_BurnwireEndCount(m_safetyCounter); + this->log_ACTIVITY_LO_BurnwireEndCount(elapsedSeconds); } void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 4f41d832..78592aec 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -6,6 +6,8 @@ #ifndef Components_Burnwire_HPP #define Components_Burnwire_HPP +#include +#include #include #include "FprimeZephyrReference/Components/Burnwire/BurnwireComponentAc.hpp" @@ -63,6 +65,8 @@ class Burnwire final : public BurnwireComponentBase { Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off std::atomic m_safetyCounter; // makes this an atomic variable (so its set only in one command), // you read and write half the value bc a corrupted read could be dangerouts + Os::IntervalTimer m_burnTimer; + bool m_timerRunning = false; }; } // namespace Components From c55dd3011926bb77ae0a6551fa28367073482094 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 11:58:47 -0800 Subject: [PATCH 37/46] switched the order of the rate grounps --- FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 79169a2e..2186cfc7 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -137,8 +137,8 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run rateGroup1Hz.RateGroupMemberOut[5] -> imuManager.run rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn - rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[7] -> antennaDeployer.schedIn + rateGroup1Hz.RateGroupMemberOut[8] -> burnwire.schedIn rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[10] -> powerMonitor.run From 4afa777fe4f987266cab8a17b13a0ab7e5aec338 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 12:00:23 -0800 Subject: [PATCH 38/46] reverted timer debugdding code --- .../Components/Burnwire/Burnwire.cpp | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp index 0b8b391a..581678c6 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.cpp @@ -5,9 +5,6 @@ #include "FprimeZephyrReference/Components/Burnwire/Burnwire.hpp" -#include -#include - namespace Components { // ---------------------------------------------------------------------- @@ -17,7 +14,6 @@ namespace Components { Burnwire ::Burnwire(const char* const compName) : BurnwireComponentBase(compName) { this->m_safetyCounter = 0; this->m_state = Fw::On::OFF; - this->m_timerRunning = false; } Burnwire ::~Burnwire() {} @@ -38,9 +34,6 @@ void Burnwire::startBurn() { this->m_safetyCounter = 0; this->m_state = Fw::On::ON; - this->m_burnTimer.start(); - this->m_timerRunning = true; - Fw::ParamValid valid; U32 timeout = this->paramGet_SAFETY_TIMER(valid); this->log_ACTIVITY_HI_SafetyTimerState(timeout); @@ -51,23 +44,8 @@ void Burnwire::stopBurn() { this->gpioSet_out(0, Fw::Logic::LOW); this->gpioSet_out(1, Fw::Logic::LOW); - const U32 countedSeconds = this->m_safetyCounter.load(); - - U32 elapsedSeconds = countedSeconds; - if (this->m_timerRunning) { - this->m_burnTimer.stop(); - const U32 elapsedUsec = this->m_burnTimer.getDiffUsec(); - - if (elapsedUsec != std::numeric_limits::max()) { - const U32 roundedSeconds = static_cast((elapsedUsec + 500000U) / 1000000U); - elapsedSeconds = std::max(elapsedSeconds, roundedSeconds); - } - - this->m_timerRunning = false; - } - this->m_state = Fw::On::OFF; - this->log_ACTIVITY_LO_BurnwireEndCount(elapsedSeconds); + this->log_ACTIVITY_LO_BurnwireEndCount(m_safetyCounter); } void Burnwire ::schedIn_handler(FwIndexType portNum, U32 context) { From 3e2a959a53e87e23d5656d3a9f9dbc2b0617f745 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 12:43:11 -0800 Subject: [PATCH 39/46] linter --- .../Components/AntennaDeployer/AntennaDeployer.cpp | 13 +++++++++++++ .../Components/AntennaDeployer/AntennaDeployer.fpp | 6 ++++++ .../Components/AntennaDeployer/AntennaDeployer.hpp | 2 ++ .../Components/Burnwire/Burnwire.hpp | 4 ---- .../ReferenceDeployment/Top/topology.fpp | 4 ++-- .../test/int/antenna_deployer_test.py | 10 +++++----- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp index e008c1b1..af859eb2 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp @@ -115,6 +115,7 @@ void AntennaDeployer ::startNextAttempt() { this->m_totalAttempts++; this->tlmWrite_DeployAttemptCount(this->m_totalAttempts); + this->m_burnTicksThisAttempt = 0; if (this->isConnected_burnStart_OutputPort(0)) { this->burnStart_out(0); @@ -140,6 +141,7 @@ void AntennaDeployer ::handleQuietWaitTick() { void AntennaDeployer ::handleBurningTick() { this->m_ticksInState++; + this->m_burnTicksThisAttempt = this->m_ticksInState; if (this->m_stopRequested) { this->finishDeployment(Components::DeployResult::DEPLOY_RESULT_ABORT); @@ -154,6 +156,7 @@ void AntennaDeployer ::handleBurningTick() { const U32 burnDuration = this->paramGet_BURN_DURATION_SEC(valid); if (this->m_ticksInState >= burnDuration) { this->ensureBurnwireStopped(); + this->logBurnSignalCount(); if (this->m_successDetected) { this->finishDeployment(Components::DeployResult::DEPLOY_RESULT_SUCCESS); @@ -205,6 +208,7 @@ void AntennaDeployer ::finishDeployment(Components::DeployResult result) { } this->ensureBurnwireStopped(); + this->logBurnSignalCount(); if (result == Components::DeployResult::DEPLOY_RESULT_SUCCESS) { this->log_ACTIVITY_HI_DeploySuccess(this->m_currentAttempt); @@ -223,6 +227,7 @@ void AntennaDeployer ::resetDeploymentState() { this->m_stopRequested = false; this->m_successDetected = false; this->m_lastDistanceValid = false; + this->m_burnTicksThisAttempt = 0; } bool AntennaDeployer ::isDistanceWithinValidRange(F32 distance) { @@ -241,6 +246,7 @@ bool AntennaDeployer ::isDistanceDeployed(F32 distance) { if (distance <= threshold) { this->m_successDetected = true; + this->logBurnSignalCount(); return true; } @@ -253,4 +259,11 @@ void AntennaDeployer ::ensureBurnwireStopped() { } } +void AntennaDeployer ::logBurnSignalCount() { + if (this->m_burnTicksThisAttempt > 0U) { + this->log_ACTIVITY_LO_AntennaBurnSignalCount(this->m_burnTicksThisAttempt); + this->m_burnTicksThisAttempt = 0; + } +} + } // namespace Components diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp index 00980d02..de64e188 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp @@ -68,6 +68,12 @@ module Components { ) severity activity high \ format "Quiet time expired after {} seconds, starting deployment attempt" + @ Reports how many scheduler ticks the burn signal was held active for the latest attempt + event AntennaBurnSignalCount( + ticks: U32 @< Number of scheduler ticks spent in the burn state + ) severity activity low \ + format "Burn signal active for {} scheduler ticks" + ###################################################################### # Ports ###################################################################### diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.hpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.hpp index d35b8ef0..5661cf60 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.hpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.hpp @@ -52,6 +52,7 @@ class AntennaDeployer final : public AntennaDeployerComponentBase { bool isDistanceWithinValidRange(F32 distance); bool isDistanceDeployed(F32 distance); void ensureBurnwireStopped(); + void logBurnSignalCount(); DeploymentState m_state = DeploymentState::IDLE; U32 m_currentAttempt = 0; @@ -61,6 +62,7 @@ class AntennaDeployer final : public AntennaDeployerComponentBase { bool m_successDetected = false; bool m_lastDistanceValid = false; F32 m_lastDistance = 0.0F; + U32 m_burnTicksThisAttempt = 0; }; } // namespace Components diff --git a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp index 78592aec..4f41d832 100644 --- a/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp +++ b/FprimeZephyrReference/Components/Burnwire/Burnwire.hpp @@ -6,8 +6,6 @@ #ifndef Components_Burnwire_HPP #define Components_Burnwire_HPP -#include -#include #include #include "FprimeZephyrReference/Components/Burnwire/BurnwireComponentAc.hpp" @@ -65,8 +63,6 @@ class Burnwire final : public BurnwireComponentBase { Fw::On m_state = Fw::On::OFF; // keeps track if burnwire is on or off std::atomic m_safetyCounter; // makes this an atomic variable (so its set only in one command), // you read and write half the value bc a corrupted read could be dangerouts - Os::IntervalTimer m_burnTimer; - bool m_timerRunning = false; }; } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp index 2186cfc7..79169a2e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp @@ -137,8 +137,8 @@ module ReferenceDeployment { rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run rateGroup1Hz.RateGroupMemberOut[5] -> imuManager.run rateGroup1Hz.RateGroupMemberOut[6] -> comDelay.run - rateGroup1Hz.RateGroupMemberOut[7] -> antennaDeployer.schedIn - rateGroup1Hz.RateGroupMemberOut[8] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[7] -> burnwire.schedIn + rateGroup1Hz.RateGroupMemberOut[8] -> antennaDeployer.schedIn rateGroup1Hz.RateGroupMemberOut[9] -> fsSpace.run rateGroup1Hz.RateGroupMemberOut[10] -> powerMonitor.run diff --git a/FprimeZephyrReference/test/int/antenna_deployer_test.py b/FprimeZephyrReference/test/int/antenna_deployer_test.py index bd913791..3e5d89a1 100644 --- a/FprimeZephyrReference/test/int/antenna_deployer_test.py +++ b/FprimeZephyrReference/test/int/antenna_deployer_test.py @@ -217,12 +217,12 @@ def test_burn_duration_sec(fprime_test_api: IntegrationTestAPI, start_gds): # Wait for burnwire to stop fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "OFF", timeout=15) - # Verify the burnwire end count shows 3 seconds - burnwire_end_event: EventData = fprime_test_api.assert_event( - f"{burnwire}.BurnwireEndCount", timeout=5 + # Verify the antenna deployer reports the burn duration in ticks (seconds) + burn_signal_event: EventData = fprime_test_api.assert_event( + f"{antenna_deployer}.AntennaBurnSignalCount", timeout=5 ) - assert burnwire_end_event.args[0].val == 3, ( - "Burnwire should have burned for 3 seconds" + assert burn_signal_event.args[0].val == 3, ( + "Burn signal should have been active for 3 scheduler ticks" ) # Verify deployment finishes with failure (no distance sensor) From adac017c8ea5109e0d67f14d09fe0f56df8beccf Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 12:49:27 -0800 Subject: [PATCH 40/46] remove the reset of the count for now --- .../Components/AntennaDeployer/AntennaDeployer.cpp | 1 - .../Components/AntennaDeployer/AntennaDeployer.fpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp index af859eb2..3e963563 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp @@ -223,7 +223,6 @@ void AntennaDeployer ::resetDeploymentState() { this->m_state = DeploymentState::IDLE; this->m_currentAttempt = 0; this->m_ticksInState = 0; - this->m_totalAttempts = 0; this->m_stopRequested = false; this->m_successDetected = false; this->m_lastDistanceValid = false; diff --git a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp index de64e188..d27db3fc 100644 --- a/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp +++ b/FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp @@ -28,7 +28,7 @@ module Components { ###################################################################### # Telemetry ###################################################################### - @ Counts the number of deployment attempts in the current deployment session + @ Counts the number of deployment attempts telemetry DeployAttemptCount: U32 @ Tracks the last observed distance reading From 583a7a45939872285b5c6cee6bde04db0a577cce Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 13:29:12 -0800 Subject: [PATCH 41/46] refer to the right load switch in the tests --- FprimeZephyrReference/test/int/load_switch_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index 314052b3..a9826858 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -9,7 +9,7 @@ from fprime_gds.common.data_types.ch_data import ChData from fprime_gds.common.testing_fw.api import IntegrationTestAPI -loadswitch = "ReferenceDeployment.loadswitch" +loadswitch = "ReferenceDeployment.face0LoadSwitch" @pytest.fixture(autouse=True) From bcfbae867a8276551fd441fbaccb75ca4e87eba2 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 14:57:30 -0800 Subject: [PATCH 42/46] checking a differnt conversion for the tests --- FprimeZephyrReference/test/int/load_switch_test.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index a9826858..7473fbfc 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -9,6 +9,9 @@ from fprime_gds.common.data_types.ch_data import ChData from fprime_gds.common.testing_fw.api import IntegrationTestAPI +ON = "ON" +OFF = "OFF" + loadswitch = "ReferenceDeployment.face0LoadSwitch" @@ -33,7 +36,7 @@ def turn_off(fprime_test_api: IntegrationTestAPI): proves_send_and_assert_command(fprime_test_api, f"{loadswitch}.TURN_OFF") -def get_is_on(fprime_test_api: IntegrationTestAPI) -> int: +def get_is_on(fprime_test_api: IntegrationTestAPI) -> str: """Helper function to request packet and get fresh IsOn telemetry""" proves_send_and_assert_command( fprime_test_api, @@ -49,7 +52,7 @@ def get_is_on(fprime_test_api: IntegrationTestAPI) -> int: def test_01_loadswitch_telemetry_basic(fprime_test_api: IntegrationTestAPI, start_gds): """Test that we can read IsOn telemetry""" value = get_is_on(fprime_test_api) - assert value in (0, 1), f"IsOn should be 0 or 1, got {value}" + assert value in (ON, OFF), f"IsOn should be {ON} or {OFF}, got {value}" def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): @@ -65,7 +68,7 @@ def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): # Confirm telemetry IsOn is 1 value = get_is_on(fprime_test_api) - assert value == 1, f"Expected IsOn = 1 after TURN_ON, got {value}" + assert value == ON, f"Expected IsOn = {ON} after TURN_ON, got {value}" def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): @@ -81,4 +84,4 @@ def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): # Confirm telemetry IsOn is 0 value = get_is_on(fprime_test_api) - assert value == 0, f"Expected IsOn = 0 after TURN_OFF, got {value}" + assert value == OFF, f"Expected IsOn = {OFF} after TURN_OFF, got {value}" From 3d0759de61b2d51330aeb17cf700a12e3ac6ea07 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 15:12:58 -0800 Subject: [PATCH 43/46] missed some binary --- FprimeZephyrReference/test/int/load_switch_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index 7473fbfc..7196c856 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -64,7 +64,7 @@ def test_02_turn_on_sets_high(fprime_test_api: IntegrationTestAPI, start_gds): turn_on(fprime_test_api) # Confirm Load-Switch turned ON - fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[1], timeout=2) + fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[ON], timeout=2) # Confirm telemetry IsOn is 1 value = get_is_on(fprime_test_api) @@ -80,7 +80,7 @@ def test_03_turn_off_sets_low(fprime_test_api: IntegrationTestAPI, start_gds): turn_off(fprime_test_api) # Confirm Load-Switch turned OFF - fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[0], timeout=2) + fprime_test_api.assert_event(f"{loadswitch}.StatusChanged", args=[OFF], timeout=2) # Confirm telemetry IsOn is 0 value = get_is_on(fprime_test_api) From 33453836244f101dcd64d4206627b0f849b818b7 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 16:51:53 -0800 Subject: [PATCH 44/46] switched the telem packets --- FprimeZephyrReference/test/int/load_switch_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index 7196c856..476f576c 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -41,7 +41,7 @@ def get_is_on(fprime_test_api: IntegrationTestAPI) -> str: proves_send_and_assert_command( fprime_test_api, "CdhCore.tlmSend.SEND_PKT", - ["9"], + ["10"], ) result: ChData = fprime_test_api.assert_telemetry( f"{loadswitch}.IsOn", start="NOW", timeout=3 From 453990c2e55d52982f8f8070dec64f275e334544 Mon Sep 17 00:00:00 2001 From: ineskhou Date: Tue, 11 Nov 2025 16:55:59 -0800 Subject: [PATCH 45/46] switched the correct onces back --- FprimeZephyrReference/test/int/load_switch_test.py | 2 +- FprimeZephyrReference/test/int/power_monitor_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/test/int/load_switch_test.py b/FprimeZephyrReference/test/int/load_switch_test.py index 476f576c..7196c856 100644 --- a/FprimeZephyrReference/test/int/load_switch_test.py +++ b/FprimeZephyrReference/test/int/load_switch_test.py @@ -41,7 +41,7 @@ def get_is_on(fprime_test_api: IntegrationTestAPI) -> str: proves_send_and_assert_command( fprime_test_api, "CdhCore.tlmSend.SEND_PKT", - ["10"], + ["9"], ) result: ChData = fprime_test_api.assert_telemetry( f"{loadswitch}.IsOn", start="NOW", timeout=3 diff --git a/FprimeZephyrReference/test/int/power_monitor_test.py b/FprimeZephyrReference/test/int/power_monitor_test.py index 495ee55e..0ab97c45 100644 --- a/FprimeZephyrReference/test/int/power_monitor_test.py +++ b/FprimeZephyrReference/test/int/power_monitor_test.py @@ -22,7 +22,7 @@ def send_packet(fprime_test_api: IntegrationTestAPI, start_gds): proves_send_and_assert_command( fprime_test_api, "CdhCore.tlmSend.SEND_PKT", - ["9"], + ["10"], ) From 5d33eb5521601f4caf2f8d27916558314d79b243 Mon Sep 17 00:00:00 2001 From: Moises Mata Date: Tue, 11 Nov 2025 20:16:10 -0500 Subject: [PATCH 46/46] Very important commit --- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp | 2 +- FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp index 6bd284e2..ea769e63 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.cpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.cpp -// \author sarah +// \author Moises, sarah // \brief cpp file for LoadSwitch component implementation class // ====================================================================== diff --git a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp index d66e5fa8..acaa5d23 100644 --- a/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp +++ b/FprimeZephyrReference/Components/LoadSwitch/LoadSwitch.hpp @@ -1,6 +1,6 @@ // ====================================================================== // \title LoadSwitch.hpp -// \author sarah +// \author Moises, sarah // \brief hpp file for LoadSwitch component implementation class // ======================================================================