Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When radiotest driver is included spin motors #1400

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/deck/drivers/src/test/radiotest.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
#include "deck.h"
#include "syslink.h"
#include "param.h"
#include "platform_defaults.h"


#define SHOULD_SPIN_MOTORS 0

#ifdef CONFIG_MOTORS_DEFAULT_IDLE_THRUST
#define MOTOR_SPEED CONFIG_MOTORS_DEFAULT_IDLE_THRUST
#else
#define MOTOR_SPEED 7000
#endif


//Hardware configuration
static bool isInit;
Expand All @@ -47,6 +58,18 @@ static uint8_t old_channel;
static int8_t old_power;
static uint8_t old_contwave;

static void spinMotorsTask(void *param)
{
vTaskDelay(M2T(4000)); // Wait for the ESCs to be ready to recieve signals

paramVarId_t motorPowerSetEnableParam = paramGetVarId("motorPowerSet", "enable");
paramVarId_t motorParams = paramGetVarId("motorPowerSet", "m1");
paramSetInt(motorPowerSetEnableParam, 2);
paramSetInt(motorParams, MOTOR_SPEED);

vTaskDelete(NULL);
}

static void radiotestTask(void *param)
{

Expand Down Expand Up @@ -93,7 +116,9 @@ static void radiotestInit(DeckInfo *info)
return;

xTaskCreate(radiotestTask, "RADIOTEST", configMINIMAL_STACK_SIZE, NULL, 1, NULL);

if (SHOULD_SPIN_MOTORS) {
xTaskCreate(spinMotorsTask, "spinMotors", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
}
isInit = true;
}

Expand Down
Loading