Skip to content

Commit

Permalink
fix: changed the test to only 4 channels and LEDC_LOW_SPEED_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrominatel committed Dec 2, 2024
1 parent aa94cc6 commit 8242311
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions components/motor/servo/test_apps/main/test_servo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static size_t before_free_32bit;

static void _set_angle(ledc_mode_t speed_mode, float angle)
{
for (size_t i = 0; i < 8; i++) {
for (size_t i = 0; i < 4; i++) {
iot_servo_write_angle(speed_mode, i, angle);
}
}
Expand All @@ -53,35 +53,21 @@ TEST_CASE("Servo_motor test", "[servo][iot]")
LEDC_CHANNEL_3,
},
},
.channel_number = 8,
.channel_number = 4,
} ;
TEST_ASSERT(ESP_OK == iot_servo_init(LEDC_LOW_SPEED_MODE, &servo_cfg_ls));

size_t i;
float angle_ls, angle_hs;
for (i = 0; i <= 180; i++) {
_set_angle(LEDC_LOW_SPEED_MODE, i);
#ifdef CONFIG_IDF_TARGET_ESP32
_set_angle(LEDC_HIGH_SPEED_MODE, (180 - i));
#endif
vTaskDelay(50 / portTICK_PERIOD_MS);
iot_servo_read_angle(LEDC_LOW_SPEED_MODE, 0, &angle_ls);
#ifdef CONFIG_IDF_TARGET_ESP32
iot_servo_read_angle(LEDC_HIGH_SPEED_MODE, 0, &angle_hs);
#endif

#ifdef CONFIG_IDF_TARGET_ESP32
ESP_LOGI("servo", "[%d|%.2f], [%d|%.2f]", i, angle_ls, (180 - i), angle_hs);
#else
ESP_LOGI("servo", "[%d|%.2f]", i, angle_ls);
(void)angle_hs;
#endif
}

iot_servo_deinit(LEDC_LOW_SPEED_MODE);
#ifdef CONFIG_IDF_TARGET_ESP32
iot_servo_deinit(LEDC_HIGH_SPEED_MODE);
#endif
}

static void check_leak(size_t before_free, size_t after_free, const char *type)
Expand Down

0 comments on commit 8242311

Please sign in to comment.