FT857D-ESP32/FT857D-ESP32.cpp
// get the frequency and the current mode
// if called as getFreqMode() return only the frequency
get the frequency and the current mode
if called as getFreqMode() return only the frequency
get the frequency and the current mode if called as getFreqMode () return only the frequency
unsigned long FT857D::getFreqMode() {
	byte rigGetFreq[5] = {0x00,0x00,0x00,0x00,0x00};
	rigGetFreq[4] = CAT_RX_FREQ_CMD; 
	byte chars[4];
	long timeout = millis();
	long elapsed = 0;
	sendCmd(rigGetFreq, 5);
	while (rigCat.available() < 5 && elapsed < 2000) {
		elapsed = millis() - timeout;
     	;}
	for (int j = 0; j < 4; j++) {
		chars[j] = rigCat.read();  
   	}
        byte modeint;
        modeint = rigCat.read(); 
      switch (modeint)
       {
        case 0xFC:
           mode = "PKT";
           break;
	case CAT_MODE_LSB:
           mode = "LSB";
           break;
	case CAT_MODE_USB:
            mode = "USB";
            break;
	case CAT_MODE_CW:
            mode = "CW ";
            break;
	case CAT_MODE_FM:
            mode = "FM ";
           break;
	case CAT_MODE_WFM:
            mode = "WFM";
           break;
	case CAT_MODE_CWR:
            mode = "CWR";
           break;
	case CAT_MODE_AM:
            mode = "AM ";
           break;
	case CAT_MODE_FMN:
            mode = "FMN";
           break;
	case CAT_MODE_DIG:
            mode = "DIG";
           break;
	default:
            mode = "UNK";
            break;
          }
	freq = from_bcd_be(chars, 8);
	return freq;
}
unsigned long FT857D :: getFreqMode ( ) { byte rigGetFreq [ 5 ] = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ; rigGetFreq [ 4 ] = CAT_RX_FREQ_CMD ; byte chars [ 4 ] ; long timeout = millis ( ) ; long elapsed = 0 ; sendCmd ( rigGetFreq , 5 ) ; while ( rigCat . available ( ) < 5 && elapsed < 2000 ) { elapsed = millis ( ) - timeout ; ; } for ( int j = 0 ; j < 4 ; j ++ ) { chars [ j ] = rigCat . read ( ) ; } byte modeint ; modeint = rigCat . read ( ) ; switch ( modeint ) { case 0xFC : mode = " " ; break ; case CAT_MODE_LSB : mode = " " ; break ; case CAT_MODE_USB : mode = " " ; break ; case CAT_MODE_CW : mode = " " ; break ; case CAT_MODE_FM : mode = " " ; break ; case CAT_MODE_WFM : mode = " " ; break ; case CAT_MODE_CWR : mode = " " ; break ; case CAT_MODE_AM : mode = " " ; break ; case CAT_MODE_FMN : mode = " " ; break ; case CAT_MODE_DIG : mode = " " ; break ; default : mode = " " ; break ; } freq = from_bcd_be ( chars , 8 ) ; return freq ; }
get the frequency and the current mode
if called as getFreqMode() return only the frequency
get the frequency and the current mode if called as getFreqMode () return only the frequency
// command byte //	rigCat.flush();	// clear the RX buffer which helps prevent // any crap data from making it through /*  in V0.1 mode was a byte. The returned mode is now a user-friendly string directly displayable - F6CZV */ // F6CZV // Serial.println(modeint);