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/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 a30d6883..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,12 +98,12 @@ 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, 0x15, 0x00); + 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, 0x25, 0x28); @@ -62,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();