mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
bebop_fix fix sign compare
This commit is contained in:
parent
661b36df6b
commit
e6f2ba9864
@ -48,10 +48,9 @@ char pgm_path[] = "/home/root/images/";
|
||||
|
||||
void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
|
||||
{
|
||||
int written, total, fd;
|
||||
struct stat sb;
|
||||
|
||||
// Check if dump directory exists
|
||||
struct stat sb = {};
|
||||
|
||||
if (!(stat(pgm_path, &sb) == 0 && S_ISDIR(sb.st_mode))) {
|
||||
PX4_ERR("Dump directory does not exist: %s", pgm_path);
|
||||
PX4_ERR("No images are written!");
|
||||
@ -63,7 +62,7 @@ void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
|
||||
snprintf(file_path, sizeof(file_path), "%s%s%08u.pgm", pgm_path, pgm_dumpname, seq);
|
||||
PX4_INFO("%s", file_path);
|
||||
|
||||
fd = open(file_path, O_WRONLY | O_NONBLOCK | O_CREAT, 00666);
|
||||
int fd = open(file_path, O_WRONLY | O_NONBLOCK | O_CREAT, 00666);
|
||||
|
||||
if (fd < 0) {
|
||||
PX4_ERR("Dump: Unable to open file");
|
||||
@ -72,10 +71,10 @@ void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
|
||||
|
||||
// Write pgm header
|
||||
snprintf(&pgm_header[4], 15, "%014d", (int)timestamp);
|
||||
written = write(fd, pgm_header, sizeof(pgm_header));
|
||||
size_t written = write(fd, pgm_header, sizeof(pgm_header));
|
||||
|
||||
// Write image data
|
||||
total = 0;
|
||||
size_t total = 0;
|
||||
|
||||
do {
|
||||
written = write(fd, data, size);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user