Skip to content
28 changes: 0 additions & 28 deletions src/core/app_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
13 changes: 0 additions & 13 deletions src/core/ht.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/driver/hardware-boxpro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 >= (180 >> g_setting.osd.orbit)) {
TP2825_orbit(g_setting.osd.orbit);
orbit_cnt = 0;
} else {
orbit_cnt++;
}
}
}
}

Expand Down
86 changes: 72 additions & 14 deletions src/driver/tp2825-boxpro.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,62 @@
#include <stdlib.h>
#include <unistd.h>

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, 0x0A, orbit_x);
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);
I2C_Write(ADDR_TP2825, 0x08, orbit_y + 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, 0x0A, orbit_x + 1);
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");
Expand All @@ -33,24 +89,25 @@ void TP2825_init(bool is_av_in, 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);
}
orbit_move = 0;

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, 0x2C, 0x28); // horizontal sharpness
I2C_Write(ADDR_TP2825, 0x13, 0x80); // hue
I2C_Write(ADDR_TP2825, 0x14, 0x80); // saturation
I2C_Write(ADDR_TP2825, 0x17, 0x31); // vertical sharpness

I2C_Write(ADDR_TP2825, 0x25, 0x28);

Expand All @@ -62,19 +119,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) {
Expand Down
1 change: 1 addition & 0 deletions src/driver/tp2825.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {

#include "ui/page_common.h"

void TP2825_orbit(int orbit_setting);
void TP2825_close();
void TP2825_open();

Expand Down
Loading