Skip to content

Commit

Permalink
fix(test): modify vl53l0x and reduce pwm for NSUMO
Browse files Browse the repository at this point in the history
Surprisingly, most tests work on NSUMO without any require any changes,
but test_vl53l0x_multiple doesn't, because left and right are not
ignored properly in vl53l0x driver, so fix that. Also reduce the PWM in
test_motors to avoid running the motors at full speed.

video: 24
  • Loading branch information
niklasab committed Jun 16, 2023
1 parent da4bdfc commit d697060
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/drivers/vl53l0x.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,11 @@ static bool vl53l0x_is_sysrange_done(vl53l0x_idx_e idx)
if (idx != VL53L0X_IDX_FRONT) {
return true;
}
#elif defined(NSUMO)
if (idx != VL53L0X_IDX_FRONT_LEFT && idx != VL53L0X_IDX_FRONT
&& idx != VL53L0X_IDX_FRONT_RIGHT) {
return true;
}
#endif
i2c_set_slave_address(vl53l0x_cfgs[idx].addr);
uint8_t interrupt_status = 0;
Expand Down
11 changes: 9 additions & 2 deletions src/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static void test_blink_led(void)
SUPPRESS_UNUSED
static void test_launchpad_io_pins_output(void)
{
#if defined(LAUNCHPAD)
test_setup();
const struct io_config output_config = { .select = IO_SELECT_GPIO,
.resistor = IO_RESISTOR_DISABLED,
Expand All @@ -65,6 +66,7 @@ static void test_launchpad_io_pins_output(void)
io_set_out(io, IO_OUT_LOW);
}
}
#endif
}

/* Configure all pins except one (pin 1.0) as input with internal pull-up resistors. Configure
Expand All @@ -77,6 +79,7 @@ static void test_launchpad_io_pins_output(void)
SUPPRESS_UNUSED
static void test_launchpad_io_pins_input(void)
{
#if defined(LAUNCHPAD)
test_setup();
led_init();
const struct io_config input_config = {
Expand Down Expand Up @@ -114,6 +117,7 @@ static void test_launchpad_io_pins_input(void)
led_set(LED_TEST, LED_STATE_OFF);
BUSY_WAIT_ms(2000);
}
#endif
}

SUPPRESS_UNUSED
Expand All @@ -131,6 +135,7 @@ static void io_20_isr(void)
SUPPRESS_UNUSED
static void test_io_interrupt(void)
{
#if defined(LAUNCHPAD)
test_setup();
const struct io_config input_config = {
.select = IO_SELECT_GPIO,
Expand All @@ -146,6 +151,7 @@ static void test_io_interrupt(void)
io_enable_interrupt(IO_11);
io_enable_interrupt(IO_20);
while(1);
#endif
}

SUPPRESS_UNUSED
Expand Down Expand Up @@ -219,7 +225,7 @@ static void test_tb6612fng(void)
TB6612FNG_MODE_FORWARD,
TB6612FNG_MODE_REVERSE,
};
const uint8_t duty_cycles[] = { 100, 50, 25, 0 };
const uint8_t duty_cycles[] = { 45, 35, 25, 0 };
while (1) {
for (uint8_t i = 0; i < ARRAY_SIZE(duty_cycles); i++)
{
Expand Down Expand Up @@ -430,7 +436,8 @@ void test_vl53l0x_multiple(void)
if (result) {
TRACE("Range measure failed (result %u)", result);
}
TRACE("Range measure f %u fl %u fr %u l %u r %u", ranges[VL53L0X_IDX_FRONT],
TRACE("Range measure (fresh %d) f %u fl %u fr %u l %u r %u", fresh_values,
ranges[VL53L0X_IDX_FRONT],
ranges[VL53L0X_IDX_FRONT_LEFT],
ranges[VL53L0X_IDX_FRONT_RIGHT],
ranges[VL53L0X_IDX_LEFT],
Expand Down

0 comments on commit d697060

Please sign in to comment.