2021-10-30 11:18:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* apps/examples/foc/foc_parseargs.c
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
2021-10-30 11:42:14 +02:00
|
|
|
#include <getopt.h>
|
2021-10-30 11:18:00 +02:00
|
|
|
|
|
|
|
#include "foc_debug.h"
|
2022-10-22 19:16:48 +02:00
|
|
|
#include "foc_thr.h"
|
2021-10-30 11:18:00 +02:00
|
|
|
#include "foc_parseargs.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
#define OPT_FKI (SCHAR_MAX + 1)
|
|
|
|
#define OPT_FKP (SCHAR_MAX + 2)
|
|
|
|
|
2022-10-22 19:41:34 +02:00
|
|
|
#define OPT_IRKI (SCHAR_MAX + 3)
|
|
|
|
#define OPT_IRC (SCHAR_MAX + 4)
|
|
|
|
#define OPT_IRS (SCHAR_MAX + 5)
|
|
|
|
#define OPT_IIV (SCHAR_MAX + 6)
|
|
|
|
#define OPT_IIS (SCHAR_MAX + 7)
|
|
|
|
|
2021-10-30 11:18:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
static struct option g_long_options[] =
|
|
|
|
{
|
|
|
|
{ "time", required_argument, 0, 't' },
|
|
|
|
{ "help", no_argument, 0, 'h' },
|
2021-10-31 20:30:37 +01:00
|
|
|
{ "fmode", required_argument, 0, 'f' },
|
|
|
|
{ "mmode", required_argument, 0, 'm' },
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
|
|
|
{ "torq", required_argument, 0, 'r' },
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_VEL
|
2021-10-30 11:42:14 +02:00
|
|
|
{ "vel", required_argument, 0, 'v' },
|
2021-10-31 20:30:37 +01:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_POS
|
|
|
|
{ "pos", required_argument, 0, 'x' },
|
|
|
|
#endif
|
2021-10-30 11:42:14 +02:00
|
|
|
{ "state", required_argument, 0, 's' },
|
|
|
|
{ "en", required_argument, 0, 'j' },
|
2021-10-31 20:30:37 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_OPENLOOP
|
2021-10-30 11:42:14 +02:00
|
|
|
{ "oqset", required_argument, 0, 'o' },
|
2021-10-31 20:30:37 +01:00
|
|
|
#endif
|
2022-02-16 14:03:16 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_CONTROL_PI
|
2021-10-30 11:42:14 +02:00
|
|
|
{ "fkp", required_argument, 0, OPT_FKP },
|
|
|
|
{ "fki", required_argument, 0, OPT_FKI },
|
2022-10-22 19:41:34 +02:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
|
|
|
{ "irki", required_argument, 0, OPT_IRKI },
|
|
|
|
{ "irc", required_argument, 0, OPT_IRC },
|
|
|
|
{ "irs", required_argument, 0, OPT_IRS },
|
|
|
|
{ "iiv", required_argument, 0, OPT_IIV },
|
|
|
|
{ "iis", required_argument, 0, OPT_IIS },
|
2022-02-16 14:03:16 +01:00
|
|
|
#endif
|
2021-10-30 11:42:14 +02:00
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2021-10-30 11:18:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: foc_help
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static void foc_help(void)
|
|
|
|
{
|
|
|
|
PRINTF("Usage: foc [OPTIONS]\n");
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [-t] run time (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_TIME_DEFAULT);
|
2021-10-30 11:18:00 +02:00
|
|
|
PRINTF(" [-h] shows this message and exits\n");
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [-f] FOC run mode (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_FMODE);
|
2021-10-30 11:18:00 +02:00
|
|
|
PRINTF(" 1 - IDLE mode\n");
|
2021-12-26 23:10:48 +01:00
|
|
|
PRINTF(" 2 - voltage mode\n");
|
|
|
|
PRINTF(" 3 - current mode\n");
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [-m] controller mode (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_MMODE);
|
2021-12-26 23:10:48 +01:00
|
|
|
PRINTF(" 1 - torqe control\n");
|
|
|
|
PRINTF(" 2 - velocity control\n");
|
|
|
|
PRINTF(" 3 - position control\n");
|
2022-08-27 12:38:18 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
|
|
|
PRINTF(" 4 - align only\n");
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
|
|
|
PRINTF(" 5 - ident only\n");
|
|
|
|
#endif
|
2023-04-21 12:10:10 +02:00
|
|
|
PRINTF(" 6 - IDLE state\n");
|
2022-08-27 12:38:18 +02:00
|
|
|
|
2021-10-31 20:30:37 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
|
|
|
PRINTF(" [-r] torque [x1000]\n");
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_VEL
|
2021-10-30 11:18:00 +02:00
|
|
|
PRINTF(" [-v] velocity [x1000]\n");
|
2021-10-31 20:30:37 +01:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_POS
|
|
|
|
PRINTF(" [-x] position [x1000]\n");
|
|
|
|
#endif
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [-s] motor state init (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_STATE_INIT);
|
2021-10-30 11:18:00 +02:00
|
|
|
PRINTF(" 1 - motor free\n");
|
|
|
|
PRINTF(" 2 - motor stop\n");
|
|
|
|
PRINTF(" 3 - motor CW\n");
|
|
|
|
PRINTF(" 4 - motor CCW\n");
|
2022-01-05 16:34:05 +01:00
|
|
|
PRINTF(" [-j] enable specific instances\n");
|
2021-10-30 14:27:32 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_OPENLOOP
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [-o] openloop Vq/Iq setting [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_OPENLOOP_Q);
|
2021-10-30 14:27:32 +02:00
|
|
|
#endif
|
2022-02-16 14:03:16 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_CONTROL_PI
|
2022-08-27 09:42:38 +02:00
|
|
|
PRINTF(" [--fki] PI Kp coefficient [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDQ_KP);
|
|
|
|
PRINTF(" [--fkp] PI Ki coefficient [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDQ_KI);
|
2022-02-16 14:03:16 +01:00
|
|
|
#endif
|
2022-10-22 19:41:34 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
|
|
|
PRINTF(" [--irki] res Ki coefficient [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDENT_RES_KI);
|
|
|
|
PRINTF(" [--irc] res current [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDENT_RES_CURRENT);
|
|
|
|
PRINTF(" [--irs] res sec (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDENT_RES_SEC);
|
|
|
|
PRINTF(" [--iiv] ind voltage [x1000] (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDENT_IND_VOLTAGE);
|
|
|
|
PRINTF(" [--iis] ind sec (default: %d)\n",
|
|
|
|
CONFIG_EXAMPLES_FOC_IDENT_IND_SEC);
|
|
|
|
#endif
|
2021-10-30 11:18:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: parse_args
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
|
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
int option_index = 0;
|
|
|
|
int c = 0;
|
2021-10-30 11:18:00 +02:00
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
while (1)
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2021-10-31 20:30:37 +01:00
|
|
|
c = getopt_long(argc, argv, "ht:f:m:o:r:v:x:s:j:", g_long_options,
|
2021-10-30 11:42:14 +02:00
|
|
|
&option_index);
|
|
|
|
|
|
|
|
if (c == -1)
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
break;
|
2021-10-30 11:18:00 +02:00
|
|
|
}
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
switch (c)
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2022-02-16 14:03:16 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_CONTROL_PI
|
2021-10-30 11:42:14 +02:00
|
|
|
case OPT_FKP:
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.foc_pi_kp = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
case OPT_FKI:
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.foc_pi_ki = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
2022-02-16 14:03:16 +01:00
|
|
|
#endif
|
2021-10-30 11:18:00 +02:00
|
|
|
|
2022-10-22 19:41:34 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
|
|
|
case OPT_IRKI:
|
|
|
|
{
|
|
|
|
args->cfg.ident_res_ki = atoi(optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case OPT_IRC:
|
|
|
|
{
|
|
|
|
args->cfg.ident_res_curr = atoi(optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case OPT_IRS:
|
|
|
|
{
|
|
|
|
args->cfg.ident_res_sec = atoi(optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case OPT_IIV:
|
|
|
|
{
|
|
|
|
args->cfg.ident_ind_volt = atoi(optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case OPT_IIS:
|
|
|
|
{
|
|
|
|
args->cfg.ident_ind_sec = atoi(optarg);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
case 't':
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
args->time = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
case 'h':
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
foc_help();
|
|
|
|
exit(0);
|
2021-10-30 11:18:00 +02:00
|
|
|
}
|
|
|
|
|
2021-10-31 20:30:37 +01:00
|
|
|
case 'f':
|
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.fmode = atoi(optarg);
|
2021-10-31 20:30:37 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
case 'm':
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.mmode = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-31 20:30:37 +01:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
|
|
|
case 'r':
|
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.torqmax = atoi(optarg);
|
2021-10-31 20:30:37 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_VEL
|
2021-10-30 11:18:00 +02:00
|
|
|
case 'v':
|
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.velmax = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-10-31 20:30:37 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_POS
|
|
|
|
case 'x':
|
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.posmax = atoi(optarg);
|
2021-10-31 20:30:37 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2021-10-30 11:18:00 +02:00
|
|
|
|
|
|
|
case 's':
|
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
args->state = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'j':
|
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
args->en = atoi(optarg);
|
2021-10-30 11:18:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-30 14:27:32 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_OPENLOOP
|
2021-10-30 11:42:14 +02:00
|
|
|
case 'o':
|
2021-10-30 11:18:00 +02:00
|
|
|
{
|
2022-10-22 18:06:06 +02:00
|
|
|
args->cfg.qparam = atoi(optarg);
|
2021-10-30 11:42:14 +02:00
|
|
|
break;
|
2021-10-30 11:18:00 +02:00
|
|
|
}
|
2021-10-30 14:27:32 +02:00
|
|
|
#endif
|
2021-10-30 11:18:00 +02:00
|
|
|
|
2021-10-30 11:42:14 +02:00
|
|
|
case '?':
|
2021-10-30 11:18:00 +02:00
|
|
|
default:
|
|
|
|
{
|
2021-10-30 11:42:14 +02:00
|
|
|
if (argv[optind - 1] == NULL)
|
|
|
|
{
|
|
|
|
PRINTF("ERROR: invalid option argument for %s\n",
|
|
|
|
argv[optind - 2]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PRINTF("ERROR: invalid option %s\n", argv[optind - 1]);
|
|
|
|
}
|
|
|
|
|
2021-10-30 11:18:00 +02:00
|
|
|
foc_help();
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-22 19:16:48 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: validate_args
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int validate_args(FAR struct args_s *args)
|
|
|
|
{
|
|
|
|
int ret = -EINVAL;
|
|
|
|
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_CONTROL_PI
|
|
|
|
/* Current PI controller */
|
|
|
|
|
|
|
|
if (args->cfg.foc_pi_kp == 0 && args->cfg.foc_pi_ki == 0)
|
|
|
|
{
|
|
|
|
PRINTF("ERROR: missing FOC Kp/Ki configuration\n");
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* FOC operation mode */
|
|
|
|
|
|
|
|
if (args->cfg.fmode != FOC_FMODE_IDLE &&
|
|
|
|
args->cfg.fmode != FOC_FMODE_VOLTAGE &&
|
|
|
|
args->cfg.fmode != FOC_FMODE_CURRENT)
|
|
|
|
{
|
|
|
|
PRINTF("Invalid op mode value %d s\n", args->cfg.fmode);
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Example control mode */
|
|
|
|
|
2023-04-21 12:10:10 +02:00
|
|
|
if (args->cfg.mmode != FOC_MMODE_IDLE &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
2023-04-21 12:10:10 +02:00
|
|
|
args->cfg.mmode != FOC_MMODE_TORQ &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_VEL
|
2023-04-21 12:10:10 +02:00
|
|
|
args->cfg.mmode != FOC_MMODE_VEL &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_POS
|
2023-04-21 12:10:10 +02:00
|
|
|
args->cfg.mmode != FOC_MMODE_POS &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
2023-04-21 12:10:10 +02:00
|
|
|
args->cfg.mmode != FOC_MMODE_ALIGN_ONLY &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
2023-04-21 12:10:10 +02:00
|
|
|
args->cfg.mmode != FOC_MMODE_IDENT_ONLY &&
|
2022-10-22 19:16:48 +02:00
|
|
|
#endif
|
2023-04-21 12:10:10 +02:00
|
|
|
1)
|
2022-10-22 19:16:48 +02:00
|
|
|
{
|
|
|
|
PRINTF("Invalid ctrl mode value %d s\n", args->cfg.mmode);
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Example state */
|
|
|
|
|
|
|
|
if (args->state != FOC_EXAMPLE_STATE_FREE &&
|
|
|
|
args->state != FOC_EXAMPLE_STATE_STOP &&
|
|
|
|
args->state != FOC_EXAMPLE_STATE_CW &&
|
|
|
|
args->state != FOC_EXAMPLE_STATE_CCW)
|
|
|
|
{
|
|
|
|
PRINTF("Invalid state value %d s\n", args->state);
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Time parameter */
|
|
|
|
|
|
|
|
if (args->time <= 0 && args->time != -1)
|
|
|
|
{
|
|
|
|
PRINTF("Invalid time value %d s\n", args->time);
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
2022-10-22 19:41:34 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
|
|
|
/* Motor identification parameters */
|
|
|
|
|
|
|
|
if (args->cfg.ident_res_ki == 0 || args->cfg.ident_res_curr == 0 ||
|
|
|
|
args->cfg.ident_res_sec == 0)
|
|
|
|
{
|
|
|
|
PRINTF("ERROR: missing motor res ident configuration\n");
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args->cfg.ident_ind_volt == 0 || args->cfg.ident_ind_sec == 0)
|
|
|
|
{
|
|
|
|
PRINTF("ERROR: missing motor ind ident configuration\n");
|
|
|
|
goto errout;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-10-22 19:16:48 +02:00
|
|
|
/* Otherwise OK */
|
|
|
|
|
|
|
|
ret = OK;
|
|
|
|
|
|
|
|
errout:
|
|
|
|
return ret;
|
|
|
|
}
|