@@ -95,26 +95,6 @@ int rtds_init(void) {
9595 return U_SUCCESS ;
9696}
9797
98- /* Sounds the RTDS (Ready-to-drive sound). */
99- int rtds_soundRTDS (void ) {
100-
101- /* Stop the reverse sound if active. */
102- rtds_stopReverseSound ();
103-
104- /* Trigger the RTDS sound. */
105- _set_rtds_pin ();
106-
107- /* Restart RTDS timer. */
108- int status = timer_restart (& rtds_timer );
109- if (status != U_SUCCESS ) {
110- PRINTLN_ERROR ("Failed to restart RTDS timer (Status: %d)." , status );
111- queue_send (& faults , & (fault_t ){RTDS_FAULT }, TX_NO_WAIT );
112- return U_ERROR ;
113- }
114-
115- return U_SUCCESS ;
116- }
117-
11898/* Cancels the RTDS sound. The RTDS sound already stops automatically once it's over, but this function lets you cancel it prematurely. */
11999int rtds_cancelRTDS (void ) {
120100 /* Stop the RTDS sound. */
@@ -148,23 +128,6 @@ int rtds_startReverseSound(void) {
148128 return U_SUCCESS ;
149129}
150130
151- /* Stops the reverse sound. */
152- int rtds_stopReverseSound (void ) {
153- /* Turn off the RTDS sound */
154- _clear_rtds_pin ();
155-
156- /* Deactivate the reverse sound timer */
157- int status = timer_stop (& reverse_sound_timer );
158- if (status != U_SUCCESS ) {
159- PRINTLN_ERROR ("Failed to deactivate reverse sound timer (Status: %d)." , status );
160- queue_send (& faults , & (fault_t ){RTDS_FAULT }, TX_NO_WAIT );
161- return U_ERROR ;
162- }
163-
164- PRINTLN_INFO ("Stopped reverse sound." );
165- return U_SUCCESS ;
166- }
167-
168131/* Reads the status of the RTDS pin (true = RTDS pin is active, false = RTDS pin is not active). */
169132/* Useful for debugging. */
170133bool rtds_readRTDS (void ) {
@@ -212,3 +175,41 @@ int rtds_isInSounding(bool* state) {
212175
213176 return U_SUCCESS ;
214177}
178+
179+ /* Stops the reverse sound. */
180+ int rtds_stopReverseSound (void ) {
181+
182+ /* Turn off the RTDS sound */
183+ _clear_rtds_pin ();
184+
185+ /* Deactivate the reverse sound timer */
186+ int status = timer_stop (& reverse_sound_timer );
187+ if (status != U_SUCCESS ) {
188+ PRINTLN_ERROR ("Failed to deactivate reverse sound timer (Status: %d)." , status );
189+ queue_send (& faults , & (fault_t ){RTDS_FAULT }, TX_NO_WAIT );
190+ return U_ERROR ;
191+ }
192+
193+ PRINTLN_INFO ("Stopped reverse sound." );
194+ return U_SUCCESS ;
195+ }
196+
197+ /* Sounds the RTDS (Ready-to-drive sound). */
198+ int rtds_soundRTDS (void ) {
199+
200+ /* Stop the reverse sound if active. */
201+ rtds_stopReverseSound ();
202+
203+ /* Trigger the RTDS sound. */
204+ _set_rtds_pin ();
205+
206+ /* Restart RTDS timer. */
207+ int status = timer_restart (& rtds_timer );
208+ if (status != U_SUCCESS ) {
209+ PRINTLN_ERROR ("Failed to restart RTDS timer (Status: %d)." , status );
210+ queue_send (& faults , & (fault_t ){RTDS_FAULT }, TX_NO_WAIT );
211+ return U_ERROR ;
212+ }
213+
214+ return U_SUCCESS ;
215+ }
0 commit comments