Skip to content

Commit

Permalink
remove almost all debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
ligenxxxx committed Aug 26, 2024
1 parent e604d12 commit 9048dda
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 665 deletions.
53 changes: 1 addition & 52 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ void camera_type_detect(void) {
camera_type == CAMERA_TYPE_RUNCAM_NANO_90 ||
camera_type == CAMERA_TYPE_RUNCAM_MICRO_V3) {
camera_mfr = CAMERA_MFR_RUNCAM;
#ifdef _DEBUG_CAMERA
debugf("\r\ncamera mfr : RUNCAM");
debugf("\r\ncamera type: %d", (uint16_t)camera_type);
#endif
return;
}
}
Expand Down Expand Up @@ -82,30 +78,13 @@ void camera_mode_detect(uint8_t init) {
#endif

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");

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);

I2C_Write8(ADDR_TP9950, 0x26, 0x01);
Expand Down Expand Up @@ -222,23 +201,14 @@ void camera_mode_detect(uint8_t init) {
if (video_format == VDO_FMT_720P50) {
Init_TC3587(0);
Set_720P50(IS_RX);
#ifdef _DEBUG_CAMERA
debugf("\r\nCamDetect: Set 50fps.");
#endif
} else if (video_format == VDO_FMT_720P60) {
Init_TC3587(0);
Set_720P60(IS_RX);
#ifdef _DEBUG_CAMERA
debugf("\r\nCamDetect: Set 60fps.");
#endif
}
WAIT(100);

for (detect_tries = 0; detect_tries < 5; detect_tries++) {
status_reg = ReadReg(0, 0x02);
#ifdef _DEBUG_CAMERA
debugf("\r\nCamDetect status_reg: %x", status_reg);
#endif
if ((status_reg >> 4) != 0) {
loss = 1;
}
Expand Down Expand Up @@ -272,13 +242,6 @@ void camera_mode_detect(uint8_t init) {
RF_BW = BW_27M;
RF_BW_last = RF_BW;
}
#ifdef _DEBUG_MODE
debugf("\r\ncameraID: %x, bw: ", (uint16_t)camera_type);
if (RF_BW == BW_17M)
debugf("17M");
else
debugf("27M");
#endif
}
#endif

Expand All @@ -291,7 +254,6 @@ void camera_button_init() {

void camera_reg_write_eep(uint16_t addr, uint8_t val) {
I2C_Write8_Wait(10, ADDR_EEPROM, addr, val);
debugf("\r\neep write(%02x,%d)", addr, (uint16_t)val);
}
uint8_t camera_reg_read_eep(uint16_t addr) {
return I2C_Read8_Wait(10, ADDR_EEPROM, addr);
Expand Down Expand Up @@ -333,9 +295,6 @@ void camera_setting_profile_check(uint8_t profile) {
if (need_reset) {
camera_setting_profile_reset(profile);
camera_setting_profile_write(profile);
#ifdef _DEBUG_CAMERA
debugf("\r\ncamera setting need to be reset");
#endif
}
}
void camera_profile_read(void) {
Expand Down Expand Up @@ -373,9 +332,6 @@ void camera_setting_read(void) {
}
camera_reg_write_eep(EEP_ADDR_CAM_TYPE, camera_type);
i = camera_reg_read_eep(EEP_ADDR_CAM_TYPE);
#ifdef _DEBUG_CAMERA
debugf("\r\ncamera changed(%d==>%d), reset camera setting", camera_type_last, i);
#endif
} else {
camera_profile_read();
camera_profile_check();
Expand All @@ -392,10 +348,6 @@ void camera_setting_reg_menu_update(void) {
uint8_t i;
for (i = 0; i < CAMERA_SETTING_NUM; i++)
camera_setting_reg_menu[i] = camera_setting_reg_eep[camera_profile_menu][i];

#ifdef _DEBUG_CAMERA
debugf("\r\ncamera profile:%d", camera_profile_menu);
#endif
}

void camera_setting_reg_eep_update(void) {
Expand Down Expand Up @@ -537,7 +489,7 @@ void camera_menu_draw_value(void) {
uint8ToString(camera_setting_reg_menu[i - 1], str);
strcpy(&osd_buf[i][osd_menu_offset + 25], str);
break;
case CAM_STATUS_HVFLIP: // hv flip
case CAM_STATUS_HVFLIP: // hv flip
strcpy(&osd_buf[i][osd_menu_offset + 21], hv_flip_str[camera_setting_reg_menu[i - 1]]);
break;
case CAM_STATUS_NIGHT_MODE: // night mode
Expand Down Expand Up @@ -877,9 +829,6 @@ uint8_t camera_status_update(uint8_t op) {
break;
case CAM_STATUS_REPOWER:
if (op == BTN_RIGHT) {
#ifdef _DEBUG_MODE
debugf("\r\nRF_Delay_Init: None");
#endif
camera_profile_write();
reset_isp_need |= camera_set(camera_setting_reg_menu, 1, 0);
camera_setting_reg_eep_update();
Expand Down
8 changes: 0 additions & 8 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,7 @@

#ifndef _RF_CALIB
// #define _DEBUG_MODE
// #define _DEBUG_DM6300
// #define _DEBUG_TC3587
// #define _DEBUG_CAMERA
// #define _DEBUG_LIFETIME
// #define _DEBUG_SMARTAUDIO
// #define _DEBUG_DISPLAYPORT
// #define _DEBUG_RUNCAM
// #define _DEBUG_SPI
// #define _DEBUG_TRAMP
#endif

#define Raceband
Expand Down
97 changes: 4 additions & 93 deletions src/dm6300.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ const uint16_t frequencies[] = {
void DM6300_write_reg_map(const dm6300_reg_value_t *reg_map, uint8_t size) {
uint8_t i = 0;
for (i = 0; i < size; i++) {
// debugf("\r\nDM6300_write_reg_map: %bx %x %lx", reg_map[i].trans, reg_map[i].addr, reg_map[i].dat);
SPI_Write(reg_map[i].trans, reg_map[i].addr, reg_map[i].dat);
}
}
Expand Down Expand Up @@ -294,10 +293,6 @@ dm6300_reg_value_t dm6300_set_channel_regs[] = {
};

void DM6300_SetChannel(uint8_t ch) {
#ifdef _DEBUG_MODE
debugf("\r\nset ch:%x", (uint16_t)ch);
#endif

if (ch >= FREQ_NUM)
ch = 0;

Expand Down Expand Up @@ -339,9 +334,7 @@ void DM6300_SetPower(uint8_t pwr, uint8_t freq, uint8_t offset) {
uint16_t a_tab[2] = {0x21F, 0x41F};
#endif
int16_t p;
#ifdef _DEBUG_MODE
debugf("\r\nDM6300 set power:%x, offset:%x", (uint16_t)pwr, (uint16_t)offset);
#endif

if (freq >= FREQ_NUM)
freq = 0;
SPI_Write(0x6, 0xFF0, 0x00000018);
Expand Down Expand Up @@ -400,13 +393,7 @@ void DM6300_InitAUXADC() {

SPI_Write(0x6, 0xFF0, 0x00000018);
SPI_Read(0x3, 0x254, &dat);
#ifdef _DEBUG_DM6300
debugf("\r\nDM6300 0x254 = %x%x.\r\n", (uint16_t)((dat >> 16) & 0xFFFF), (uint16_t)(dat & 0xFFFF));
#endif
dat |= 0x200;
#ifdef _DEBUG_DM6300
debugf("\r\nDM6300 0x254 = %x%x.\r\n", (uint16_t)((dat >> 16) & 0xFFFF), (uint16_t)(dat & 0xFFFF));
#endif
SPI_Write(0x3, 0x254, dat);

SPI_Write(0x6, 0xFF0, 0x00000019);
Expand Down Expand Up @@ -444,9 +431,6 @@ void DM6300_InitAUXADC() {
if (auxadc_offset < 0x420)
auxadc_offset = 0x420;
#endif
#ifdef _DEBUG_DM6300
debugf("\r\nDM6300 AUXADC Calib done. data1=%x, data2=%x, data3=%x, offset=%x", dat1, dat2, dat3, auxadc_offset);
#endif
}

void DM6300_AUXADC_Calib() {
Expand All @@ -469,12 +453,10 @@ void DM6300_AUXADC_Calib() {
for (i=0;i<8;i++){
DM6300_SetChannel(i);
DM6300_SetPower(0, i, 0);
debugf("\r\nPA voltage detect: channel = %d,voltage =",(uint16_t)i);
for(j=0;j<8;j++){
SPI_Write(0x6, 0xFF0, 0x00000019);
SPI_Read (0x3, 0x17C, &dl);
vol = (((int32_t)dl) >> 20) + auxadc_offset;
debugf("%x ", vol);
}
//WAIT(1000);
}
Expand Down Expand Up @@ -932,15 +914,7 @@ uint8_t DM6300_detect(void) {
uint32_t rdat = 0;
SPI_Write(0x6, 0xFF0, 0x18);
SPI_Read(0x6, 0xFF0, &rdat);

#ifdef _DEBUG_MODE
if (rdat != 0x18) {
debugf("\r\ndm6300 lost");
} else {
debugf("\r\ndm6300 alive");
}
#endif
return (rdat != 0x18) ? 1 : 0;
return rdat != 0x18;
}

void DM6300_Init(uint8_t ch, BWType_e bw) {
Expand Down Expand Up @@ -986,9 +960,6 @@ void DM6300_Init(uint8_t ch, BWType_e bw) {
DM6300_EFUSE2();
#endif
SPI_Write(0x6, 0xFF0, 0x00000018);
#ifdef _DEBUG_MODE
debugf("\r\nDM6300 init done.");
#endif
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1173,13 +1144,8 @@ void DM6300_EFUSE1() {
efuse.macro.m1.ical = (efuse.macro.m1.ical >> 8) | (efuse.macro.m1.ical << 8);
efuse.macro.m1.rcal = (efuse.macro.m1.rcal >> 8) | (efuse.macro.m1.rcal << 8);
#endif
// debugf("\r\nband_num=%x", efuse.macro.m0.band_num);
// debugf("\r\nbandgap=%lx", efuse.macro.m1.bandgap);
// debugf("\r\nical=%x", efuse.macro.m1.ical);
// debugf("\r\nrcal=%x", efuse.macro.m1.rcal);

dat = ((efuse.macro.m1.ical & 0x1F) << 3) | (efuse.macro.m1.rcal & 0x7);
// debugf("\r\nrh=%lx", rh);

SPI_Write(0x6, 0xF14, efuse.macro.m1.bandgap);
SPI_Write(0x6, 0xF18, dat);
Expand All @@ -1203,9 +1169,6 @@ void DM6300_EFUSE2() {
for (i = 0; i < 4; i++) {
version[i] = efuse.macro.m0.efuse_ver[i];
}
#ifdef _DEBUG_DM6300
debugf("\r\n version = %s", version);
#endif
// version[1]; //version[1] M.N---M
// version[3]; //version[3] M.N---N

Expand All @@ -1214,11 +1177,8 @@ void DM6300_EFUSE2() {
for (i = 0; i < efuse.macro.m0.band_num; i++) // find match macro 5.8G
// for(i=0; i<FREQ_NUM_EXTERNAL; i++) // find match macro 5.8G
{
// efuse.macro.m2[i].tx1.freq_start = (efuse.macro.m2[i].tx1.freq_start >> 8) | (efuse.macro.m2[i].tx1.freq_start << 8);
// efuse.macro.m2[i].tx1.freq_stop = (efuse.macro.m2[i].tx1.freq_stop >> 8) | (efuse.macro.m2[i].tx1.freq_stop << 8);
#ifdef _DEBUG_DM6300
debugf("\r\n start=%x, stop=%x", efuse.macro.m2[i].tx1.freq_start, efuse.macro.m2[i].tx1.freq_stop);
#endif
// efuse.macro.m2[i].tx1.freq_start = (efuse.macro.m2[i].tx1.freq_start >> 8) | (efuse.macro.m2[i].tx1.freq_start << 8);
// efuse.macro.m2[i].tx1.freq_stop = (efuse.macro.m2[i].tx1.freq_stop >> 8) | (efuse.macro.m2[i].tx1.freq_stop << 8);

if (efuse.macro.m2[i].tx1.freq_start >= 5000 && efuse.macro.m2[i].tx1.freq_stop <= 6000) {
//*((volatile unsigned int *)0x200D08) = efuse.macro.m2[i].tx1.iqmismatch;
Expand Down Expand Up @@ -1247,15 +1207,6 @@ void DM6300_EFUSE2() {
((efuse.macro.m2[i].tx1.dcoc_q >> 8) & 0xFF00) |
((efuse.macro.m2[i].tx1.dcoc_q << 8) & 0xFF0000) |
((efuse.macro.m2[i].tx1.dcoc_q << 24) & 0xFF000000);
#endif
#ifdef _DEBUG_DM6300
debugf("\r\niqmismatch_old=%lx", efuse.macro.m2[i].tx1.iqmismatch);
debugf("\r\ndcoc_i_old=%lx", efuse.macro.m2[i].tx1.dcoc_i);
debugf("\r\ndcoc_q_old=%lx", efuse.macro.m2[i].tx1.dcoc_q);

// change dc_i/dc_q
debugf("\r\n version[1] = %c", (uint16_t)version[1]);
debugf("\r\n version[3] = %c", (uint16_t)version[3]);
#endif
// if((version[1]>'2') | ((version[1]>='2') && (version[3]>'1'))){ //version > 2.1
if ((version[1] == '2') && (version[3] == '2')) { // version = 2.2
Expand All @@ -1272,67 +1223,27 @@ void DM6300_EFUSE2() {
SPI_Write(0x3, 0x380, efuse.macro.m2[i].tx1.dcoc_i);
SPI_Write(0x3, 0x388, efuse.macro.m2[i].tx1.dcoc_q);

debugf("\r\niqmismatch=%lx", efuse.macro.m2[i].tx1.iqmismatch);
debugf("\r\ndcoc_i=%lx", efuse.macro.m2[i].tx1.dcoc_i);
debugf("\r\ndcoc_q=%lx", efuse.macro.m2[i].tx1.dcoc_q);

dcoc_ih = efuse.macro.m2[i].tx1.dcoc_i & 0xFFFF0000;
dcoc_qh = efuse.macro.m2[i].tx1.dcoc_q & 0xFFFF0000;

if (EE_VALID) {
rdat = I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_EN);
if ((rdat & 0xFF) == 0) {
#ifdef _DEBUG_DM6300
debugf("\r\nDCOC read from EEPROM:");
#endif
SPI_Write(0x6, 0xFF0, 0x00000018);

rdat = I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_IH);
rdat <<= 8;
rdat |= I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_IL);
rdat |= dcoc_ih;
SPI_Write(0x3, 0x380, rdat);
#ifdef _DEBUG_DM6300
debugf("\r\ndcoc_i=%lx", rdat);
#endif

rdat = I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_QH);
rdat <<= 8;
rdat |= I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_QL);
rdat |= dcoc_qh;
SPI_Write(0x3, 0x388, rdat);
#ifdef _DEBUG_DM6300
debugf("\r\ndcoc_q=%lx", rdat);
#endif
}
}

/*if(EE_VALID){
d0 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xa8);
d1 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xa9);
d2 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xaa);
d3 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xab);
d4 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xac);
d5 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xad);
d6 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xae);
d7 = I2C_Read8_Wait(10, ADDR_EEPROM, 0xaf);
debugf("\r\nd0=%lx,d1=%lx,d2=%lx,d3=%lx", d0,d1,d2,d3);
debugf("\r\nd4=%lx,d5=%lx,d6=%lx,d7=%lx", d4,d5,d6,d7);
wdat = 0x075F0000;
wdat = wdat | (d0<<8) | d1;
SPI_Write(0x3, 0x380, wdat);
debugf("\r\nreg380=%lx", wdat);
wdat = 0x075F0000;
wdat = wdat | (d2<<8) | d3;
SPI_Write(0x3, 0x388, wdat);
debugf("\r\nreg388=%lx", wdat);
wdat = (d4 << 24) | (d5 << 16) | (d6 << 8) | d7;
SPI_Write(0x3, 0xD08, wdat);
debugf("\r\nregD08=%lx", wdat);
}*/

break;
}
}
Expand Down
Loading

0 comments on commit 9048dda

Please sign in to comment.