File tree 3 files changed +20
-0
lines changed
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,21 @@ add_executable(propulsion_test
42
42
# Always link GTest
43
43
target_link_libraries (propulsion_test GTest::gtest_main)
44
44
45
+ # Define mock or real behavior
46
+ if (MOCK_RPI)
47
+ message (STATUS "Building with MOCK_RPI=ON: Using mock WiringPi (no external linkage)." )
48
+ target_compile_definitions (propulsion_test PRIVATE MOCK_RPI)
49
+ else ()
50
+ message (STATUS "Building with MOCK_RPI=OFF: Linking to real WiringPi." )
51
+ target_link_libraries (propulsion_test wiringPi)
52
+ endif ()
53
+ add_library (PropulsionFunctions
54
+ lib/Command .h
55
+ lib/Command_Interpreter.cpp
56
+ lib/Command_Interpreter.h
57
+ lib/Wiring.cpp
58
+ lib/Wiring.h
59
+ )
45
60
include (GoogleTest)
46
61
47
62
gtest_discover_tests(propulsion_test)
Original file line number Diff line number Diff line change @@ -172,8 +172,10 @@ void Command_Interpreter_RPi5::blind_execute(const CommandComponent &commandComp
172
172
auto currentTime = std::chrono::system_clock::now ();
173
173
untimed_execute (commandComponent.thruster_pwms );
174
174
while (currentTime < endTime) {
175
+
175
176
currentTime = std::chrono::system_clock::now ();
176
177
}
178
+ isInterruptBlind_Execute = false ;
177
179
}
178
180
179
181
void Command_Interpreter_RPi5::untimed_execute (pwm_array thrusterPwms) {
Original file line number Diff line number Diff line change @@ -194,6 +194,9 @@ class Command_Interpreter_RPi5 {
194
194
// / @return A vector containing the current value of all pins. PWM pins will return a value in the range [1100, 1900]
195
195
std::vector<int > readPins ();
196
196
197
+ // / @brief Set an interrupt for the blind_execute function while running. Calling this function sets the interrupt to occur.
198
+ void interruptBlind_Execute () {isInterruptBlind_Execute = true ;}
199
+
197
200
~Command_Interpreter_RPi5 (); // TODO this also deletes all its pins. Not sure if this is desirable or not?
198
201
};
199
202
You can’t perform that action at this time.
0 commit comments