Fixed several logic bugs found during tdd
This commit is contained in:
parent
32c093d00c
commit
97e4664adb
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue