static void cmd_servo_parsed(void * parsed_result, void *data)
{
struct cmd_servo_result *res = parsed_result;
- uint8_t i;
(void)data;
spi_servo_set_ppm(!!res->val);
}
else if (!strcmp_P(res->arg1, PSTR("show"))) {
- for (i = 0; i < 6; i++)
- printf_P(PSTR("%d: %d\r\n"), i, spi_servo_get(i));
- printf_P(PSTR("bypass=%d ppm=%d\n"),
- spi_servo_get_bypass(), spi_servo_get_ppm());
- printf_P(PSTR("\r\n"));
+ spi_servo_dump();
}
}
spi_servo_set(i, val);
wait_ms(wait_time);
-
- for (i = 0; i < 6; i++)
- printf_P(PSTR("%d: %d\r\n"), i, spi_servo_get(i));
- printf_P(PSTR("\r\n"));
+ printf_P(PSTR("%4.4d %4.4d %4.4d %4.4d %4.4d %4.4d\r\n"),
+ spi_servo_get(0), spi_servo_get(1), spi_servo_get(2),
+ spi_servo_get(3), spi_servo_get(4), spi_servo_get(5));
}
printf_P(PSTR("bypass mode, with spi commands in background\r\n"));
spi_servo_set(i, val);
wait_ms(wait_time);
-
- for (i = 0; i < 6; i++)
- printf_P(PSTR("%d: %d\r\n"), i, spi_servo_get(i));
- printf_P(PSTR("\r\n"));
+ printf_P(PSTR("%4.4d %4.4d %4.4d %4.4d %4.4d %4.4d\r\n"),
+ spi_servo_get(0), spi_servo_get(1), spi_servo_get(2),
+ spi_servo_get(3), spi_servo_get(4), spi_servo_get(5));
}
printf_P(PSTR("PPM to servo\r\n"));
spi_servo_tx.cmd_mask |= (1 << N_SERVO);
IRQ_UNLOCK(flags);
}
+
+void spi_servo_dump(void)
+{
+ uint8_t i;
+
+ for (i = 0; i < N_SERVO; i++)
+ printf_P(PSTR("%d: rx=%4.4d tx=%4.4d\r\n"), i,
+ spi_servo_get(i), spi_servo_tx.servo[i]);
+ printf_P(PSTR("bypass=%d ppm=%d\n"),
+ spi_servo_get_bypass(), spi_servo_get_ppm());
+}