sw: minor formatting improvements for tester
Add the version number, and make the final "Pass" text be more easily parsed by a simple grep. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
		@@ -49,7 +49,7 @@ CFLAGS     := $(ADD_CFLAGS) \
 | 
			
		||||
			  -ffunction-sections -fdata-sections -fno-common \
 | 
			
		||||
			  -fomit-frame-pointer -Os \
 | 
			
		||||
			  -march=rv32i \
 | 
			
		||||
			  -DGIT_VERSION=u\"$(GIT_VERSION)\" -std=gnu11
 | 
			
		||||
			  -DGIT_VERSION=\"$(GIT_VERSION)\" -std=gnu11
 | 
			
		||||
CXXFLAGS   := $(CFLAGS) -std=c++11 -fno-rtti -fno-exceptions
 | 
			
		||||
LFLAGS     := $(CFLAGS) $(ADD_LFLAGS) -L$(LD_DIR) \
 | 
			
		||||
			  -nostartfiles \
 | 
			
		||||
 
 | 
			
		||||
@@ -82,18 +82,21 @@ static uint32_t test_one_pad(uint8_t src, uint8_t dest)
 | 
			
		||||
    put_char('>');
 | 
			
		||||
    put_char('0' + dest);
 | 
			
		||||
    put_char(':');
 | 
			
		||||
    for (loops = 0; loops < loop_max; loops++) {
 | 
			
		||||
    for (loops = 0; loops < loop_max; loops++)
 | 
			
		||||
    {
 | 
			
		||||
        // Set pin 2 as output, and pin 0 as input, and see if it loops back.
 | 
			
		||||
        touch_oe_write((1 << src) | (0 << dest));
 | 
			
		||||
        touch_o_write((loops & 1) << src);
 | 
			
		||||
        if ((loops & 1) == !!((touch_i_read() & (1 << dest))))
 | 
			
		||||
            matches++;
 | 
			
		||||
    }
 | 
			
		||||
    if (matches == loop_max) {
 | 
			
		||||
    if (matches == loop_max)
 | 
			
		||||
    {
 | 
			
		||||
        put_string("OK ");
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        put_string("FAIL(");
 | 
			
		||||
        put_hex_byte(loop_max);
 | 
			
		||||
        put_char('!');
 | 
			
		||||
@@ -107,7 +110,7 @@ static uint32_t test_touch(void)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t error_count = 0;
 | 
			
		||||
 | 
			
		||||
    put_string("Touch: ");
 | 
			
		||||
    put_string("TOUCH: ");
 | 
			
		||||
 | 
			
		||||
    error_count += test_one_pad(0, 2);
 | 
			
		||||
    error_count += test_one_pad(0, 3);
 | 
			
		||||
@@ -159,7 +162,7 @@ static uint32_t test_one_color(int color)
 | 
			
		||||
 | 
			
		||||
    uint32_t ratio = ((detected_pulses * 100) / sent_pulses);
 | 
			
		||||
    put_string("Ratio: 0x");
 | 
			
		||||
    put_hex(ratio);
 | 
			
		||||
    put_hex_byte(ratio);
 | 
			
		||||
    put_string(" / ");
 | 
			
		||||
    if (ratio > 60)
 | 
			
		||||
    {
 | 
			
		||||
@@ -188,18 +191,20 @@ static uint32_t test_led(void)
 | 
			
		||||
void tester_poll(void)
 | 
			
		||||
{
 | 
			
		||||
    int error_count = 0;
 | 
			
		||||
    put_string("\nHello, world!\n");
 | 
			
		||||
    put_char('\n');
 | 
			
		||||
    flush_serial();
 | 
			
		||||
    put_string("\nFomu Tester " GIT_VERSION "\n");
 | 
			
		||||
    error_count += test_spi();
 | 
			
		||||
    error_count += test_led();
 | 
			
		||||
    error_count += test_touch();
 | 
			
		||||
 | 
			
		||||
    put_string("FOMU: ");
 | 
			
		||||
    put_string("FOMU: (0x");
 | 
			
		||||
    put_hex(error_count);
 | 
			
		||||
    put_string(" errors ");
 | 
			
		||||
    put_string(" errors) ");
 | 
			
		||||
    if (error_count)
 | 
			
		||||
        put_string("FAIL!\n");
 | 
			
		||||
    else
 | 
			
		||||
        put_string("Pass\n");
 | 
			
		||||
        put_string("ALL_PASS\n");
 | 
			
		||||
    while (1)
 | 
			
		||||
    {
 | 
			
		||||
        usb_poll();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user