Skip to content

Commit e1af709

Browse files
committed
fixed time interval problem
1 parent c8f7078 commit e1af709

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

FprimeZephyrReference/Components/StartupManager/StartupManager.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// ======================================================================
66

77
#include "FprimeZephyrReference/Components/StartupManager/StartupManager.hpp"
8+
#include <zephyr/kernel.h>
9+
#include <zephyr/sys/printk.h>
810
#include "Os/File.hpp"
911

1012
namespace Components {
@@ -121,21 +123,32 @@ FwSizeType StartupManager ::update_boot_count() {
121123
}
122124

123125
Fw::Time StartupManager ::update_quiescence_start() {
126+
printk("StartupManager: Updating quiescence start time.\n");
124127
Fw::ParamValid is_valid;
125128
auto time_file = this->paramGet_QUIESCENCE_START_FILE(is_valid);
129+
printk("StartupManager: Quiescence start time file path: %s\n", time_file.toChar());
126130
FW_ASSERT(is_valid == Fw::ParamValid::VALID || is_valid == Fw::ParamValid::DEFAULT);
131+
printk("StartupManager: Reading current time for quiescence start time.\n");
127132

128133
Fw::Time time = this->getTime();
129134
// Open the quiescence start time file and read the current time. On read failure, return the current time.
135+
printk("StartupManager: Reading quiescence start time from file: %s\n", time_file.toChar());
130136
StartupManager::Status status = read<Fw::Time, Fw::Time::SERIALIZED_SIZE>(time_file, time);
137+
printk("StartupManager: Quiescence start time read complete with status: %d\n", status);
131138
// On read failure, write the current time to the file for future reads. This only happens on read failure because
132139
// there is a singular quiescence start time for the whole mission.
133140
if (status != StartupManager::SUCCESS) {
141+
printk("StartupManager: Writing current time to quiescence start time file: %s\n", time_file.toChar());
134142
status = write<Fw::Time, Fw::Time::SERIALIZED_SIZE>(time_file, time);
143+
printk("StartupManager: Quiescence start time write complete with status: %d\n", status);
135144
if (status != StartupManager::SUCCESS) {
145+
printk("StartupManager: WARNING - Quiescence start time UNSUCCESSFULLY written to file.\n");
136146
this->log_WARNING_LO_QuiescenceFileInitFailure();
137147
}
148+
} else {
149+
printk("StartupManager: Successfully read quiescence start time from file.\n");
138150
}
151+
printk("StartupManager: Quiescence start time update complete.\n");
139152
return time;
140153
}
141154

@@ -166,8 +179,9 @@ void StartupManager ::run_handler(FwIndexType portNum, U32 context) {
166179

167180
// Calculate the quiescence end time based on the quiescence period parameter
168181
Fw::TimeIntervalValue quiescence_period = this->paramGet_QUIESCENCE_TIME(is_valid);
169-
Fw::Time quiescence_interval(quiescence_period.get_seconds(), quiescence_period.get_useconds());
170182
FW_ASSERT(is_valid == Fw::ParamValid::VALID || is_valid == Fw::ParamValid::DEFAULT);
183+
Fw::Time quiescence_interval(this->m_quiescence_start.getTimeBase(), quiescence_period.get_seconds(),
184+
quiescence_period.get_useconds());
171185
Fw::Time end_time = Fw::Time::add(this->m_quiescence_start, quiescence_interval);
172186

173187
// Are we waiting for quiescence?

0 commit comments

Comments
 (0)