Skip to content

Commit 1faf409

Browse files
committed
Complete MZTC build blockers exposed by enabling USE_MZTC in SITL
Enabling the feature in SITL (previous commit) surfaced two latent issues in the feature code that only manifest when USE_MZTC is actually compiled in: - mztc_camera.c used fprintf(stderr, ...) via the SD() macro without including <stdio.h> (6 'stderr undeclared' compile errors). - mztc_camera_osd.c declared mztcOsdConfig via PG_DECLARE and used PG_MZTC_OSD_CONFIG (1047) but never registered the parameter group (undefined reference to mztcOsdConfig_System at link time). Added PG_REGISTER_WITH_RESET_TEMPLATE + PG_RESET_TEMPLATE following the mztcConfig pattern, with the MZTC_OSD_DEFAULT_* defines moved above the template so the macros resolve. SITL now compiles and links with the camera code active (verified via fresh cmake -DSITL=ON + make SITL build).
1 parent 612779a commit 1faf409

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/main/io/mztc_camera.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <stdbool.h>
1919
#include <stdint.h>
20+
#include <stdio.h>
2021
#include <string.h>
2122
#include <math.h>
2223
#include <stdlib.h>

src/main/io/osd/mztc_camera_osd.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
#ifdef USE_MZTC
4242

43-
// Parameter group ID for MassZero Thermal Camera OSD configuration (defined in parameter_group_ids.h)
44-
4543
// Default OSD configuration values
4644
#define MZTC_OSD_DEFAULT_ENABLED 1
4745
#define MZTC_OSD_DEFAULT_TEMP_DISPLAY 1
@@ -53,6 +51,21 @@
5351
#define MZTC_OSD_DEFAULT_POS_Y 10
5452
#define MZTC_OSD_DEFAULT_VISIBILITY MZTC_OSD_VISIBLE_ALWAYS
5553

54+
// Parameter group for MassZero Thermal Camera OSD configuration
55+
PG_REGISTER_WITH_RESET_TEMPLATE(mztcOsdConfig_t, mztcOsdConfig, PG_MZTC_OSD_CONFIG, 0);
56+
57+
PG_RESET_TEMPLATE(mztcOsdConfig_t, mztcOsdConfig,
58+
.enabled = MZTC_OSD_DEFAULT_ENABLED,
59+
.temperature_display = MZTC_OSD_DEFAULT_TEMP_DISPLAY,
60+
.status_display = MZTC_OSD_DEFAULT_STATUS_DISPLAY,
61+
.alerts_display = MZTC_OSD_DEFAULT_ALERTS_DISPLAY,
62+
.calibration_display = MZTC_OSD_DEFAULT_CALIB_DISPLAY,
63+
.connection_display = MZTC_OSD_DEFAULT_CONN_DISPLAY,
64+
.position_x = MZTC_OSD_DEFAULT_POS_X,
65+
.position_y = MZTC_OSD_DEFAULT_POS_Y,
66+
.visibility_flags = MZTC_OSD_DEFAULT_VISIBILITY,
67+
);
68+
5669

5770
// Internal state
5871
static bool mztcOsdInitialized = false;

0 commit comments

Comments
 (0)