Skip to content

Commit 092d004

Browse files
authored
Merge pull request #12 from ligenxxxx/support-hdzero-1080p24
Support hdzero 1080p24
2 parents c2d96a0 + 3d007fe commit 092d004

File tree

13 files changed

+112
-37
lines changed

13 files changed

+112
-37
lines changed

mkapp/hal/HDZGOGGLE_RX.bin

292 Bytes
Binary file not shown.

mkapp/hal/HDZGOGGLE_VA.bin

-28.3 KB
Binary file not shown.

mkapp/hal/ver.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
76-176
1+
77-182

mkapp/ota_app/HDZGOGGLE_RX-76.bin

-7.34 KB
Binary file not shown.

mkapp/ota_app/HDZGOGGLE_VA-176.bin

-4.98 MB
Binary file not shown.

src/core/app_state.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,21 @@ void app_switch_to_hdzero(bool is_default) {
208208
Display_1080P30(CAM_MODE);
209209
break;
210210

211+
case VR_1080P24:
212+
Display_1080P24(CAM_MODE);
213+
break;
214+
211215
default:
212216
perror("switch_to_video CaM_MODE error");
213217
}
214218

215219
channel_osd_mode = CHANNEL_SHOWTIME;
216220

217-
if (CAM_MODE == VR_1080P30)
221+
if (CAM_MODE == VR_1080P30 || CAM_MODE == VR_1080P24)
218222
lvgl_switch_to_1080p();
219223
else
220224
lvgl_switch_to_720p();
221-
osd_fhd(CAM_MODE == VR_1080P30);
225+
osd_fhd(CAM_MODE == VR_1080P30 || CAM_MODE == VR_1080P24);
222226
osd_clear();
223227
osd_show(true);
224228
lv_timer_handler();

