From 311b02828095db5fbbc279a35d3a86cec432586f Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:12:18 +0800 Subject: [PATCH 01/11] add tp9950 driver --- src/camera.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ src/hardware.c | 29 ++++++++++++++++ src/hardware.h | 1 + src/i2c_device.h | 2 +- 4 files changed, 119 insertions(+), 1 deletion(-) diff --git a/src/camera.c b/src/camera.c index 16199bef..7e03b137 100644 --- a/src/camera.c +++ b/src/camera.c @@ -1,4 +1,5 @@ #include "camera.h" +#include "common.h" #include "dm6300.h" #include "global.h" #include "hardware.h" @@ -54,6 +55,92 @@ void camera_ratio_detect(void) { camRatio = 0; } +#ifdef USE_TP9950 +void camera_mode_detect(uint8_t init) { + + uint32_t frame = 0; + uint32_t agc_en = 0; + uint8_t id = 0; + + TC3587_RSTB = 0; + WAIT(100); + TC3587_RSTB = 1; + WAIT(100); + + Set_720P60_8bit(0); + + debugf("\r\nchipID"); + id = I2C_Read8(ADDR_TP9950, 0xfe); + debugf("\r\n fe:%2x", id); + id = I2C_Read8(ADDR_TP9950, 0xff); + debugf("\r\n ff:%2x\r\n", id); + WAIT(200); + + debugf("\r\nCamDetect"); + I2C_Write8(ADDR_TP9950, 0x26, 0x01); + I2C_Write8(ADDR_TP9950, 0x07, 0xC0); + I2C_Write8(ADDR_TP9950, 0x0B, 0xC0); + I2C_Write8(ADDR_TP9950, 0x22, 0x35); + agc_en = I2C_Read8(ADDR_TP9950, 0x06); + agc_en &= 0xFB; + I2C_Write8(ADDR_TP9950, 0x06, agc_en); + + while (1) { + I2C_Write8(ADDR_TP9950, 0x02, 0xca); + I2C_Write8(ADDR_TP9950, 0x0b, 0xc0); + I2C_Write8(ADDR_TP9950, 0x0c, 0x03); + I2C_Write8(ADDR_TP9950, 0x0d, 0x50); + I2C_Write8(ADDR_TP9950, 0x15, 0x13); + I2C_Write8(ADDR_TP9950, 0x16, 0x16); + I2C_Write8(ADDR_TP9950, 0x17, 0x00); + I2C_Write8(ADDR_TP9950, 0x18, 0x19); + I2C_Write8(ADDR_TP9950, 0x19, 0xD0); + I2C_Write8(ADDR_TP9950, 0x1a, 0x25); + I2C_Write8(ADDR_TP9950, 0x20, 0x30); + I2C_Write8(ADDR_TP9950, 0x21, 0x84); + I2C_Write8(ADDR_TP9950, 0x22, 0x36); + I2C_Write8(ADDR_TP9950, 0x23, 0x3c); + I2C_Write8(ADDR_TP9950, 0x26, 0x05); + I2C_Write8(ADDR_TP9950, 0x2b, 0x60); + I2C_Write8(ADDR_TP9950, 0x2c, 0x0a); + I2C_Write8(ADDR_TP9950, 0x2d, 0x30); + I2C_Write8(ADDR_TP9950, 0x2e, 0x70); + I2C_Write8(ADDR_TP9950, 0x30, 0x48); + I2C_Write8(ADDR_TP9950, 0x31, 0xbb); + I2C_Write8(ADDR_TP9950, 0x32, 0x2e); + I2C_Write8(ADDR_TP9950, 0x33, 0x90); + I2C_Write8(ADDR_TP9950, 0x39, 0x1c); + I2C_Write8(ADDR_TP9950, 0x3B, 0x26); + I2C_Write8(ADDR_TP9950, 0x18, 0x19); + I2C_Write8(ADDR_TP9950, 0x40, 0x08); + I2C_Write8(ADDR_TP9950, 0x13, 0x04); + I2C_Write8(ADDR_TP9950, 0x14, 0x04); + I2C_Write8(ADDR_TP9950, 0x40, 0x00); + I2C_Write8(ADDR_TP9950, 0x35, 0x05); + I2C_Write8(ADDR_TP9950, 0xfa, 0x08); + I2C_Write8(ADDR_TP9950, 0x4C, 0x40); + I2C_Write8(ADDR_TP9950, 0x4e, 0x05); + + I2C_Write8(ADDR_TP9950, 0x1c, 0x06); + I2C_Write8(ADDR_TP9950, 0x1d, 0x72); + // **** soft reset **** // + I2C_Write8(ADDR_TP9950, 0x06, 0xb2); + + WAIT(CAM_DET_DLY); + frame = I2C_Read8(ADDR_TP9950, 0x01); + debugf("\r\n720P60 0x01 = %2x", (uint16_t)frame); + if (frame == 0x7E) { + video_format = VDO_FMT_720P60; + camera_type = CAMERA_TYPE_OUTDATED; + LED_BLUE_ON; + led_status = ON; + break; + } + } + RF_BW = BW_27M; + RF_BW_last = RF_BW; +} +#else void camera_mode_detect(uint8_t init) { uint8_t cycles = 4; uint8_t loss = 0; @@ -157,6 +244,7 @@ void camera_mode_detect(uint8_t init) { debugf("27M"); #endif } +#endif void camera_button_init() { WriteReg(0, 0x17, 0xC0); diff --git a/src/hardware.c b/src/hardware.c index 267d0823..c874c260 100644 --- a/src/hardware.c +++ b/src/hardware.c @@ -143,6 +143,26 @@ void Set_720P60(uint8_t page) { WriteReg(page, 0x06, 0x01); } +void Set_720P60_8bit(uint8_t page) { + WriteReg(page, 0x21, 0x1F); + + WriteReg(page, 0x40, 0x00); + WriteReg(page, 0x41, 0x2A); + WriteReg(page, 0x42, 0xD0); + WriteReg(page, 0x43, 0xE4); + WriteReg(page, 0x44, 0x4C); + WriteReg(page, 0x45, 0xEE); + WriteReg(page, 0x49, 0x04); + WriteReg(page, 0x4c, 0x19); + WriteReg(page, 0x4f, 0x86); + WriteReg(page, 0x52, 0x04); + WriteReg(page, 0x53, 0x00); + WriteReg(page, 0x54, 0x3C); + WriteReg(0, 0x8e, 0x04); + + WriteReg(page, 0x06, 0x01); +} + void Set_960x720P60(uint8_t page) { WriteReg(page, 0x21, 0x1C); @@ -491,7 +511,11 @@ void Init_HW() { SPI_Init(); LED_Init(); #ifdef VIDEO_PAT +#ifdef USE_TP9950 + Set_720P60_8bit(0); +#else Set_720P60(0); +#endif WriteReg(0, 0x50, 0x01); RF_FREQ = 0; GetVtxParameter(); @@ -1102,10 +1126,15 @@ void video_detect(void) { } cameraLost = (ReadReg(0, 0x02) >> 4) & 1; + if (camera_type == CAMERA_TYPE_OUTDATED) + return; if (sec == 3) { sec = 0; if (cameraLost) { // video loss +#ifdef _DEBUG_CAMERA + debugf("r\ncamera lost"); +#endif if (video_format == VDO_FMT_720P50) { Set_720P60(IS_RX); video_format = VDO_FMT_720P60; diff --git a/src/hardware.h b/src/hardware.h index 57500239..70c5e60b 100644 --- a/src/hardware.h +++ b/src/hardware.h @@ -89,6 +89,7 @@ void Set_960x720P60(uint8_t page); void Set_720P30(uint8_t page, uint8_t is_43); void Set_540P60(uint8_t page); void Set_1080P30(uint8_t page); +void Set_720P60_8bit(uint8_t page); void Flicker_LED(uint8_t n); void LED_Flip(); diff --git a/src/i2c_device.h b/src/i2c_device.h index c0bf67c9..571d02cb 100644 --- a/src/i2c_device.h +++ b/src/i2c_device.h @@ -6,7 +6,7 @@ #define ADDR_MAX7315 0x20 // Rev1 Rev3 #define ADDR_PCA9554 0x38 // Rev2 -#define ADDR_TP2825 0x44 +#define ADDR_TP9950 0x44 #define ADDR_TC3587 0x0E #define ADDR_EEPROM 0x50 #define ADDR_TEMPADC 0x48 From ca2cfd29c86be5e773aa65f883489aba729069ce Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:00:31 +0800 Subject: [PATCH 02/11] LED_BLUE_OFF if no ahd camera is detected --- src/camera.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/camera.c b/src/camera.c index 7e03b137..e0259e88 100644 --- a/src/camera.c +++ b/src/camera.c @@ -135,6 +135,9 @@ void camera_mode_detect(uint8_t init) { LED_BLUE_ON; led_status = ON; break; + } else { + LED_BLUE_OFF; + led_status = OFF; } } RF_BW = BW_27M; From 8108ef126ff5174fee4101fc223e1bc63aa39b98 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:28:01 +0800 Subject: [PATCH 03/11] Update common.h --- src/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common.h b/src/common.h index 1276cd8d..97ad578c 100644 --- a/src/common.h +++ b/src/common.h @@ -85,6 +85,8 @@ // #define _DEBUG_SPI // #define _DEBUG_TRAMP #endif +#define USE_TP9950 +#define USE_TEMPERATURE_SENSOR #define Raceband #define USE_EFUSE From f951128d0067b843be0d23a04004b79d8ac3361e Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:27:11 +0800 Subject: [PATCH 04/11] do not detect camera resolution --- src/camera.c | 100 +++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 55 deletions(-) diff --git a/src/camera.c b/src/camera.c index 16b45cdf..3502da06 100644 --- a/src/camera.c +++ b/src/camera.c @@ -90,61 +90,51 @@ void camera_mode_detect(uint8_t init) { agc_en &= 0xFB; I2C_Write8(ADDR_TP9950, 0x06, agc_en); - while (1) { - I2C_Write8(ADDR_TP9950, 0x02, 0xca); - I2C_Write8(ADDR_TP9950, 0x0b, 0xc0); - I2C_Write8(ADDR_TP9950, 0x0c, 0x03); - I2C_Write8(ADDR_TP9950, 0x0d, 0x50); - I2C_Write8(ADDR_TP9950, 0x15, 0x13); - I2C_Write8(ADDR_TP9950, 0x16, 0x16); - I2C_Write8(ADDR_TP9950, 0x17, 0x00); - I2C_Write8(ADDR_TP9950, 0x18, 0x19); - I2C_Write8(ADDR_TP9950, 0x19, 0xD0); - I2C_Write8(ADDR_TP9950, 0x1a, 0x25); - I2C_Write8(ADDR_TP9950, 0x20, 0x30); - I2C_Write8(ADDR_TP9950, 0x21, 0x84); - I2C_Write8(ADDR_TP9950, 0x22, 0x36); - I2C_Write8(ADDR_TP9950, 0x23, 0x3c); - I2C_Write8(ADDR_TP9950, 0x26, 0x05); - I2C_Write8(ADDR_TP9950, 0x2b, 0x60); - I2C_Write8(ADDR_TP9950, 0x2c, 0x0a); - I2C_Write8(ADDR_TP9950, 0x2d, 0x30); - I2C_Write8(ADDR_TP9950, 0x2e, 0x70); - I2C_Write8(ADDR_TP9950, 0x30, 0x48); - I2C_Write8(ADDR_TP9950, 0x31, 0xbb); - I2C_Write8(ADDR_TP9950, 0x32, 0x2e); - I2C_Write8(ADDR_TP9950, 0x33, 0x90); - I2C_Write8(ADDR_TP9950, 0x39, 0x1c); - I2C_Write8(ADDR_TP9950, 0x3B, 0x26); - I2C_Write8(ADDR_TP9950, 0x18, 0x19); - I2C_Write8(ADDR_TP9950, 0x40, 0x08); - I2C_Write8(ADDR_TP9950, 0x13, 0x04); - I2C_Write8(ADDR_TP9950, 0x14, 0x04); - I2C_Write8(ADDR_TP9950, 0x40, 0x00); - I2C_Write8(ADDR_TP9950, 0x35, 0x05); - I2C_Write8(ADDR_TP9950, 0xfa, 0x08); - I2C_Write8(ADDR_TP9950, 0x4C, 0x40); - I2C_Write8(ADDR_TP9950, 0x4e, 0x05); - - I2C_Write8(ADDR_TP9950, 0x1c, 0x06); - I2C_Write8(ADDR_TP9950, 0x1d, 0x72); - // **** soft reset **** // - I2C_Write8(ADDR_TP9950, 0x06, 0xb2); - - WAIT(CAM_DET_DLY); - frame = I2C_Read8(ADDR_TP9950, 0x01); - debugf("\r\n720P60 0x01 = %2x", (uint16_t)frame); - if (frame == 0x7E) { - video_format = VDO_FMT_720P60; - camera_type = CAMERA_TYPE_OUTDATED; - LED_BLUE_ON; - led_status = ON; - break; - } else { - LED_BLUE_OFF; - led_status = OFF; - } - } + I2C_Write8(ADDR_TP9950, 0x02, 0xca); + I2C_Write8(ADDR_TP9950, 0x0b, 0xc0); + I2C_Write8(ADDR_TP9950, 0x0c, 0x03); + I2C_Write8(ADDR_TP9950, 0x0d, 0x50); + I2C_Write8(ADDR_TP9950, 0x15, 0x13); + I2C_Write8(ADDR_TP9950, 0x16, 0x16); + I2C_Write8(ADDR_TP9950, 0x17, 0x00); + I2C_Write8(ADDR_TP9950, 0x18, 0x19); + I2C_Write8(ADDR_TP9950, 0x19, 0xD0); + I2C_Write8(ADDR_TP9950, 0x1a, 0x25); + I2C_Write8(ADDR_TP9950, 0x20, 0x30); + I2C_Write8(ADDR_TP9950, 0x21, 0x84); + I2C_Write8(ADDR_TP9950, 0x22, 0x36); + I2C_Write8(ADDR_TP9950, 0x23, 0x3c); + I2C_Write8(ADDR_TP9950, 0x26, 0x05); + I2C_Write8(ADDR_TP9950, 0x2b, 0x60); + I2C_Write8(ADDR_TP9950, 0x2c, 0x0a); + I2C_Write8(ADDR_TP9950, 0x2d, 0x30); + I2C_Write8(ADDR_TP9950, 0x2e, 0x70); + I2C_Write8(ADDR_TP9950, 0x30, 0x48); + I2C_Write8(ADDR_TP9950, 0x31, 0xbb); + I2C_Write8(ADDR_TP9950, 0x32, 0x2e); + I2C_Write8(ADDR_TP9950, 0x33, 0x90); + I2C_Write8(ADDR_TP9950, 0x39, 0x1c); + I2C_Write8(ADDR_TP9950, 0x3B, 0x26); + I2C_Write8(ADDR_TP9950, 0x18, 0x19); + I2C_Write8(ADDR_TP9950, 0x40, 0x08); + I2C_Write8(ADDR_TP9950, 0x13, 0x04); + I2C_Write8(ADDR_TP9950, 0x14, 0x04); + I2C_Write8(ADDR_TP9950, 0x40, 0x00); + I2C_Write8(ADDR_TP9950, 0x35, 0x05); + I2C_Write8(ADDR_TP9950, 0xfa, 0x08); + I2C_Write8(ADDR_TP9950, 0x4C, 0x40); + I2C_Write8(ADDR_TP9950, 0x4e, 0x05); + + I2C_Write8(ADDR_TP9950, 0x1c, 0x06); + I2C_Write8(ADDR_TP9950, 0x1d, 0x72); + // **** soft reset **** // + I2C_Write8(ADDR_TP9950, 0x06, 0xb2); + + video_format = VDO_FMT_720P60; + camera_type = CAMERA_TYPE_OUTDATED; + LED_BLUE_ON; + led_status = ON; + RF_BW = BW_27M; RF_BW_last = RF_BW; } From 793913ca9db4fa59f5f6b5eb9ee489d43e2fce7d Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Fri, 15 Dec 2023 09:18:21 +0800 Subject: [PATCH 05/11] add new vtx hdzero_pico --- platformio.ini | 1 + src/camera.c | 2 ++ src/common.h | 7 +++++-- targets/hdzero_pico.ini | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 targets/hdzero_pico.ini diff --git a/platformio.ini b/platformio.ini index 2bce6806..4a3a151f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,4 +20,5 @@ extra_configs = targets/foxeer_vtx.ini targets/hdzero_race_v3.ini targets/hdzero_freestyle_v2.ini + targets/hdzero_pico.ini \ No newline at end of file diff --git a/src/camera.c b/src/camera.c index 4f9d3c0d..d425b877 100644 --- a/src/camera.c +++ b/src/camera.c @@ -67,6 +67,8 @@ void camera_mode_detect(uint8_t init) { uint32_t agc_en = 0; uint8_t id = 0; + init = 0; + TC3587_RSTB = 0; WAIT(100); TC3587_RSTB = 1; diff --git a/src/common.h b/src/common.h index 97ad578c..e11da577 100644 --- a/src/common.h +++ b/src/common.h @@ -16,6 +16,7 @@ // #define FOXEER_VTX // #define HDZERO_RACE_V3 // #define HDZERO_FREESTYLE_V2 +// #define HDZERO_PICO /* define VTX ID start */ #if defined HDZERO_WHOOP @@ -34,6 +35,8 @@ #define VTX_ID 0x5a #elif defined HDZERO_FREESTYLE_V2 #define VTX_ID 0x5b +#elif defined HDZERO_PICO +#define VTX_ID 0x5c #else #define VTX_ID 0x00 #endif @@ -55,6 +58,8 @@ #define VTX_NAME "HDZ RACE V3" #elif defined HDZERO_FREESTYLE_V2 #define VTX_NAME "HDZ FREESTYLE V2" +#elif defined HDZERO_PICO +#define VTX_NAME "HDZ PICO" #else #define VTX_NAME " " #endif @@ -85,8 +90,6 @@ // #define _DEBUG_SPI // #define _DEBUG_TRAMP #endif -#define USE_TP9950 -#define USE_TEMPERATURE_SENSOR #define Raceband #define USE_EFUSE diff --git a/targets/hdzero_pico.ini b/targets/hdzero_pico.ini new file mode 100644 index 00000000..7f063491 --- /dev/null +++ b/targets/hdzero_pico.ini @@ -0,0 +1,8 @@ +[env:hdzero_pico] +extends = DM5680 +build_flags = + ${DM5680.build_flags} + -DHDZERO_PICO + -DUSE_TC3587_RSTB + -DUSE_TP9950 + -DUSE_TEMPERATURE_SENSOR \ No newline at end of file From 8afe0ee8601884218f57124a0a2fc7ca180f0d87 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Mon, 25 Dec 2023 10:55:26 +0800 Subject: [PATCH 06/11] optimized pico vtx _RF_CALIB --- src/camera.c | 11 +++++++++++ src/common.h | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/camera.c b/src/camera.c index d425b877..8359ad08 100644 --- a/src/camera.c +++ b/src/camera.c @@ -139,6 +139,17 @@ void camera_mode_detect(uint8_t init) { RF_BW = BW_27M; RF_BW_last = RF_BW; + +#ifdef _RF_CALIB + WAIT(1000); + if (I2C_Read8(ADDR_TP9950, 0x01) != 0x7E) { // if camera lost + WriteReg(0, 0x50, 0x01); // set to video pattern + } + RF_POWER = 0; + RF_FREQ = 0; + Init_6300RF(RF_FREQ, RF_POWER); + DM6300_AUXADC_Calib(); +#endif } #else void camera_mode_detect(uint8_t init) { diff --git a/src/common.h b/src/common.h index e11da577..73dfdd37 100644 --- a/src/common.h +++ b/src/common.h @@ -120,9 +120,8 @@ #define WAIT_SA_CONFIG 3 #endif -#define CFG_TO_SEC 10 -#define CAM_DET_DLY 1000 -#define DISP_TIME 3 // 3/8s +#define CFG_TO_SEC 10 +#define DISP_TIME 3 // 3/8s // gpio #define SCL P0_0 From 4123e80ed3a232f689b9c2ac72db87da4754e373 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Fri, 29 Dec 2023 10:42:15 +0800 Subject: [PATCH 07/11] add HDZero ECO VTX --- platformio.ini | 2 +- src/common.h | 8 ++++---- targets/{hdzero_pico.ini => hdzero_eco.ini} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename targets/{hdzero_pico.ini => hdzero_eco.ini} (77%) diff --git a/platformio.ini b/platformio.ini index 4a3a151f..8a226f5e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,5 +20,5 @@ extra_configs = targets/foxeer_vtx.ini targets/hdzero_race_v3.ini targets/hdzero_freestyle_v2.ini - targets/hdzero_pico.ini + targets/hdzero_eco.ini \ No newline at end of file diff --git a/src/common.h b/src/common.h index 73dfdd37..ba1f46a7 100644 --- a/src/common.h +++ b/src/common.h @@ -16,7 +16,7 @@ // #define FOXEER_VTX // #define HDZERO_RACE_V3 // #define HDZERO_FREESTYLE_V2 -// #define HDZERO_PICO +// #define HDZERO_ECO /* define VTX ID start */ #if defined HDZERO_WHOOP @@ -35,7 +35,7 @@ #define VTX_ID 0x5a #elif defined HDZERO_FREESTYLE_V2 #define VTX_ID 0x5b -#elif defined HDZERO_PICO +#elif defined HDZERO_ECO #define VTX_ID 0x5c #else #define VTX_ID 0x00 @@ -58,8 +58,8 @@ #define VTX_NAME "HDZ RACE V3" #elif defined HDZERO_FREESTYLE_V2 #define VTX_NAME "HDZ FREESTYLE V2" -#elif defined HDZERO_PICO -#define VTX_NAME "HDZ PICO" +#elif defined HDZERO_ECO +#define VTX_NAME "HDZ ECO" #else #define VTX_NAME " " #endif diff --git a/targets/hdzero_pico.ini b/targets/hdzero_eco.ini similarity index 77% rename from targets/hdzero_pico.ini rename to targets/hdzero_eco.ini index 7f063491..ae2f4ecb 100644 --- a/targets/hdzero_pico.ini +++ b/targets/hdzero_eco.ini @@ -1,8 +1,8 @@ -[env:hdzero_pico] +[env:hdzero_eco] extends = DM5680 build_flags = ${DM5680.build_flags} - -DHDZERO_PICO + -DHDZERO_ECO -DUSE_TC3587_RSTB -DUSE_TP9950 -DUSE_TEMPERATURE_SENSOR \ No newline at end of file From 93d1417cab9eed0a93eb3cbc553aa2a0f7e133b6 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Sat, 6 Jan 2024 11:38:40 +0800 Subject: [PATCH 08/11] set eco camera ratio to 4:3 --- src/camera.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/camera.c b/src/camera.c index 8359ad08..76f9a61a 100644 --- a/src/camera.c +++ b/src/camera.c @@ -54,6 +54,11 @@ void camera_ratio_detect(void) { case CAMERA_TYPE_RUNCAM_NANO_90: camRatio = 1; break; +#ifdef HDZERO_ECO + case CAMERA_TYPE_OUTDATED: + camRatio = 1; + break; +#endif default: camRatio = 0; break; @@ -134,6 +139,7 @@ void camera_mode_detect(uint8_t init) { video_format = VDO_FMT_720P60; camera_type = CAMERA_TYPE_OUTDATED; + camera_ratio_detect(); LED_BLUE_ON; led_status = ON; From 88e7fea647d9363977c25afb2ba11414ef226b48 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:17:26 +0800 Subject: [PATCH 09/11] Update hardware.c --- src/hardware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hardware.c b/src/hardware.c index b74c1416..16bf72e5 100644 --- a/src/hardware.c +++ b/src/hardware.c @@ -1133,8 +1133,10 @@ void video_detect(void) { } cameraLost = (ReadReg(0, 0x02) >> 4) & 1; - if (camera_type == CAMERA_TYPE_OUTDATED) + if (camera_type == CAMERA_TYPE_OUTDATED) { + cameraLost |= (I2C_Read8(ADDR_TP9950, 0x01) != 0x7E); return; + } if (sec == 3) { sec = 0; From fc122557ec97863b28598244d9be7386847a2b7e Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:23:42 +0800 Subject: [PATCH 10/11] clean debugf --- src/camera.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/camera.c b/src/camera.c index 76f9a61a..c237ab4e 100644 --- a/src/camera.c +++ b/src/camera.c @@ -81,14 +81,20 @@ void camera_mode_detect(uint8_t init) { Set_720P60_8bit(0); +#ifdef _DEBUG_MODE debugf("\r\nchipID"); +#endif id = I2C_Read8(ADDR_TP9950, 0xfe); +#ifdef _DEBUG_MODE debugf("\r\n fe:%2x", id); +#endif + id = I2C_Read8(ADDR_TP9950, 0xff); +#ifdef _DEBUG_MODE debugf("\r\n ff:%2x\r\n", id); +#endif WAIT(200); - debugf("\r\nCamDetect"); I2C_Write8(ADDR_TP9950, 0x26, 0x01); I2C_Write8(ADDR_TP9950, 0x07, 0xC0); I2C_Write8(ADDR_TP9950, 0x0B, 0xC0); From dcb7cdbb3ce6d8be93f2c84f00d73dcf07735179 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Thu, 14 Mar 2024 16:17:58 +0800 Subject: [PATCH 11/11] Calibrate eco vtx temperature value --- src/hardware.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hardware.c b/src/hardware.c index 018a8097..eb550442 100644 --- a/src/hardware.c +++ b/src/hardware.c @@ -574,7 +574,12 @@ void TempDetect() { temp_new = I2C_Read8(ADDR_TEMPADC, 0); if (temp_new >= 0x7D) // MAX +125 temp_new = 0x7D; - // temp_new >>= 5; //LM75AD + // temp_new >>= 5; //LM75AD + +#ifdef HDZERO_ECO + if (temp_new > 10) + temp_new -= 10; +#endif temperature = temperature - (temperature >> 2) + temp_new;