修改了电机控制盒初始化,上电后暂不进行校准
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_timer.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -39,9 +40,11 @@
|
||||
#define PLATFORM_STEPPER_DECEL_STEPS 48
|
||||
#define PLATFORM_STEPPER_STEPS_PER_REV 4128.0f
|
||||
#define PLATFORM_STEPPER_POWER_OFF_WAIT_MS 1000
|
||||
#define PLATFORM_STEPPER_MAX_ROTATION_DEG 330.0f
|
||||
#define PLATFORM_GPIO_LOW_BANK_MAX_PIN 31
|
||||
#define PLATFORM_GPIO_HIGH_BANK_OFFSET 32
|
||||
|
||||
static const char *TAG = "platform_stepper";
|
||||
static portMUX_TYPE s_stepper_mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
static SemaphoreHandle_t s_stepper_motion_mutex;
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
@@ -331,6 +334,13 @@ esp_err_t platform_stepper_driver_rotate_angle_with_accel(float angle,
|
||||
if (!ensure_stepper_motion_mutex()) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (fabsf(angle) > PLATFORM_STEPPER_MAX_ROTATION_DEG) {
|
||||
ESP_LOGE(TAG,
|
||||
"rotation rejected: angle %.1f exceeds %.1f deg limit",
|
||||
angle,
|
||||
PLATFORM_STEPPER_MAX_ROTATION_DEG);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
int64_t start_ms = esp_timer_get_time() / 1000;
|
||||
TickType_t lock_ticks = (timeout_ms > 0) ? pdMS_TO_TICKS(timeout_ms) : portMAX_DELAY;
|
||||
|
||||
Reference in New Issue
Block a user