--- /dev/null
+#!/usr/bin/env python3
+
+import sys
+import subprocess
+import os.path
+import time
+
+if not os.path.exists('/dev/video0'):
+ print('/dev/video0 not found')
+ sys.exit(1)
+
+p = subprocess.Popen('udevadm info -q path /dev/video0'.split(),
+ stdout = subprocess.PIPE)
+s = p.communicate()[0].decode('utf-8')
+dev = s.split('/')[7]
+
+with open('/sys/bus/usb/drivers/usb/unbind', 'w') as f:
+ f.write(dev)
+
+time.sleep(1)
+
+with open('/sys/bus/usb/drivers/usb/bind', 'w') as f:
+ f.write(dev)
-TESTS=planner-test
+TARGET=firmware-test
-PLANNER_TEST_SRC = status.c util.c axis.c report.c type.c exec.c base64.c \
+FIRMWARE_TEST_SRC = status.c util.c axis.c report.c type.c exec.c base64.c \
command.c commands.c vars.c state.c line.c scurve.c seek.c
-PLANNER_TEST_SRC := $(patsubst %,../src/%,$(PLANNER_TEST_SRC))
-PLANNER_TEST_SRC += $(wildcard ../src/plan/*.c) planner-test.c hal.c
+FIRMWARE_TEST_SRC := $(patsubst %,../src/%,$(FIRMWARE_TEST_SRC))
+FIRMWARE_TEST_SRC += $(wildcard ../src/plan/*.c) firmware-test.c hal.c
CFLAGS = -I../src -Wall -Werror -DDEBUG -g -std=gnu99
CFLAGS += -MD -MP -MT $@ -MF .dep/$(@F).d
CFLAGS += -DF_CPU=320000000
LDFLAGS = -lm
-all: $(TESTS)
+all: $(TARGET)
-planner-test: $(PLANNER_TEST_SRC)
- gcc -o $@ $(PLANNER_TEST_SRC) $(CFLAGS) $(LDFLAGS)
+$(TARGET): $(FIRMWARE_TEST_SRC)
+ gcc -o $@ $(FIRMWARE_TEST_SRC) $(CFLAGS) $(LDFLAGS)
-%.csv: %.gc planner-test
- ./planner-test < $< | grep -E '^-?[0-9.]+,'
+%.csv: %.gc firmware-test
+ ./firmware-test < $< | grep -E '^-?[0-9.]+,'
-%-test: %.gc planner-test
- ./planner-test < $<
+%-test: %.gc firmware-test
+ ./firmware-test < $<
-%-plot: %.gc planner-test
- ./planner-test < $< | grep -E '^-?[0-9.]+,' | ./plot.py
+%-plot: %.gc firmware-test
+ ./firmware-test < $< | grep -E '^-?[0-9.]+,' | ./plot.py
# Clean
tidy:
--- /dev/null
+/******************************************************************************\
+
+ This file is part of the Buildbotics firmware.
+
+ Copyright (c) 2015 - 2018, Buildbotics LLC
+ All rights reserved.
+
+ This file ("the software") is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License,
+ version 2 as published by the Free Software Foundation. You should
+ have received a copy of the GNU General Public License, version 2
+ along with the software. If not, see <http://www.gnu.org/licenses/>.
+
+ The software is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the software. If not, see
+ <http://www.gnu.org/licenses/>.
+
+ For information regarding this software email:
+ "Joseph Coffland" <joseph@buildbotics.com>
+
+\******************************************************************************/
+
+#include "axis.h"
+#include "command.h"
+#include "exec.h"
+#include "state.h"
+#include "vars.h"
+#include "report.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int main(int argc, char *argv[]) {
+ axis_map_motors();
+ exec_init(); // motion exec
+ vars_init(); // configuration variables
+ command_init();
+
+ stat_t status = STAT_OK;
+
+ while (true) {
+ bool reading = !feof(stdin);
+
+ report_callback();
+
+ if (reading) {
+ state_callback();
+ if (command_callback()) continue;
+ }
+
+ status = exec_next();
+ printf("EXEC: %s\n", status_to_pgmstr(status));
+
+ switch (status) {
+ case STAT_NOP: break; // No command executed
+ case STAT_AGAIN: continue; // No command executed, try again
+ case STAT_OK: continue; // Move executed
+
+ default:
+ printf("ERROR: %s\n", status_to_pgmstr(status));
+ }
+
+ if (!reading) break;
+ }
+
+ printf("STATE: %s\n", state_get_pgmstr(state_get()));
+
+ return 0;
+}
+++ /dev/null
-/******************************************************************************\
-
- This file is part of the Buildbotics firmware.
-
- Copyright (c) 2015 - 2018, Buildbotics LLC
- All rights reserved.
-
- This file ("the software") is free software: you can redistribute it
- and/or modify it under the terms of the GNU General Public License,
- version 2 as published by the Free Software Foundation. You should
- have received a copy of the GNU General Public License, version 2
- along with the software. If not, see <http://www.gnu.org/licenses/>.
-
- The software is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the software. If not, see
- <http://www.gnu.org/licenses/>.
-
- For information regarding this software email:
- "Joseph Coffland" <joseph@buildbotics.com>
-
-\******************************************************************************/
-
-#include "axis.h"
-#include "command.h"
-#include "exec.h"
-#include "state.h"
-#include "vars.h"
-#include "report.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-
-int main(int argc, char *argv[]) {
- axis_map_motors();
- exec_init(); // motion exec
- vars_init(); // configuration variables
- command_init();
-
- stat_t status = STAT_OK;
-
- while (true) {
- bool reading = !feof(stdin);
-
- report_callback();
-
- if (reading) {
- state_callback();
- if (command_callback()) continue;
- }
-
- status = exec_next();
- printf("EXEC: %s\n", status_to_pgmstr(status));
-
- switch (status) {
- case STAT_NOP: break; // No command executed
- case STAT_AGAIN: continue; // No command executed, try again
- case STAT_OK: continue; // Move executed
-
- default:
- printf("ERROR: %s\n", status_to_pgmstr(status));
- }
-
- if (!reading) break;
- }
-
- printf("STATE: %s\n", state_get_pgmstr(state_get()));
-
- return 0;
-}