Skip to content
Merged
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ settings.ini
**/*.egg-info/

bin/
_codeql_detected_source_root
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -222,6 +226,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) {
Expand All @@ -240,6 +245,7 @@ bool AntennaDeployer ::isDistanceDeployed(F32 distance) {

if (distance <= threshold) {
this->m_successDetected = true;
this->logBurnSignalCount();
return true;
}

Expand All @@ -252,4 +258,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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module Components {
######################################################################
# Telemetry
######################################################################
@ Counts the number of deployment attempts across boots
@ Counts the number of deployment attempts
telemetry DeployAttemptCount: U32

@ Tracks the last observed distance reading
Expand Down Expand Up @@ -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
######################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions FprimeZephyrReference/test/int/antenna_deployer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down