Hi Víctor,
> <
https://github.com/erlerobot/ardupilot/commits/log-directory-change> with
> a few commits. HAL_Linux_Class.cpp makes now use of GetOptLong and the
> argument passed to GetOptLong is now stored in a member of the Util class
> <
https://github.com/erlerobot/ardupilot/commit/397261615a0543c8d7a732ada589317ef9423152#diff-f927fb5712b09354f3b814b3629e2f0dR88>
Thanks! A few comments:
- I don't think we need a set_custom_log_directory() function, and we
don't need the private variables in the top level HAL class
- the get_custom_log_directory() should return a const char *, and
should default to { return NULL; }
- in the GetOptLong table calling it "uartA" would be better than
"uartADriver" as it is setting the device, not the driver
- we should remove the (char *) cast for set_device_path() and instead
fix UARTDriver.cpp to take a const char *. In general casting a const
char* to a char* is a bad idea.
- in _usage() it is better to have the options one per line, or it
becomes unreadable as it grows
- when processing the --log-directory and --terrain-directory options
just set the variable in private variables in the HAL_Linux class,
then implement the hal.util->get_custom_log_directory() function to
return that value (we want it this way as we don't want ports that
have no concept of command line options to pay any price for the
functions)
- in DataFlash_File.cpp we then use
hal.util->get_custom_log_directory() to get the directory. If it
returns NULL then we use the current default. Having a private const
char* variable in that class to hold the chosen directory may be
easiest.
Thanks!
Cheers, Tridge