Skip to content

Commit 3e49ea4

Browse files
author
Ezra Boley
committed
Added a super fun copy target and a state test
1 parent 6a110ae commit 3e49ea4

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ ifdef LOCAL
2323
NOI2C := NOI2C
2424
endif
2525

26+
USER := "debian"
27+
LV_IP := "192.168.7.2"
28+
HV_IP := "192.168.7.3"
29+
2630
ifdef BB
2731
BEAGLE := ${BBCC}
2832
endif
@@ -59,12 +63,17 @@ UTL_OBJ := $(addprefix $(OBJ_DIR)/,$(addsuffix .o,$(basename $(ALL_UTL))))
5963
# .SEC keeps intermediates, so make doesnt automatically clean .o files
6064
.SECONDARY:
6165

62-
all: $(TARGETS)
6366

67+
all: $(TARGETS)
68+
6469
examples: $(EXAMPLES)
6570

6671
utils: $(UTILS)
6772

73+
copy:
74+
-scp -q -o ConnectTimeout=2 -r $(OUTPUT_DIR) $(USER)@$(LV_IP):~/bin &
75+
-scp -q -o ConnectTimeout=2 -r $(OUTPUT_DIR) $(USER)@$(HV_IP):~/bin &
76+
6877
$(OUTPUT_DIR)/%: $(GEN_OBJ) $(OBJ_DIR)/%.o
6978
$(GPP) $(LDFLAGS) $^ $(LDLIBS) -o $@
7079

embedded/examples/stateTest.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <pthread.h>
66
#include <semaphore.h>
77
#include <state_machine.h>
8+
#include <states.h>
89

910
#define PASS 0
1011
#define FAIL 1
@@ -133,6 +134,35 @@ static int navMissedRetroTest()
133134
return ASSERT_STATE_IS(RUN_FAULT_NAME);
134135
}
135136

137+
static int crawlTimerTest()
138+
{
139+
FREEZE_SM;
140+
genericInit("Crawl Timer Test");
141+
goToState(CRAWL_NAME);
142+
UNFREEZE_SM;
143+
144+
WAIT(.5);
145+
146+
if (checkForChange(CRAWL_NAME) != PASS) return FAIL;
147+
148+
149+
printf("check\n");
150+
151+
uint64_t offset = getuSTimestamp();
152+
153+
for (int i = 0; i < (30 * 5); i++) {
154+
printf("crawl timer: %llu\r", getuSTimestamp() - data->timers->crawlTimer);
155+
fflush(stdin);
156+
usleep(200000);
157+
}
158+
159+
WAIT(.2);
160+
161+
return ASSERT_STATE_IS(BRAKING_NAME);
162+
163+
}
164+
165+
136166
/* PV depressurizing.*/
137167
static int pvDepressurizingTest()
138168
{
@@ -197,7 +227,8 @@ int main() {
197227
}
198228
if (pthread_create(&smThread, NULL, stateMachineLoop, NULL) != 0)
199229
return -1;
200-
WAIT(1);
230+
WAIT(.5);
231+
RUN_TEST(crawlTimerTest);
201232
RUN_TEST(hvBattSOCLowTest);
202233
RUN_TEST(hvBattLowVoltTest);
203234
RUN_TEST(rmsOverheatTest);

0 commit comments

Comments
 (0)