src/core/dvr.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ void dvr_update_vi_conf(video_resolution_t fmt) {
114114
ini_putl("vi", "height", 1080, REC_CONF);
115115
ini_putl("vi", "fps", 30, REC_CONF);
116116
break;
117+
case VR_1080P24:
118+
ini_putl("vi", "width", 1920, REC_CONF);
119+
ini_putl("vi", "height", 1080, REC_CONF);
120+
ini_putl("vi", "fps", 50, REC_CONF);
121+
break;
117122
case VR_1080P50:
118123
ini_putl("vi", "width", 1920, REC_CONF);
119124
ini_putl("vi", "height", 1080, REC_CONF);
@@ -167,7 +172,7 @@ static void dvr_update_record_conf() {
167172

168173
if (g_source_info.source == SOURCE_HDZERO) {
169174
LOGI("CAM_MODE=%d", CAM_MODE);
170-
if (CAM_MODE == VR_1080P30) {
175+
if (CAM_MODE == VR_1080P30 || CAM_MODE == VR_1080P24) {
171176
ini_putl("venc", "width", 1920, REC_CONF);
172177
ini_putl("venc", "height", 1080, REC_CONF);
173178
} else {
@@ -179,6 +184,10 @@ static void dvr_update_record_conf() {
179184
ini_putl("venc", "fps", 60, REC_CONF);
180185
ini_putl("venc", "kbps", 34000, REC_CONF);
181186
ini_putl("venc", "h265", 0, REC_CONF);
187+
} else if (CAM_MODE == VR_1080P24) {
188+
ini_putl("venc", "fps", 50, REC_CONF);
189+
ini_putl("venc", "kbps", 34000, REC_CONF);
190+
ini_putl("venc", "h265", 0, REC_CONF);
182191
} else if (CAM_MODE == VR_540P90 || CAM_MODE == VR_540P90_CROP) { // 90fps
183192
ini_putl("venc", "fps", 90, REC_CONF);
184193
ini_putl("venc", "kbps", 34000, REC_CONF);

src/core/msp_displayport.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void recive_one_frame(uint8_t *uart_buf, uint8_t uart_buf_len) {
180180
break;
181181

182182
} // switch(rx_state)
183-
} // while(RS_ready1())
183+
} // while(RS_ready1())
184184
}
185185

186186
void parser_rx(uint8_t function, uint8_t index, uint8_t *rx_buf) {
@@ -235,12 +235,21 @@ void camTypeDetect(uint8_t rData) {
235235
last_cam = cur_cam;
236236
cur_cam = VR_1080P30;
237237
break;
238+
239+
case 0xBB:
240+
last_cam = cur_cam;
241+
cur_cam = VR_1080P24;
242+
break;
238243
}
244+
239245
if (cur_cam == last_cam)
240246
CAM_MODE = cur_cam;
241247
else if (cur_cam == VR_1080P30 || last_cam == VR_1080P30) {
242248
// LOGI("Cam_mode changed:%d", cur_cam);
243249
load_fc_osd_font(cur_cam == VR_1080P30);
250+
} else if (cur_cam == VR_1080P24 || last_cam == VR_1080P24) {
251+
// LOGI("Cam_mode changed:%d", cur_cam);
252+
load_fc_osd_font(cur_cam == VR_1080P24);
244253
}
245254
}
246255

@@ -256,7 +265,7 @@ void fcTypeDetect(uint8_t *rData) {
256265
fc_variant[i] = fc_variant_rcv[i];
257266

258267
// LOGI("fc_variant changed:%s", fc_variant_rcv);
259-
load_fc_osd_font(cur_cam == VR_1080P30);
268+
load_fc_osd_font(cur_cam == VR_1080P30 || cur_cam == VR_1080P24);
260269
}
261270
}
262271

src/core/msp_displayport.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ typedef enum {
2626

2727
typedef enum {
2828
VR_720P50 = 0,
29-
VR_720P60 = 1,
30-
VR_720P30 = 2,
31-
VR_540P90 = 3,
32-
VR_540P60 = 4,
33-
VR_960x720P60 = 5,
34-
VR_540P90_CROP = 6,
35-
VR_1080P30 = 7,
36-
VR_1080P50 = 8,
37-
VR_1080P60 = 9,
29+
VR_720P60,
30+
VR_720P30,
31+
VR_540P90,
32+
VR_540P60,
33+
VR_960x720P60,
34+
VR_540P90_CROP,
35+
VR_1080P30,
36+
VR_1080P24,
37+
//
38+
VR_1080P50,
39+
VR_1080P60,
3840
} video_resolution_t;
3941

4042
typedef enum {

src/driver/hardware.c

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ uint32_t pclk_phase_default[2][VIDEO_SOURCE_NUM] = {
8282
},
8383
{
8484
// GOGGLE_VER_2
85-
0x00000001,
85+
0x00000004,
8686
0x00000004, // VIDEO_SOURCE_MENU_UI
87-
0x00000000, // VIDEO_SOURCE_HDZERO_IN_720P60_50
88-
0x00000000, // VIDEO_SOURCE_HDZERO_IN_720P90
89-
0x00000000, // VIDEO_SOURCE_HDZERO_IN_1080P30
90-
0x00000000, // VIDEO_SOURCE_AV_IN
91-
0x00000000, // VIDEO_SOURCE_HDMI_IN_1080P50
92-
0x00000000, // VIDEO_SOURCE_HDMI_IN_1080P60
93-
0x00000000, // VIDEO_SOURCE_HDMI_IN_1080POTHER
94-
0x00000000, // VIDEO_SOURCE_HDMI_IN_720P50
95-
0x00000000, // VIDEO_SOURCE_HDMI_IN_720P60
96-
0x00000000, // VIDEO_SOURCE_HDMI_IN_720P100
97-
0x00000000, // VIDEO_SOURCE_TP2825_EX, DO NOT USE
87+
0x00000004, // VIDEO_SOURCE_HDZERO_IN_720P60_50
88+
0x00000004, // VIDEO_SOURCE_HDZERO_IN_720P90
89+
0x00000004, // VIDEO_SOURCE_HDZERO_IN_1080P30
90+
0x00000004, // VIDEO_SOURCE_AV_IN
91+
0x00000004, // VIDEO_SOURCE_HDMI_IN_1080P50
92+
0x00000004, // VIDEO_SOURCE_HDMI_IN_1080P60
93+
0x00000004, // VIDEO_SOURCE_HDMI_IN_1080POTHER
94+
0x00000004, // VIDEO_SOURCE_HDMI_IN_720P50
95+
0x00000004, // VIDEO_SOURCE_HDMI_IN_720P60
96+
0x00000004, // VIDEO_SOURCE_HDMI_IN_720P100
97+
0x00000004, // VIDEO_SOURCE_TP2825_EX, DO NOT USE
9898
},
9999
};
100100

@@ -531,13 +531,21 @@ void csic_pclk_invert_set(uint8_t is_invert) {
531531
void pclk_phase_set(video_source_t source) {
532532
LOGI("pclk_phase_set %d", pclk_phase[source]);
533533
// bit[0] hdmi in
534-
IT66021_Set_Pclk((pclk_phase[source] >> 0) & 1);
534+
if (source == VIDEO_SOURCE_HDMI_IN_1080P50 || source == VIDEO_SOURCE_HDMI_IN_1080P60 || source == VIDEO_SOURCE_HDMI_IN_1080POTHER) {
535+
IT66021_Set_Pclk((pclk_phase[source] >> 0) & 1, 1);
536+
} else {
537+
IT66021_Set_Pclk((pclk_phase[source] >> 0) & 1, 2);
538+
}
535539

536540
// bit[1] analog in
537541
TP2825_Set_Pclk((pclk_phase[source] >> 1) & 1);
538542

539543
// bit[2] osd
540-
vdpo_sync_ctrl_set((pclk_phase[source] >> 2) & 1, 0, 0);
544+
if (source == VIDEO_SOURCE_AV_IN) {
545+
vdpo_sync_ctrl_set((pclk_phase[source] >> 2) & 1, 1, 0);
546+
} else {
547+
vdpo_sync_ctrl_set((pclk_phase[source] >> 2) & 1, 0, 0);
548+
}
541549

542550
// bit[3] dvr
543551
csic_pclk_invert_set((pclk_phase[source] >> 3) & 1);
@@ -706,6 +714,37 @@ void Display_1080P30_t(int mode) {
706714
system_exec("aww 0x06542018 0x00000044"); // disable horizontal chroma FIR filter.
707715
}
708716

717+
void Display_1080P24_t(int mode) {
718+
OLED_display(0);
719+
I2C_Write(ADDR_FPGA, 0x8C, 0x00);
720+
721+
system_exec("dispw -s vdpo 1080p60");
722+
g_hw_stat.vdpo_tmg = VDPO_TMG_1080P60;
723+
vclk_phase_set(VIDEO_SOURCE_HDZERO_IN_1080P30, 0);
724+
pclk_phase_set(VIDEO_SOURCE_HDZERO_IN_1080P30);
725+
726+
I2C_Write(ADDR_FPGA, 0x80, 0x84);
727+
// I2C_Write(ADDR_FPGA, 0x84, 0x00); // close OSD
728+
729+
DM5680_SetFPS(mode);
730+
MFPGA_Set1080P30();
731+
732+
if (GOGGLE_VER_2 == 0)
733+
OLED_SetTMG(2);
734+
else
735+
OLED_SetTMG(0);
736+
737+
if (GOGGLE_VER_2)
738+
I2C_Write(ADDR_FPGA, 0xa7, 0x00);
739+
740+
I2C_Write(ADDR_FPGA, 0x8C, 0x01);
741+
742+
g_hw_stat.source_mode = SOURCE_MODE_HDZERO;
743+
Display_VO_SWITCH(1);
744+
OLED_display(1);
745+
system_exec("aww 0x06542018 0x00000044"); // disable horizontal chroma FIR filter.
746+
}
747+
709748
void Display_720P60_50(int mode, uint8_t is_43) {
710749
pthread_mutex_lock(&hardware_mutex);
711750
Display_720P60_50_t(mode, is_43);
@@ -718,6 +757,12 @@ void Display_720P90(int mode) {
718757
pthread_mutex_unlock(&hardware_mutex);
719758
}
720759

760+
void Display_1080P24(int mode) {
761+
pthread_mutex_lock(&hardware_mutex);
762+
Display_1080P24_t(mode);
763+
pthread_mutex_unlock(&hardware_mutex);
764+
}
765+
721766
void Display_1080P30(int mode) {
722767
pthread_mutex_lock(&hardware_mutex);
723768
Display_1080P30_t(mode);
@@ -777,16 +822,18 @@ int HDZERO_detect() // return = 1: vtmg to V536 changed
777822
break;
778823
case VR_1080P30:
779824
Display_1080P30_t(CAM_MODE);
780-
825+
break;
826+
case VR_1080P24:
827+
Display_1080P24_t(CAM_MODE);
781828
break;
782829
default:
783830
LOGW("cam_mode =%d not suppored!!\n ", CAM_MODE);
784831
break;
785832
}
786833

787-
if (CAM_MODE == VR_1080P30)
834+
if (CAM_MODE == VR_1080P30 || CAM_MODE == VR_1080P24)
788835
fhd_req = 1;
789-
else if (cam_mode_last == VR_1080P30)
836+
else if (cam_mode_last == VR_1080P30 || cam_mode_last == VR_1080P24)
790837
fhd_req = -1;
791838
dvr_update_vi_conf(CAM_MODE);
792839
system_script(REC_STOP_LIVE);
@@ -820,6 +867,7 @@ void AV_Mode_Switch_fpga(int is_pal) {
820867
}
821868
I2C_Write(ADDR_FPGA, 0x06, 0x0F);
822869
system_exec("aww 0x06542018 0x00000044"); // disable horizontal chroma FIR filter.
870+
vdpo_sync_ctrl_set((pclk_phase[VIDEO_SOURCE_AV_IN] >> 2) & 1, 1, 0);
823871
}
824872

825873
void AV_Mode_Switch(int is_pal) {
@@ -932,8 +980,9 @@ int AV_in_detect() // return = 1: vtmg to V536 changed
932980
g_hw_stat.av_pal_w = g_hw_stat.av_pal_w ? 0 : 1;
933981

934982
TP2825_Switch_Mode(g_hw_stat.av_pal_w);
935-
if (GOGGLE_VER_2)
983+
if (GOGGLE_VER_2) {
936984
AV_Mode_Switch(g_hw_stat.av_pal_w);
985+
}
937986
// LOGI("Switch mode:%d", g_hw_stat.av_pal_w);
938987

939988
if (g_hw_stat.av_pal_w)

0 commit comments

Comments
 (0)