Skip to content

Commit e40b501

Browse files
committed
testing
1 parent c9f0ac5 commit e40b501

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Command_Interpreter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ void Command_Interpreter_RPi5::blind_execute(const CommandComponent& commandComp
185185
auto endTime = std::chrono::system_clock::now() + commandComponent.duration;
186186
auto currentTime = std::chrono::system_clock::now();
187187
execute(commandComponent.thruster_pwms, logfile);
188-
while (currentTime < endTime) {
188+
while (currentTime < endTime && !isInterruptBlind_Execute) {
189189
currentTime = std::chrono::system_clock::now();
190190
}
191+
isInterruptBlind_Execute = false;
191192
}
192193

193194
//void Command_Interpreter_RPi5::corrective_execute(command_component command, std::ofstream logfile) {

lib/Command_Interpreter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class Command_Interpreter_RPi5 {
108108
std::vector<PwmPin*> thrusterPins;
109109
std::vector<DigitalPin*> digitalPins;
110110
WiringControl wiringControl;
111+
bool isInterruptBlind_Execute;
111112

112113
public:
113114
explicit Command_Interpreter_RPi5(std::vector<PwmPin*> thrusterPins, std::vector<DigitalPin*> digitalPins);
@@ -132,6 +133,9 @@ class Command_Interpreter_RPi5 {
132133
/// varies depending on the type.
133134
std::vector<int> readPins();
134135

136+
/// @brief Set an interrupt for the blind_execute function while running. Calling this function sets the interrupt to occur.
137+
void interruptBlind_Execute() {isInterruptBlind_Execute = true;}
138+
135139
~Command_Interpreter_RPi5(); //TODO this also deletes all its pins. Not sure if this is desirable or not?
136140
};
137141

0 commit comments

Comments
 (0)