mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:07:34 +08:00
Closing all opened file descriptors, fixed param save issue, tests clean
This commit is contained in:
@@ -505,8 +505,15 @@ param_get_default_file(void)
|
||||
int
|
||||
param_save_default(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
/* delete the file in case it exists */
|
||||
unlink(param_get_default_file());
|
||||
struct stat buffer;
|
||||
if (stat(param_get_default_file(), &buffer) == 0) {
|
||||
result = unlink(param_get_default_file());
|
||||
if (result != OK)
|
||||
warnx("unlinking file %s failed.", param_get_default_file());
|
||||
}
|
||||
|
||||
/* create the file */
|
||||
int fd = open(param_get_default_file(), O_WRONLY | O_CREAT | O_EXCL);
|
||||
@@ -516,7 +523,7 @@ param_save_default(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int result = param_export(fd, false);
|
||||
result = param_export(fd, false);
|
||||
close(fd);
|
||||
|
||||
if (result != 0) {
|
||||
|
||||
@@ -66,7 +66,7 @@ int rc_calibration_check(void) {
|
||||
// count++;
|
||||
// }
|
||||
|
||||
|
||||
int channel_fail_count = 0;
|
||||
|
||||
for (int i = 0; i < RC_CHANNELS_MAX; i++) {
|
||||
/* should the channel be enabled? */
|
||||
@@ -142,7 +142,12 @@ int rc_calibration_check(void) {
|
||||
/* sanity checks pass, enable channel */
|
||||
if (count) {
|
||||
mavlink_log_critical(mavlink_fd, "ERROR: %d config error(s) for RC channel %d.", count, (i + 1));
|
||||
warnx(mavlink_fd, "ERROR: %d config error(s) for RC channel %d.", count, (i + 1));
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
channel_fail_count += count;
|
||||
}
|
||||
|
||||
return channel_fail_count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user