📄 osdtune.02
字号:
{
if (phaseRet != 31)
{
phaseOkFlag = 1;
phaseStart = phaseRet;
#if (DEBUGMSG >= 3)
printf(" phaseStart = %d\n",(unsigned int)phaseStart);
#endif
}
}
//set phaseEnd
else if ( ( ival > 0 ||(ival == 0 && phaseRet == 31)) && phaseOkFlag && phaseEnd == 0 )
{
phaseEnd = phaseRet;
if (ival > 0) phaseEnd -= 1;
#if (DEBUGMSG >= 3)
printf(" phaseEnd = %d\n",(unsigned int)phaseEnd);
#endif
if(phaseEnd == phaseStart)
{
phaseOkFlag = 0;
phaseStart = phaseEnd = 0;
#if (DEBUGMSG >= 3)
printf(" Reset phaseStart & phaseEnd \n");
#endif
}
}
//set phaseStart1
else if (ival == 0 && !phaseOkFlag1 && phaseEnd != 0 )
{
if (phaseRet != 31)
{
phaseOkFlag1 = 1;
phaseStart1 = phaseRet;
#if (DEBUGMSG >= 3)
printf(" phaseStart1 = %d\n",(unsigned int)phaseStart1);
#endif
}
}
//set phaseEnd1
else if ((ival > 0 ||(ival == 0 && phaseRet == 31)) && phaseOkFlag1 && phaseStart1 != 0 && phaseEnd1 == 0)
{
phaseEnd1 = phaseRet;
if (ival > 0) phaseEnd1 -= 1;
#if (DEBUGMSG >= 3)
printf(" phaseEnd1 = %d\n",(unsigned int)phaseEnd1);
#endif
if(phaseEnd1 == phaseStart1)
{
phaseOkFlag1 = 0;
phaseStart1 = phaseEnd1 = 0;
#if (DEBUGMSG >= 3)
printf(" Reset phaseStart1 & phaseEnd1 \n");
#endif
}
}
//set phaseStart2
else if (ival == 0 && !phaseOkFlag2 && phaseEnd1 != 0 )
{
if (phaseRet != 31)
{
phaseOkFlag2 = 1;
phaseStart2 = phaseRet;
#if (DEBUGMSG >= 3)
printf(" phaseStart2 = %d\n",(unsigned int)phaseStart2);
#endif
}
}
//set phaseEnd2
else if ((ival > 0 ||(ival == 0 && phaseRet == 31)) && phaseOkFlag2 && phaseStart2 != 0 && phaseEnd2 == 0)
{
phaseEnd2 = phaseRet;
if (ival > 0) phaseEnd2 -= 1;
#if (DEBUGMSG >= 3)
printf(" phaseEnd2 = %d\n",(unsigned int)phaseEnd2);
#endif
if(phaseEnd2 == phaseStart2)
{
phaseOkFlag2 = 0;
phaseStart2 = phaseEnd2 = 0;
#if (DEBUGMSG >= 3)
printf(" Reset phaseStart2 & phaseEnd2 \n");
#endif
}
}
//set phaseVal
if(phaseRet == phaseHwEnd)
{
if (phaseOkFlag && (phaseEnd == 0)) phaseEnd = phaseHwEnd;
if (phaseOkFlag1 && (phaseEnd1 == 0)) phaseEnd1 = phaseHwEnd;
if (phaseOkFlag2 && (phaseEnd2 == 0)) phaseEnd2 = phaseHwEnd;
if (phaseOkFlag & phaseOkFlag1 & phaseOkFlag2)
{
if (phaseStart1 > phaseStart2)
{
phaseVal = phaseStart2;
phaseStart2 = phaseStart1;
phaseStart1 = phaseVal;
phaseVal = phaseEnd2;
phaseEnd2 = phaseEnd1;
phaseEnd1 = phaseVal;
}
if (phaseStart > phaseStart1)
{
phaseVal = phaseStart1;
phaseStart1 = phaseStart;
phaseStart = phaseVal;
phaseVal = phaseEnd1;
phaseEnd1 = phaseEnd;
phaseEnd = phaseVal;
}
if (phaseStart1 > phaseStart2)
{
phaseVal = phaseStart2;
phaseStart2 = phaseStart1;
phaseStart1 = phaseVal;
phaseVal = phaseEnd2;
phaseEnd2 = phaseEnd1;
phaseEnd1 = phaseVal;
}
if ((phaseStart == 0) && (phaseEnd2 == 31))
{
if((phaseEnd-phaseStart+phaseEnd2-phaseStart2) >= (phaseEnd1-phaseStart1))
phaseVal = ((phaseStart2+phaseEnd)/2+16)& 0x1f;
else
phaseVal = (phaseEnd1 + phaseStart1)/2;
}
else if((phaseEnd-phaseStart) >= (phaseEnd1-phaseStart1))
{
if((phaseEnd-phaseStart) >= (phaseEnd2-phaseStart2))
phaseVal = (phaseEnd + phaseStart)/2;
else
phaseVal = (phaseEnd2 + phaseStart2)/2;
}
else
{
if((phaseEnd1-phaseStart1) >= (phaseEnd2-phaseStart2))
phaseVal = (phaseEnd1 + phaseStart1)/2;
else
phaseVal = (phaseEnd2 + phaseStart2)/2;
}
#if (DEBUGMSG >= 3)
printf(" phaseOkFlag & phaseOkFlag1 & phaseOkFlag2 phaseVal = %d\n",(unsigned int)phaseVal);
#endif
calibStatus = 1;
}
else if (phaseOkFlag & phaseOkFlag1)
{
if (phaseStart > phaseStart1)
{
phaseVal = phaseStart1;
phaseStart1 = phaseStart;
phaseStart = phaseVal;
phaseVal = phaseEnd1;
phaseEnd1 = phaseEnd;
phaseEnd = phaseVal;
}
if ((phaseStart == 0) && (phaseEnd1 == 31))
phaseVal = ((phaseStart1+phaseEnd)/2+16)& 0x1f;
else if((phaseEnd-phaseStart) >= (phaseEnd1-phaseStart1))
phaseVal = (phaseEnd + phaseStart)/2;
else
phaseVal = (phaseEnd1 + phaseStart1)/2;
#if (DEBUGMSG >= 3)
printf(" phaseOkFlag & phaseOkFlag1 phaseVal = %d\n",(unsigned int)phaseVal);
#endif
calibStatus = 1;
}
else if(phaseOkFlag)
{
phaseVal = (phaseStart+phaseEnd)/2;
#if (DEBUGMSG >= 3)
printf(" phaseOkFlag phaseVal = %d\n",(unsigned int)phaseVal);
#endif
if ((phaseStart == phaseHwStart) && (phaseEnd == phaseHwEnd))
calibStatus = 2;
else
calibStatus = 1;
}
else
{
phaseVal = minValue;
#if (DEBUGMSG >= 3)
printf(" Fail checkphase!!! phaseVal = minValue = %d\n",(unsigned int)minValue);
#endif
calibStatus = 0;
}
goto phasecal_done;
}
//-----------------------------------------------------------------------------
phaseRet = (phaseRet+1) & PHASEMSK;
miscSetADCPhase(phaseRet);
goto cp_chkphase;
phasecal_done:
eepModeData.setData.phase = phaseVal;
goto phasecal_ret;
phasecal_fail:
calibStatus = 0;
eepModeData.setData.phase = PresetModeFlag ? autoModeData.phase : DefaultPhase;
phasecal_ret:
RegByteOut(0xB0, 0x00); // Disable calibration
miscSetADCPhase(eepModeData.setData.phase);
return calibStatus;
}
#undef phaseStart
#undef phaseEnd
#undef phaseStart1
#undef phaseEnd1
#undef phaseStart2
#undef phaseEnd2
#undef minValue
#undef minError
#undef phaseVal
#endif //DETAIL_AUTOTUNE
char waitCalibReady(unsigned char mask)
{
unsigned char bv;
int cnt = 300;
while (cnt > 0) {
if (cnt-- == 0) {
CalibSuccess = 0;
return 0;
}
if ( (bv = RegByteIn(0x00)) & mask )
return 1;
if ( bv&0x80 ) {
#if DEBUGMSG
printf(" FAIL: waitCalibReady, frame end\n");
#endif
CalibSuccess = 0;
return 0;
}
if ( RegByteIn(0x01) & 0x35 ) {
#if DEBUGMSG
printf(" FAIL: waitCalibReady, sync changed\n");
#endif
//miscTurnOffPanel(); // Turn off panel display
miscTurnOffBackLight();
CalibSuccess = 0;
return 0;
}
}
}
#if DETAIL_AUTOTUNE
char waitCalibReady1(unsigned char mask)
{
int cnt= 300;
while (cnt>0) {
if (cnt-- == 0) {
CalibSuccess = 0;
return 0;
}
if ( RegByteIn(0x00) & mask )
return 1;
if ( RegByteIn(0x01) & 0x35) { // sync changed in middle
//miscTurnOffPanel(); // Turn off panel display
miscTurnOffBackLight();
CalibSuccess = 0;
#if DEBUGMSG
printf(" FAIL: waitCalibReady1, syncStatus=%02X\n", (unsigned int)RegByteIn(0x01));
#endif
return 0;
}
}
}
#endif //DETAIL_AUTOTUNE
#if USE_PITCH_PATCH
void pitchPatch(void)
{
if (eepModeData.setData.pitch >= 799 && eepModeData.setData.pitch <= 801) eepModeData.setData.pitch = 800;
else if (eepModeData.setData.pitch >= 831 && eepModeData.setData.pitch <= 833) eepModeData.setData.pitch = 832;
else if (eepModeData.setData.pitch >= 839 && eepModeData.setData.pitch <= 841) eepModeData.setData.pitch = 840;
else if (eepModeData.setData.pitch >= 935 && eepModeData.setData.pitch <= 937) eepModeData.setData.pitch = 936;
else if (eepModeData.setData.pitch >= 1023 && eepModeData.setData.pitch <= 1025) eepModeData.setData.pitch = 1024;
else if (eepModeData.setData.pitch >= 1039 && eepModeData.setData.pitch <= 1041) eepModeData.setData.pitch = 1040;
else if (eepModeData.setData.pitch >= 1047 && eepModeData.setData.pitch <= 1049) eepModeData.setData.pitch = 1048;
else if (eepModeData.setData.pitch >= 1055 && eepModeData.setData.pitch <= 1057) eepModeData.setData.pitch = 1056;
else if (eepModeData.setData.pitch >= 1263 && eepModeData.setData.pitch <= 1265) eepModeData.setData.pitch = 1264;
else if (eepModeData.setData.pitch >= 1311 && eepModeData.setData.pitch <= 1313) eepModeData.setData.pitch = 1312;
else if (eepModeData.setData.pitch >= 1327 && eepModeData.setData.pitch <= 1329) eepModeData.setData.pitch = 1328;
else if (eepModeData.setData.pitch >= 1343 && eepModeData.setData.pitch <= 1345) eepModeData.setData.pitch = 1344;
else if (eepModeData.setData.pitch >= 1375 && eepModeData.setData.pitch <= 1377) eepModeData.setData.pitch = 1376;
else if (eepModeData.setData.pitch >= 1599 && eepModeData.setData.pitch <= 1601) eepModeData.setData.pitch = 1600;
else if (eepModeData.setData.pitch >= 1687 && eepModeData.setData.pitch <= 1689) eepModeData.setData.pitch = 1688;
else if (eepModeData.setData.pitch >= 1727 && eepModeData.setData.pitch <= 1729) eepModeData.setData.pitch = 1728;
else if (eepModeData.setData.pitch >= 1799 && eepModeData.setData.pitch <= 1801) eepModeData.setData.pitch = 1800;
}
#endif
#if 0
/************************************************
* PhaseMax Calibration *
*************************************************/
#define MaxColorR buff[11]
#define MaxColorG buff[12]
#define MaxColorB buff[13]
#define NeiColorR buff[14]
#define NeiColorG buff[15]
#define NeiColorB buff[16]
void phaseMaxCalibration(unsigned char control)
{
unsigned int Hcounter;
unsigned int Vcounter;
unsigned int difference,differenceMax=0;
unsigned char i;
#if (DEBUGMSG >= 3)
printf(" \n---------------- phaseMaxCalibration %02X\n", (unsigned int)control);
#endif
if (phaseHwStart > phaseHwEnd)
{
buff[17] = phaseHwEnd;
phaseHwEnd = phaseHwStart;
phaseHwStart = buff[17];
}
for (i = phaseHwStart;i <= phaseHwEnd;i++)
{
miscSetADCPhase(i);
#if (DEBUGMSG >= 2)
printf("PHASE=%d\n ",(unsigned int)i);
#endif
// Get Max color
RegByteOut(0xB1, 0x04); // select component R
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x20); // Enable color calibration
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x40);
MaxColorR = RegByteIn(0xDB);
RegByteOut(0xB1, 0x02); // select component G
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x20); // Enable color calibration
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x40);
MaxColorG = RegByteIn(0xDC);
RegByteOut(0xB1, 0x01); // select component B
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x20); // Enable color calibration
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x40);
MaxColorB = RegByteIn(0xDD);
#if (DEBUGMSG>=3)
printf(" ----- MaxColorR=%02X\n", (unsigned int)MaxColorR);
printf(" ----- MaxColorG=%02X\n", (unsigned int)MaxColorG);
printf(" ----- MaxColorB=%02X\n", (unsigned int)MaxColorB);
#endif
// Get Max difference point
RegByteOut(0xB1, 0x00);
RegByteOut(0xB2, 0xff);
RegByteOut(0xB0, 0x10); // Enable Max diffenence calibration
RegByteOut(0x00, 0x00); // Clear the calibration status reg
if ( waitCalibReady(0x10) == 0) {
//goto phasecal_fail;
return;
}
RegDataIn(0xD8, buff, 3);
//Max H position
Hcounter = ((unsigned int)(buff[2]&0x70)<<4) + buff[1];
//Max V position
Vcounter = ((unsigned int)(buff[2]&0x07)<<8) + buff[0];
#if (DEBUGMSG>=3)
printf(" Max Pos = ( %d , %d )\n",Hcounter,Vcounter );
#endif
// Set neighbor point position
Hcounter += 1;
buff[3] = (unsigned char)Vcounter;
buff[4] = (unsigned char)Hcounter;
buff[5] = (unsigned char)((Hcounter&0x0f00)>>4) + (unsigned char)((Vcounter&0x0f00)>>8);
RegDataOut(0xde, buff+3, 3);
RegDataOut(0xe1, buff+3, 3);
RegDataOut(0xe4, buff+3, 3);
// Get Neighbor point color
RegByteOut(0xB1, 0x04); // select component R
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x40); // Enable Max color
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x20);
NeiColorR = RegByteIn(0xDB);
RegByteOut(0xB1, 0x02); // select component G
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x40); // Enable Max color
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x20);
NeiColorG = RegByteIn(0xDC);
RegByteOut(0xB1, 0x01); // select component B
RegByteOut(0xB2, 0xFF);
RegByteOut(0xB0, 0x40); // Enable Max color
RegByteOut(0x00, 0x00); // Clear the calibration status reg
waitCalibReady(0x20);
NeiColorB = RegByteIn(0xDD);
#if (DEBUGMSG>=3)
printf(" ----- NeiColorR=%02X\n", (unsigned int)NeiColorR);
printf(" ----- NeiColorG=%02X\n", (unsigned int)NeiColorG);
printf(" ----- NeiColorB=%02X\n", (unsigned int)NeiColorB);
#endif
difference = (MaxColorR - NeiColorR) + (MaxColorG - NeiColorG) + (MaxColorB - NeiColorB);
if (difference > differenceMax)
{
differenceMax = difference;
eepModeData.setData.phase = i;
}
#if (DEBUGMSG >= 2)
printf(" ***** difference=%d\n\n",difference);
#endif
}
RegByteOut(0xB0, 0x00); // Disable calibration
miscSetADCPhase(eepModeData.setData.phase);
#if (DEBUGMSG >= 2)
printf("------------PHASE=%d\n ",(unsigned int)eepModeData.setData.phase);
#endif
}
#undef MaxColorR
#undef MaxColorG
#undef MaxColorB
#undef NeiColorR
#undef NeiColorG
#undef NeiColorB
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -