|
5 | 5 | // ====================================================================== |
6 | 6 |
|
7 | 7 | #include "FprimeZephyrReference/Components/StartupManager/StartupManager.hpp" |
| 8 | +#include <zephyr/kernel.h> |
| 9 | +#include <zephyr/sys/printk.h> |
8 | 10 | #include "Os/File.hpp" |
9 | 11 |
|
10 | 12 | namespace Components { |
@@ -121,21 +123,32 @@ FwSizeType StartupManager ::update_boot_count() { |
121 | 123 | } |
122 | 124 |
|
123 | 125 | Fw::Time StartupManager ::update_quiescence_start() { |
| 126 | + printk("StartupManager: Updating quiescence start time.\n"); |
124 | 127 | Fw::ParamValid is_valid; |
125 | 128 | auto time_file = this->paramGet_QUIESCENCE_START_FILE(is_valid); |
| 129 | + printk("StartupManager: Quiescence start time file path: %s\n", time_file.toChar()); |
126 | 130 | FW_ASSERT(is_valid == Fw::ParamValid::VALID || is_valid == Fw::ParamValid::DEFAULT); |
| 131 | + printk("StartupManager: Reading current time for quiescence start time.\n"); |
127 | 132 |
|
128 | 133 | Fw::Time time = this->getTime(); |
129 | 134 | // 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()); |
130 | 136 | 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); |
131 | 138 | // On read failure, write the current time to the file for future reads. This only happens on read failure because |
132 | 139 | // there is a singular quiescence start time for the whole mission. |
133 | 140 | if (status != StartupManager::SUCCESS) { |
| 141 | + printk("StartupManager: Writing current time to quiescence start time file: %s\n", time_file.toChar()); |
134 | 142 | status = write<Fw::Time, Fw::Time::SERIALIZED_SIZE>(time_file, time); |
| 143 | + printk("StartupManager: Quiescence start time write complete with status: %d\n", status); |
135 | 144 | if (status != StartupManager::SUCCESS) { |
| 145 | + printk("StartupManager: WARNING - Quiescence start time UNSUCCESSFULLY written to file.\n"); |
136 | 146 | this->log_WARNING_LO_QuiescenceFileInitFailure(); |
137 | 147 | } |
| 148 | + } else { |
| 149 | + printk("StartupManager: Successfully read quiescence start time from file.\n"); |
138 | 150 | } |
| 151 | + printk("StartupManager: Quiescence start time update complete.\n"); |
139 | 152 | return time; |
140 | 153 | } |
141 | 154 |
|
@@ -166,8 +179,9 @@ void StartupManager ::run_handler(FwIndexType portNum, U32 context) { |
166 | 179 |
|
167 | 180 | // Calculate the quiescence end time based on the quiescence period parameter |
168 | 181 | Fw::TimeIntervalValue quiescence_period = this->paramGet_QUIESCENCE_TIME(is_valid); |
169 | | - Fw::Time quiescence_interval(quiescence_period.get_seconds(), quiescence_period.get_useconds()); |
170 | 182 | 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()); |
171 | 185 | Fw::Time end_time = Fw::Time::add(this->m_quiescence_start, quiescence_interval); |
172 | 186 |
|
173 | 187 | // Are we waiting for quiescence? |
|
0 commit comments