From: Joseph Coffland Date: Thu, 22 Feb 2018 06:21:27 +0000 (-0800) Subject: Rename test exec X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=f446f3de68967b0d8a79e5ff5024306ffda5a0fd;p=bbctrl-firmware Rename test exec --- diff --git a/scripts/reset-video b/scripts/reset-video new file mode 100755 index 0000000..94b46cd --- /dev/null +++ b/scripts/reset-video @@ -0,0 +1,23 @@ +#!/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) diff --git a/src/avr/test/Makefile b/src/avr/test/Makefile index 06ece7a..3504160 100644 --- a/src/avr/test/Makefile +++ b/src/avr/test/Makefile @@ -1,28 +1,28 @@ -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: diff --git a/src/avr/test/firmware-test.c b/src/avr/test/firmware-test.c new file mode 100644 index 0000000..ae51a31 --- /dev/null +++ b/src/avr/test/firmware-test.c @@ -0,0 +1,75 @@ +/******************************************************************************\ + + 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 . + + 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 + . + + For information regarding this software email: + "Joseph Coffland" + +\******************************************************************************/ + +#include "axis.h" +#include "command.h" +#include "exec.h" +#include "state.h" +#include "vars.h" +#include "report.h" + +#include +#include + + +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; +} diff --git a/src/avr/test/planner-test.c b/src/avr/test/planner-test.c deleted file mode 100644 index ae51a31..0000000 --- a/src/avr/test/planner-test.c +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************\ - - 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 . - - 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 - . - - For information regarding this software email: - "Joseph Coffland" - -\******************************************************************************/ - -#include "axis.h" -#include "command.h" -#include "exec.h" -#include "state.h" -#include "vars.h" -#include "report.h" - -#include -#include - - -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; -}