Skip to content

Commit 6b620c8

Browse files
committed
support hdzcs cvbs camera
1 parent 92396f2 commit 6b620c8

4 files changed

Lines changed: 39 additions & 16 deletions

File tree

src/camera.c

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ extern uint8_t g_camera_switch;
3333
void camera_type_detect(void) {
3434
camera_type = CAMERA_TYPE_UNKNOWN;
3535

36-
runcam_type_detect();
37-
if (camera_type == CAMERA_TYPE_RUNCAM_MICRO_V1 ||
38-
camera_type == CAMERA_TYPE_RUNCAM_MICRO_V2 ||
39-
camera_type == CAMERA_TYPE_RUNCAM_NANO_90 ||
40-
camera_type == CAMERA_TYPE_RUNCAM_MICRO_V3) {
41-
camera_mfr = CAMERA_MFR_RUNCAM;
42-
return;
36+
if (g_camera_switch == SWITCH_TYPE_HDZCS && g_camera_id == 3) {
37+
camera_type = CAMERA_TYPE_HDZCS_CVBS;
38+
camera_mfr = CAMERA_MFR_HDZERO;
39+
} else {
40+
runcam_type_detect();
41+
if (camera_type == CAMERA_TYPE_RUNCAM_MICRO_V1 ||
42+
camera_type == CAMERA_TYPE_RUNCAM_MICRO_V2 ||
43+
camera_type == CAMERA_TYPE_RUNCAM_NANO_90 ||
44+
camera_type == CAMERA_TYPE_RUNCAM_MICRO_V3) {
45+
camera_mfr = CAMERA_MFR_RUNCAM;
46+
return;
47+
}
4348
}
4449
}
4550

@@ -62,6 +67,9 @@ void camera_ratio_detect(void) {
6267
camRatio = 1;
6368
break;
6469
#endif
70+
case CAMERA_TYPE_HDZCS_CVBS:
71+
camRatio = 1;
72+
break;
6573
default:
6674
camRatio = 0;
6775
break;
@@ -169,8 +177,12 @@ void camera_mode_detect(uint8_t init) {
169177

170178
// init tc3587 and detect fps
171179
WriteReg(0, 0x8F, 0x91);
172-
173-
if (camera_type == CAMERA_TYPE_RUNCAM_NANO_90) {
180+
if (camera_type == CAMERA_TYPE_HDZCS_CVBS) {
181+
Init_TC3587(0);
182+
Set_720P60(IS_RX);
183+
video_format = VDO_FMT_720P60;
184+
I2C_Write16(ADDR_TC3587, 0x0058, 0x00e0);
185+
} else if (camera_type == CAMERA_TYPE_RUNCAM_NANO_90) {
174186
Init_TC3587(1);
175187
if (camera_setting_reg_set[11] == 0) {
176188
Set_540P90(0);
@@ -331,7 +343,8 @@ void camera_setting_read(void) {
331343

332344
if (camera_type == CAMERA_TYPE_UNKNOWN ||
333345
camera_type == CAMERA_TYPE_OUTDATED ||
334-
camera_type == CAMERA_TYPE_RESERVED)
346+
camera_type == CAMERA_TYPE_RESERVED ||
347+
camera_type == CAMERA_TYPE_HDZCS_CVBS)
335348
return;
336349

337350
camera_type_last = camera_reg_read_eep(EEP_ADDR_CAM_TYPE);

src/camera.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ typedef enum {
2828
CAMERA_MFR_UNKNOW,
2929
CAMERA_MFR_FOXEER,
3030
CAMERA_MFR_RUNCAM,
31+
CAMERA_MFR_HDZERO,
3132
} camera_manufacture_e;
3233

3334
typedef enum {
@@ -38,6 +39,7 @@ typedef enum {
3839
CAMERA_TYPE_RUNCAM_MICRO_V2, // include hzd nano v2 / hdz nano lite
3940
CAMERA_TYPE_RUNCAM_NANO_90,
4041
CAMERA_TYPE_RUNCAM_MICRO_V3,
42+
CAMERA_TYPE_HDZCS_CVBS,
4143
CAMERA_TYPE_NUM,
4244
} camera_type_e;
4345

src/hardware.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ void Init_HW() {
514514
#ifdef RESET_CONFIG
515515
reset_config();
516516
#endif
517-
517+
518518
GetVtxParameter();
519519
Get_EEP_LifeTime();
520-
520+
521521
camera_switch_init();
522522
camera_init();
523523

@@ -1023,14 +1023,20 @@ void video_detect(void) {
10231023
}
10241024

10251025
cameraLost = (ReadReg(0, 0x02) >> 4) & 1;
1026+
#ifdef USE_TP9950
10261027
if (camera_type == CAMERA_TYPE_OUTDATED) {
10271028
cameraLost |= (I2C_Read8(ADDR_TP9950, 0x01) != 0x7E);
10281029
return;
10291030
}
1031+
#endif
1032+
if (camera_type == CAMERA_TYPE_HDZCS_CVBS) {
1033+
return;
1034+
}
10301035

1031-
if (sec == 3) {
1032-
sec = 0;
1033-
if (cameraLost) { // video loss
1036+
if (cameraLost) {
1037+
sec++;
1038+
if (sec == 3) { // video loss
1039+
sec = 0;
10341040
if (video_format == VDO_FMT_720P50) {
10351041
Set_720P60(IS_RX);
10361042
video_format = VDO_FMT_720P60;
@@ -1039,6 +1045,8 @@ void video_detect(void) {
10391045
video_format = VDO_FMT_720P50;
10401046
}
10411047
}
1048+
} else {
1049+
sec = 0;
10421050
}
10431051
}
10441052
}

src/msp_displayport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ void update_vtx_menu_param(uint8_t state) {
19741974
const char *pitString[] = {" OFF", " P1MW", " 0MW"};
19751975
const char *treamRaceString[] = {" OFF", "MODE1", "MODE2"};
19761976
const char *shortcutString[] = {"OPT_A", "OPT_B"};
1977-
const char *cameraTypeString[] = {"UNKNOWN", "RESERVED", "OUTDATED", "MICRO_V1", "MICRO_V2", "NANO_90", "MICRO_V3"};
1977+
const char *cameraTypeString[] = {"UNKNOWN ", "RESERVED", "OUTDATED", "MICRO_V1", "MICRO_V2", "NANO_90 ", "MICRO_V3", "CVBS "};
19781978
const char *cameraSwitchString[] = {"NONE", "DUAL", "TRIPLE"};
19791979

19801980
// cursor

0 commit comments

Comments
 (0)