Disable debug output, Remove impl. without timer

disable debug task
remove software implementation of stepper control
This commit is contained in:
jonny_ji7 2023-04-25 19:04:36 +02:00
parent e8e1070bd1
commit 3488281502
3 changed files with 6 additions and 57 deletions

View File

@ -94,9 +94,8 @@ extern "C" void app_main()
#ifdef STEPPER_TEST
//create task for stepper testing
//xTaskCreate(task_stepperCtrlSw, "task stepper control software", configMINIMAL_STACK_SIZE * 3, NULL, configMAX_PRIORITIES - 1, NULL);
xTaskCreate(task_stepper_test, "task_stepper_test", configMINIMAL_STACK_SIZE * 3, NULL, 2, NULL);
xTaskCreate(task_stepper_debug, "task_stepper_test", configMINIMAL_STACK_SIZE * 3, NULL, 2, NULL);
//xTaskCreate(task_stepper_debug, "task_stepper_test", configMINIMAL_STACK_SIZE * 3, NULL, 2, NULL);
#else
//create task for controlling the machine
xTaskCreate(task_control, "task_control", configMINIMAL_STACK_SIZE * 3, NULL, 4, NULL);

View File

@ -54,57 +54,6 @@ static uint32_t accel_increment = STEPPER_ACCEL_INC;
//===============================
//=== software - control task ===
//===============================
//stepper driver in software for testing (no timer/interrupt):
uint64_t stepsTarget = 0;
void task_stepperCtrlSw(void *pvParameter)
{
uint64_t stepsNow = 0;
int increment = 1;
while(1){
int64_t delta = stepsTarget - stepsNow;
//at position, nothing to do
if (delta == 0){
ESP_LOGW(TAG, "delta =0 waiting for change");
vTaskDelay(300 / portTICK_PERIOD_MS);
continue;
}
//define direction
if (delta > 0){
gpio_set_level(STEPPER_DIR_PIN, 0);
increment = 1;
} else {
gpio_set_level(STEPPER_DIR_PIN, 1);
increment = -1;
}
//do one step
//note: triggers watchdog at long movements
stepsNow += increment;
gpio_set_level(STEPPER_STEP_PIN, 1);
ets_delay_us(30);
gpio_set_level(STEPPER_STEP_PIN, 0);
ets_delay_us(90); //speed
}
}
//=================================
//=== software - set target pos ===
//=================================
void stepperSw_setTargetSteps(uint64_t target){
stepsTarget = target;
char buffer[20];
snprintf(buffer, sizeof(buffer), "%" PRIu64, target);
ESP_LOGW(TAG, "set target steps to %s", buffer);
}
//======================
//===== DEBUG task =====
//======================
@ -137,6 +86,7 @@ void task_stepper_debug(void *pvParameter){
}
//=====================
//===== set speed =====
//=====================
@ -147,6 +97,7 @@ void stepper_setSpeed(uint32_t speedMmPerS) {
}
//==========================
//== set target pos STEPS ==
//==========================
@ -166,6 +117,7 @@ void stepper_setTargetPosSteps(uint64_t target_steps) {
}
//=========================
//=== set target pos MM ===
//=========================

View File

@ -6,10 +6,8 @@ void stepper_init();
void stepper_setTargetPosSteps(uint64_t steps);
//set absolute target position in millimeters
void stepper_setTargetPosMm(uint32_t posMm);
//set target speed in millimeters per second
void stepper_setSpeed(uint32_t speedMmPerS);
//task that periodically logs variables for debugging stepper driver
void task_stepper_debug(void *pvParameter);
//control stepper without timer (software)
void task_stepperCtrlSw(void *pvParameter);
void stepperSw_setTargetSteps(uint64_t target);