Derek's library mentions correcting the phasing issue automatically. I made it a menu item and call this function when I see issues on the waterfall.
Code:
// GUItool: begin automatically generated code
AudioInputI2S IQ_in; //xy=142,624
AudioFilterFIR PhaseI; //xy=280,556
AudioFilterFIR PhaseQ; //xy=286,722
.............................
// phase correction FIRs. Apparently sometimes the I2s audio samples are 1 step out of phase
// and waterfall shows very little opposite sideband suppression
int16_t PhaseIfir[2] = { 32767, 0 }; // swap constants to change phasing
int16_t PhaseQfir[2] = { 32767, 0 };
.............................
// I2S audio sometimes starts with I and Q out of order
void PhaseChange(uint8_t chg){
static int val;
if( chg ){
if( ++val > 2 ) val = 0; // rotate through the settings
}
// print
tft.setTextSize( 1 );
tft.setCursor(262,66);
tft.setTextColor(EGA[14],0);
tft.print("Ph: ");
switch( val ){
case 0:
PhaseIfir[0] = 32767; PhaseIfir[1] = 0; // normal in phase
PhaseQfir[0] = 32767; PhaseQfir[1] = 0;
tft.print("1010");
break;
case 1:
PhaseIfir[0] = 32767; PhaseIfir[1] = 0;
PhaseQfir[0] = 0; PhaseQfir[1] = 32767; // delay Q ( delay I if fir runs backward )
tft.print("1001");
break;
case 2:
PhaseIfir[0] = 0; PhaseIfir[1] = 32767; // delay I
PhaseQfir[0] = 32767; PhaseQfir[1] = 0;
tft.print("0110");
break;
}
}