Fixed several logic bugs found during tdd

This commit is contained in:
Jake Goodwin 2024-09-02 13:33:51 -07:00
parent 32c093d00c
commit 97e4664adb
1 changed files with 9 additions and 4 deletions

View File

@ -6,13 +6,18 @@
*/
#include "Relays.h"
#ifndef UNIT_TESTING
#include "timer.h"
#else
#include "TimerMock.h"
#endif
void Relay_MeasureMakeTime(Relay *relay) {
Timer_Start();
while (Relay_ReadState(relay)) {
while (!Relay_ReadState(relay)) {
}
Timer_Disable();
Timer_Stop();
relay->make_time = Timer_GetOverflowCount();
}
@ -20,8 +25,8 @@ void Relay_MeasureBreakTime(Relay *relay) {
Timer_Start();
while (Relay_ReadState(relay)) {
}
Timer_Disable();
relay->make_time = Timer_GetOverflowCount();
Timer_Stop();
relay->break_time = Timer_GetOverflowCount();
}
void Relay_Enable(Relay *relay) {