Skip to content

Commit 22ff9e3

Browse files
CopilotMikefly123ineskhou
authored
Fix: Reset deployment attempt counter between sessions (#84)
* Initial plan * Reset m_totalAttempts in resetDeploymentState to fix integration test failures Co-authored-by: Mikefly123 <[email protected]> * Fix integration test failures - final status Co-authored-by: Mikefly123 <[email protected]> * Remove CodeQL artifact and update gitignore Co-authored-by: Mikefly123 <[email protected]> * fixed burnwire incremnentation * changed increments * move invrement * ading inclused * remove the degugs * formal burnwire timer * switched the order of the rate grounps * reverted timer debugdding code * linter * remove the reset of the count for now --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Mikefly123 <[email protected]> Co-authored-by: ineskhou <[email protected]>
1 parent 497f48a commit 22ff9e3

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ settings.ini
2424
**/*.egg-info/
2525

2626
bin/
27+
_codeql_detected_source_root

FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void AntennaDeployer ::startNextAttempt() {
115115

116116
this->m_totalAttempts++;
117117
this->tlmWrite_DeployAttemptCount(this->m_totalAttempts);
118+
this->m_burnTicksThisAttempt = 0;
118119

119120
if (this->isConnected_burnStart_OutputPort(0)) {
120121
this->burnStart_out(0);
@@ -140,6 +141,7 @@ void AntennaDeployer ::handleQuietWaitTick() {
140141

141142
void AntennaDeployer ::handleBurningTick() {
142143
this->m_ticksInState++;
144+
this->m_burnTicksThisAttempt = this->m_ticksInState;
143145

144146
if (this->m_stopRequested) {
145147
this->finishDeployment(Components::DeployResult::DEPLOY_RESULT_ABORT);
@@ -154,6 +156,7 @@ void AntennaDeployer ::handleBurningTick() {
154156
const U32 burnDuration = this->paramGet_BURN_DURATION_SEC(valid);
155157
if (this->m_ticksInState >= burnDuration) {
156158
this->ensureBurnwireStopped();
159+
this->logBurnSignalCount();
157160

158161
if (this->m_successDetected) {
159162
this->finishDeployment(Components::DeployResult::DEPLOY_RESULT_SUCCESS);
@@ -205,6 +208,7 @@ void AntennaDeployer ::finishDeployment(Components::DeployResult result) {
205208
}
206209

207210
this->ensureBurnwireStopped();
211+
this->logBurnSignalCount();
208212

209213
if (result == Components::DeployResult::DEPLOY_RESULT_SUCCESS) {
210214
this->log_ACTIVITY_HI_DeploySuccess(this->m_currentAttempt);
@@ -222,6 +226,7 @@ void AntennaDeployer ::resetDeploymentState() {
222226
this->m_stopRequested = false;
223227
this->m_successDetected = false;
224228
this->m_lastDistanceValid = false;
229+
this->m_burnTicksThisAttempt = 0;
225230
}
226231

227232
bool AntennaDeployer ::isDistanceWithinValidRange(F32 distance) {
@@ -240,6 +245,7 @@ bool AntennaDeployer ::isDistanceDeployed(F32 distance) {
240245

241246
if (distance <= threshold) {
242247
this->m_successDetected = true;
248+
this->logBurnSignalCount();
243249
return true;
244250
}
245251

@@ -252,4 +258,11 @@ void AntennaDeployer ::ensureBurnwireStopped() {
252258
}
253259
}
254260

261+
void AntennaDeployer ::logBurnSignalCount() {
262+
if (this->m_burnTicksThisAttempt > 0U) {
263+
this->log_ACTIVITY_LO_AntennaBurnSignalCount(this->m_burnTicksThisAttempt);
264+
this->m_burnTicksThisAttempt = 0;
265+
}
266+
}
267+
255268
} // namespace Components

FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.fpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module Components {
2828
######################################################################
2929
# Telemetry
3030
######################################################################
31-
@ Counts the number of deployment attempts across boots
31+
@ Counts the number of deployment attempts
3232
telemetry DeployAttemptCount: U32
3333

3434
@ Tracks the last observed distance reading
@@ -68,6 +68,12 @@ module Components {
6868
) severity activity high \
6969
format "Quiet time expired after {} seconds, starting deployment attempt"
7070

71+
@ Reports how many scheduler ticks the burn signal was held active for the latest attempt
72+
event AntennaBurnSignalCount(
73+
ticks: U32 @< Number of scheduler ticks spent in the burn state
74+
) severity activity low \
75+
format "Burn signal active for {} scheduler ticks"
76+
7177
######################################################################
7278
# Ports
7379
######################################################################

FprimeZephyrReference/Components/AntennaDeployer/AntennaDeployer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class AntennaDeployer final : public AntennaDeployerComponentBase {
5252
bool isDistanceWithinValidRange(F32 distance);
5353
bool isDistanceDeployed(F32 distance);
5454
void ensureBurnwireStopped();
55+
void logBurnSignalCount();
5556

5657
DeploymentState m_state = DeploymentState::IDLE;
5758
U32 m_currentAttempt = 0;
@@ -61,6 +62,7 @@ class AntennaDeployer final : public AntennaDeployerComponentBase {
6162
bool m_successDetected = false;
6263
bool m_lastDistanceValid = false;
6364
F32 m_lastDistance = 0.0F;
65+
U32 m_burnTicksThisAttempt = 0;
6466
};
6567

6668
} // namespace Components

FprimeZephyrReference/test/int/antenna_deployer_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ def test_burn_duration_sec(fprime_test_api: IntegrationTestAPI, start_gds):
217217
# Wait for burnwire to stop
218218
fprime_test_api.assert_event(f"{burnwire}.SetBurnwireState", "OFF", timeout=15)
219219

220-
# Verify the burnwire end count shows 3 seconds
221-
burnwire_end_event: EventData = fprime_test_api.assert_event(
222-
f"{burnwire}.BurnwireEndCount", timeout=5
220+
# Verify the antenna deployer reports the burn duration in ticks (seconds)
221+
burn_signal_event: EventData = fprime_test_api.assert_event(
222+
f"{antenna_deployer}.AntennaBurnSignalCount", timeout=5
223223
)
224-
assert burnwire_end_event.args[0].val == 3, (
225-
"Burnwire should have burned for 3 seconds"
224+
assert burn_signal_event.args[0].val == 3, (
225+
"Burn signal should have been active for 3 scheduler ticks"
226226
)
227227

228228
# Verify deployment finishes with failure (no distance sensor)

0 commit comments

Comments
 (0)