From 66462f0f0bdf7870101cfe7f2436550dce819676 Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Sun, 1 Feb 2026 02:14:11 +0000 Subject: [PATCH 1/6] Fix analog ghosting --- src/driver/hardware-boxpro.c | 2 +- src/driver/tp2825-boxpro.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/driver/hardware-boxpro.c b/src/driver/hardware-boxpro.c index 5bc6e322..32b58af3 100644 --- a/src/driver/hardware-boxpro.c +++ b/src/driver/hardware-boxpro.c @@ -988,7 +988,7 @@ void Set_Brightness(uint8_t bri) { } void Set_Contrast(uint8_t con) { - int8_t val = con << 2; + int8_t val = con * 255 / 48; I2C_Write(ADDR_FPGA, 0x86, val); } diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index a30d6883..67854333 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -45,14 +45,18 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x10); - I2C_Write(ADDR_TP2825, 0x11, 0x48); - // I2C_Write(ADDR_TP2825, 0x12, 0x51); - // I2C_Write(ADDR_TP2825, 0x13, 0x80); - // I2C_Write(ADDR_TP2825, 0x14, 0x80); + I2C_Write(ADDR_TP2825, 0x10, 0x10); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x3A); // contrast + // I2C_Write(ADDR_TP2825, 0x12, 0x51); // sharpness? bit 3-0 strength + I2C_Write(ADDR_TP2825, 0x13, 0x50); // hue + // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation // I2C_Write(ADDR_TP2825, 0x15, 0x00); + // I2C_Write(ADDR_TP2825, 0x17, 0x00); // sharpness? bit 3-0 strength + // I2C_Write(ADDR_TP2825, 0x19, 0x00); // black blamp bit 7: pedestal En + // 6-4: clamp filter/speed + // 3-0: calibration/offset - I2C_Write(ADDR_TP2825, 0x25, 0x28); + I2C_Write(ADDR_TP2825, 0x25, 0x60); // AGC/Peak white clamping I2C_Write(ADDR_TP2825, 0x06, 0x80); From c9c4598e91905acfa5b06e2a87f3832084787b9b Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Sun, 1 Feb 2026 05:46:08 +0000 Subject: [PATCH 2/6] Fine-tune brightness/contrast. Undo 7/14 limit --- src/core/app_state.c | 28 ---------------------------- src/core/ht.c | 13 ------------- src/driver/tp2825-boxpro.c | 4 ++-- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/core/app_state.c b/src/core/app_state.c index 4ec869af..d88a99f2 100644 --- a/src/core/app_state.c +++ b/src/core/app_state.c @@ -63,12 +63,6 @@ void app_switch_to_menu() { rtc6715.init(0, 0); system_script(REC_STOP_LIVE); - -#ifdef HDZBOXPRO - // Restore image settings from av module - screen.brightness(g_setting.image.oled); - Set_Contrast(g_setting.image.contrast); -#endif } void app_exit_menu() { @@ -100,11 +94,6 @@ void app_switch_to_analog(bool is_av_in) { if (is_av_in) { rtc6715.init(0, 0); } else { -#if defined HDZBOXPRO - // Solve LCD residual image - screen.brightness(7); - Set_Contrast(14); -#endif rtc6715.init(1, g_setting.record.audio_source == SETTING_RECORD_AUDIO_SOURCE_AV_IN); rtc6715.set_ch(g_setting.source.analog_channel - 1); } @@ -124,12 +113,6 @@ void app_switch_to_hdmi_in() { #if defined HDZGOGGLE2 system_exec("aww 0x0300b084 0x0001555"); #endif - -#if defined HDZBOXPRO - // Restore image settings from av module - screen.brightness(g_setting.image.oled); - Set_Contrast(g_setting.image.contrast); -#endif rtc6715.init(0, 0); Source_HDMI_in(); @@ -170,11 +153,6 @@ void app_switch_to_hdzero(bool is_default) { system_exec("aww 0x0300b084 0x0001555"); #endif -#if defined HDZBOXPRO - // Restore image settings from av module - screen.brightness(g_setting.image.oled); - Set_Contrast(g_setting.image.contrast); -#endif rtc6715.init(0, 0); if (is_default) { @@ -247,12 +225,6 @@ void app_switch_to_hdzero(bool is_default) { void hdzero_switch_channel(int channel) { channel &= 0x7f; -#if defined HDZBOXPRO - // Restore image settings from av module - screen.brightness(g_setting.image.oled); - Set_Contrast(g_setting.image.contrast); -#endif - LOGI("hdzero_switch_channel to bw:%d, band:%d, ch:%d, CAM_MODE=%d 4:3=%d", g_setting.source.hdzero_bw, g_setting.source.hdzero_band, channel, CAM_MODE, cam_4_3); DM6302_SetChannel(g_setting.source.hdzero_band, channel); DM5680_clear_vldflg(); diff --git a/src/core/ht.c b/src/core/ht.c index 55a0dd27..9cb27e4f 100644 --- a/src/core/ht.c +++ b/src/core/ht.c @@ -96,15 +96,7 @@ static void detect_motion(bool is_moving) { #endif if (is_moving) { // we got motion, turn oled back on, start over -#if defined(HDZGOGGLE) || defined(HDZGOGGLE2) screen.brightness(g_setting.image.oled); -#elif defined(HDZBOXPRO) - if (g_source_info.source == SOURCE_AV_MODULE) { - screen.brightness(7); - } else { - screen.brightness(g_setting.image.oled); - } -#endif state = OLED_MD_DETECTING; cnt = 0; } @@ -153,11 +145,6 @@ static void detect_motion(bool is_moving) { LOGI("OLED ON from protection."); screen.brightness(g_setting.image.oled); -#ifdef HDZBOXPRO - if (g_source_info.source == SOURCE_AV_MODULE) { - screen.brightness(7); - } -#endif hw_screen_on(1); state = OLED_MD_DETECTING; diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index 67854333..aa1e7012 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -45,8 +45,8 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x10); // brightness - I2C_Write(ADDR_TP2825, 0x11, 0x3A); // contrast + I2C_Write(ADDR_TP2825, 0x10, 0x0D); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x39); // contrast // I2C_Write(ADDR_TP2825, 0x12, 0x51); // sharpness? bit 3-0 strength I2C_Write(ADDR_TP2825, 0x13, 0x50); // hue // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation From 4c639cabe8ab897a5bbaff5136fc8f792e848f87 Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Mon, 2 Feb 2026 02:30:10 +0000 Subject: [PATCH 3/6] Fine-tune TP2825 output --- src/driver/tp2825-boxpro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index aa1e7012..ca22dc81 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -45,8 +45,8 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x0D); // brightness - I2C_Write(ADDR_TP2825, 0x11, 0x39); // contrast + I2C_Write(ADDR_TP2825, 0x10, 0x12); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x34); // contrast // I2C_Write(ADDR_TP2825, 0x12, 0x51); // sharpness? bit 3-0 strength I2C_Write(ADDR_TP2825, 0x13, 0x50); // hue // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation From e485d0726f7b43cc822dac8fdfa6f238ef8c39a1 Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Fri, 20 Feb 2026 06:12:29 +0000 Subject: [PATCH 4/6] Force AGC params --- src/driver/tp2825-boxpro.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index ca22dc81..86a5f6ca 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -45,10 +45,11 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x12); // brightness - I2C_Write(ADDR_TP2825, 0x11, 0x34); // contrast - // I2C_Write(ADDR_TP2825, 0x12, 0x51); // sharpness? bit 3-0 strength - I2C_Write(ADDR_TP2825, 0x13, 0x50); // hue + I2C_Write(ADDR_TP2825, 0x10, 0x04); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x32); // contrast + I2C_Write(ADDR_TP2825, 0x13, 0x48); // hue + I2C_Write(ADDR_TP2825, 0x14, 0x70); // saturation + I2C_Write(ADDR_TP2825, 0x2C, 0x38); // output sharpness // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation // I2C_Write(ADDR_TP2825, 0x15, 0x00); // I2C_Write(ADDR_TP2825, 0x17, 0x00); // sharpness? bit 3-0 strength @@ -56,7 +57,13 @@ void TP2825_init(bool is_av_in, bool is_pal) { // 6-4: clamp filter/speed // 3-0: calibration/offset - I2C_Write(ADDR_TP2825, 0x25, 0x60); // AGC/Peak white clamping + // AGC params + I2C_Write(ADDR_TP2825, 0x21, 0xFF); // + I2C_Write(ADDR_TP2825, 0x22, 0xFF); // + I2C_Write(ADDR_TP2825, 0x23, 0xFF); // + I2C_Write(ADDR_TP2825, 0x24, 0x80); // Black level + I2C_Write(ADDR_TP2825, 0x27, 0x17); // White level + I2C_Write(ADDR_TP2825, 0x25, 0x28); // AGC gain I2C_Write(ADDR_TP2825, 0x06, 0x80); From c70e5e5eeb67332c3fd3cc89f7e46ff94ce5e98d Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Sat, 28 Feb 2026 17:39:16 +0000 Subject: [PATCH 5/6] Fix brightened image on weak signal --- src/driver/hardware-boxpro.c | 2 +- src/driver/tp2825-boxpro.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/driver/hardware-boxpro.c b/src/driver/hardware-boxpro.c index 32b58af3..5bc6e322 100644 --- a/src/driver/hardware-boxpro.c +++ b/src/driver/hardware-boxpro.c @@ -988,7 +988,7 @@ void Set_Brightness(uint8_t bri) { } void Set_Contrast(uint8_t con) { - int8_t val = con * 255 / 48; + int8_t val = con << 2; I2C_Write(ADDR_FPGA, 0x86, val); } diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index 86a5f6ca..3c266d6f 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -45,25 +45,26 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x04); // brightness - I2C_Write(ADDR_TP2825, 0x11, 0x32); // contrast + I2C_Write(ADDR_TP2825, 0x10, 0x00); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x3C); // contrast + I2C_Write(ADDR_TP2825, 0x12, 0x10); I2C_Write(ADDR_TP2825, 0x13, 0x48); // hue I2C_Write(ADDR_TP2825, 0x14, 0x70); // saturation + I2C_Write(ADDR_TP2825, 0x17, 0x30); // analog sharpness I2C_Write(ADDR_TP2825, 0x2C, 0x38); // output sharpness + I2C_Write(ADDR_TP2825, 0x1a, 0x3C); // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation // I2C_Write(ADDR_TP2825, 0x15, 0x00); - // I2C_Write(ADDR_TP2825, 0x17, 0x00); // sharpness? bit 3-0 strength - // I2C_Write(ADDR_TP2825, 0x19, 0x00); // black blamp bit 7: pedestal En + // I2C_Write(ADDR_TP2825, 0x19, 0x00); // black clamp bit 7: pedestal En // 6-4: clamp filter/speed // 3-0: calibration/offset // AGC params I2C_Write(ADDR_TP2825, 0x21, 0xFF); // I2C_Write(ADDR_TP2825, 0x22, 0xFF); // - I2C_Write(ADDR_TP2825, 0x23, 0xFF); // - I2C_Write(ADDR_TP2825, 0x24, 0x80); // Black level - I2C_Write(ADDR_TP2825, 0x27, 0x17); // White level - I2C_Write(ADDR_TP2825, 0x25, 0x28); // AGC gain + I2C_Write(ADDR_TP2825, 0x23, 0x58); // + I2C_Write(ADDR_TP2825, 0x27, 0x14); // White level + I2C_Write(ADDR_TP2825, 0x25, 0x18); // AGC gain I2C_Write(ADDR_TP2825, 0x06, 0x80); From 2dd5d5709101546be11f4d2fadb94dd6e14c565b Mon Sep 17 00:00:00 2001 From: RaceMiata Date: Tue, 10 Mar 2026 07:37:58 +0000 Subject: [PATCH 6/6] Implement analog frame orbit --- src/driver/hardware-boxpro.c | 10 +++++ src/driver/tp2825-boxpro.c | 84 +++++++++++++++++++++++++++--------- src/driver/tp2825.h | 1 + 3 files changed, 74 insertions(+), 21 deletions(-) diff --git a/src/driver/hardware-boxpro.c b/src/driver/hardware-boxpro.c index 5bc6e322..6d1785a0 100644 --- a/src/driver/hardware-boxpro.c +++ b/src/driver/hardware-boxpro.c @@ -725,6 +725,7 @@ int AV_in_detect() // return = 1: vtmg to V536 changed { static int det_last = -1; static int det_cnt = 0, det2_cnt = 0; + static int orbit_cnt = 0; int rdat, det; int ret = 0; @@ -823,6 +824,15 @@ int AV_in_detect() // return = 1: vtmg to V536 changed det2_cnt = 0; break; } + + if (g_hw_stat.av_valid[g_hw_stat.is_av_in] == 2 && g_setting.osd.orbit > 0) { + if (orbit_cnt >= 100) { + TP2825_orbit(g_setting.osd.orbit); + orbit_cnt = 0; + } else { + orbit_cnt++; + } + } } } diff --git a/src/driver/tp2825-boxpro.c b/src/driver/tp2825-boxpro.c index 3c266d6f..16501928 100644 --- a/src/driver/tp2825-boxpro.c +++ b/src/driver/tp2825-boxpro.c @@ -11,6 +11,59 @@ #include #include +uint8_t orbit_x = 0, orbit_y = 0; +uint8_t orbit_move = 0; + +void TP2825_orbit(int orbit_setting) { + static int orbit_level = 0; + + if (orbit_setting > 0 && orbit_x > 0 && orbit_y > 0) { + + if (orbit_level != orbit_setting) { + orbit_level = orbit_setting; + orbit_move = 0; + } + + switch (orbit_move) { + case 0: + I2C_Write(ADDR_TP2825, 0x0A, orbit_x); + I2C_Write(ADDR_TP2825, 0x08, orbit_y); + orbit_move = 1; + break; + case 1: + if (orbit_level > 1) { + I2C_Write(ADDR_TP2825, 0x0A, orbit_x - 1); + I2C_Write(ADDR_TP2825, 0x08, orbit_y + 1); + } else { + I2C_Write(ADDR_TP2825, 0x08, orbit_y + 1); + } + orbit_move = 2; + break; + case 2: + if (orbit_level > 1) { + I2C_Write(ADDR_TP2825, 0x0A, orbit_x - 2); + I2C_Write(ADDR_TP2825, 0x08, orbit_y); + } else { + I2C_Write(ADDR_TP2825, 0x0A, orbit_x - 1); + } + orbit_move = 3; + break; + case 3: + if (orbit_level > 1) { + I2C_Write(ADDR_TP2825, 0x0A, orbit_x - 1); + I2C_Write(ADDR_TP2825, 0x08, orbit_y - 1); + } else { + I2C_Write(ADDR_TP2825, 0x08, orbit_y); + } + orbit_move = 0; + break; + default: + orbit_move = 0; + break; + } + } +} + void TP2825_close() { gpio_set(GPIO_TP2825_RSTB, 0); LOGI("TP2825 close"); @@ -45,26 +98,14 @@ void TP2825_init(bool is_av_in, bool is_pal) { I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } - I2C_Write(ADDR_TP2825, 0x10, 0x00); // brightness - I2C_Write(ADDR_TP2825, 0x11, 0x3C); // contrast - I2C_Write(ADDR_TP2825, 0x12, 0x10); + I2C_Write(ADDR_TP2825, 0x10, 0x10); // brightness + I2C_Write(ADDR_TP2825, 0x11, 0x48); // contrast + I2C_Write(ADDR_TP2825, 0x12, 0x58); // sharpness I2C_Write(ADDR_TP2825, 0x13, 0x48); // hue I2C_Write(ADDR_TP2825, 0x14, 0x70); // saturation I2C_Write(ADDR_TP2825, 0x17, 0x30); // analog sharpness - I2C_Write(ADDR_TP2825, 0x2C, 0x38); // output sharpness - I2C_Write(ADDR_TP2825, 0x1a, 0x3C); - // I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation - // I2C_Write(ADDR_TP2825, 0x15, 0x00); - // I2C_Write(ADDR_TP2825, 0x19, 0x00); // black clamp bit 7: pedestal En - // 6-4: clamp filter/speed - // 3-0: calibration/offset - - // AGC params - I2C_Write(ADDR_TP2825, 0x21, 0xFF); // - I2C_Write(ADDR_TP2825, 0x22, 0xFF); // - I2C_Write(ADDR_TP2825, 0x23, 0x58); // - I2C_Write(ADDR_TP2825, 0x27, 0x14); // White level - I2C_Write(ADDR_TP2825, 0x25, 0x18); // AGC gain + + I2C_Write(ADDR_TP2825, 0x25, 0x28); I2C_Write(ADDR_TP2825, 0x06, 0x80); @@ -74,19 +115,20 @@ void TP2825_init(bool is_av_in, bool is_pal) { void TP2825_Switch_Mode(bool is_pal) { if (is_pal) { I2C_Write(ADDR_TP2825, 0x07, 0x12); - I2C_Write(ADDR_TP2825, 0x08, 0x18); + I2C_Write(ADDR_TP2825, 0x08, orbit_y = 0x18); I2C_Write(ADDR_TP2825, 0x09, 0x20); - I2C_Write(ADDR_TP2825, 0x0A, 0x10); + I2C_Write(ADDR_TP2825, 0x0A, orbit_x = 0x10); I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } else { I2C_Write(ADDR_TP2825, 0x07, 0x02); - I2C_Write(ADDR_TP2825, 0x08, 0x12); + I2C_Write(ADDR_TP2825, 0x08, orbit_y = 0x12); I2C_Write(ADDR_TP2825, 0x09, 0xF0); - I2C_Write(ADDR_TP2825, 0x0A, 0x10); + I2C_Write(ADDR_TP2825, 0x0A, orbit_x = 0x10); I2C_Write(ADDR_TP2825, 0x0B, 0xD0); } I2C_Write(ADDR_TP2825, 0x06, 0x80); + orbit_move = 0; } void TP2825_Switch_CH(bool is_av_in) { diff --git a/src/driver/tp2825.h b/src/driver/tp2825.h index ac575d3a..66c7162b 100644 --- a/src/driver/tp2825.h +++ b/src/driver/tp2825.h @@ -8,6 +8,7 @@ extern "C" { #include "ui/page_common.h" +void TP2825_orbit(int orbit_setting); void TP2825_close(); void TP2825_open();