Skip to content

Commit dcb9193

Browse files
committed
2 parents 9f2ef38 + 4097dae commit dcb9193

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ add_executable(propulsion_test
4242
# Always link GTest
4343
target_link_libraries(propulsion_test GTest::gtest_main)
4444

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+
)
4560
include(GoogleTest)
4661

4762
gtest_discover_tests(propulsion_test)

lib/Command_Interpreter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ void Command_Interpreter_RPi5::blind_execute(const CommandComponent &commandComp
172172
auto currentTime = std::chrono::system_clock::now();
173173
untimed_execute(commandComponent.thruster_pwms);
174174
while (currentTime < endTime) {
175+
175176
currentTime = std::chrono::system_clock::now();
176177
}
178+
isInterruptBlind_Execute = false;
177179
}
178180

179181
void Command_Interpreter_RPi5::untimed_execute(pwm_array thrusterPwms) {

lib/Command_Interpreter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ class Command_Interpreter_RPi5 {
194194
/// @return A vector containing the current value of all pins. PWM pins will return a value in the range [1100, 1900]
195195
std::vector<int> readPins();
196196

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+
197200
~Command_Interpreter_RPi5(); //TODO this also deletes all its pins. Not sure if this is desirable or not?
198201
};
199202

0 commit comments

Comments
 (0)