Skip to content
Snippets Groups Projects
Commit 2e7e1690 authored by bbartels's avatar bbartels
Browse files

quad: enable virtual quad to take a quiet flag to silence output

this resolves #3
parent 3b4ab490
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,12 @@ require script_dir + "/testing_library"
bin_dir = script_dir + "/../../bin/"
Dir.chdir(bin_dir)
puts("Firing up the quad...")
# Start virtual quad
quad = Process.spawn("./virt-quad")
quad = Process.spawn("./virt-quad -q")
sleep 1
delay_spin_cursor(3)
##################
# Begin Flight!
......@@ -37,7 +39,7 @@ begin
end
puts("Hovering for 10 seconds")
sleep 10
delay_spin_cursor(10)
puts("Relaxing thrust to zero")
i = THROTTLE_MID
......
......@@ -20,11 +20,11 @@ Timeout::timeout(30) {
sleep 1
# Start virtual quad
quad_pid = Process.spawn("./virt-quad",
quad_pid = Process.spawn("./virt-quad -q",
{ :rlimit_as => 536870912, # 512 MiB total RAM
:rlimit_stack => 1048576}) # 1 MiB stack
sleep 5
delay_spin_cursor(5)
#################
# Begin Tests
......@@ -83,7 +83,7 @@ Timeout::timeout(30) {
puts averages, "(#{average})"
assert average.between?(THROTTLE_EIGHTH, MOTOR_MAX)
# Check that gear switch kills the motors
puts("Check that gear switch kills the motors")
# (and that light goes off)
File.write(GEAR, GEAR_OFF)
sleep 0.1
......
......@@ -19,11 +19,11 @@ Timeout::timeout(30) {
sleep 1
# Start virtual quad
quad_pid = Process.spawn("./virt-quad",
quad_pid = Process.spawn("./virt-quad -q",
{ :rlimit_as => 536870912, # 512 MiB total RAM
:rlimit_stack => 1048576}) # 1 MiB stack
sleep 5
delay_spin_cursor(5)
#################
# Begin Tests
......
......@@ -75,3 +75,15 @@ def check_led(is_on)
led = read_fifo_num(LED)
assert_equal(led, is_on)
end
def delay_spin_cursor(delay)
fps = 10
chars = %w[| / - \\]
iteations = delay * fps
iter = 0
iteations.times() do
print chars[(iter+=1) % chars.length]
sleep (1.0/fps)
print "\b"
end
end
#include <stdio.h>
#include <unistd.h>
#include "hw_impl_unix.h"
#include "quad_app.h"
#include <fcntl.h>
int setup_hardware(hardware_t *hardware) {
hardware->i2c = create_unix_i2c();
......@@ -14,8 +16,21 @@ int setup_hardware(hardware_t *hardware) {
return 0;
}
int main()
{
int main(int argc, char *argv[]) {
int fd, opt;
while ((opt = getopt(argc, argv, "q")) != -1) {
switch (opt) {
case 'q':
fd = open("/dev/null", O_WRONLY);
close(STDOUT_FILENO);
dup2(STDOUT_FILENO, fd);
break;
default: /* '?' */
fprintf(stderr, "Usage: %s [-q]\n", argv[0]);
exit(EXIT_FAILURE);
}
}
quad_main(setup_hardware);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment