fix mute in ctcss example
This commit is contained in:
		
							parent
							
								
									0b6d1a3cac
								
							
						
					
					
						commit
						88264e1998
					
				| 
						 | 
					@ -101,7 +101,7 @@ void setup() {
 | 
				
			||||||
  Serial.print("ctcss tone: ");
 | 
					  Serial.print("ctcss tone: ");
 | 
				
			||||||
  Serial.println(radio.getCtcssFreqHz());
 | 
					  Serial.println(radio.getCtcssFreqHz());
 | 
				
			||||||
  // mute audio until we get a CTCSS tone
 | 
					  // mute audio until we get a CTCSS tone
 | 
				
			||||||
//  radio.setMute();
 | 
					  radio.setMute();
 | 
				
			||||||
  muted = true;
 | 
					  muted = true;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  // configure Arduino LED for
 | 
					  // configure Arduino LED for
 | 
				
			||||||
| 
						 | 
					@ -117,13 +117,13 @@ void loop() {
 | 
				
			||||||
    if (radio.getCtcssToneDetected()) {
 | 
					    if (radio.getCtcssToneDetected()) {
 | 
				
			||||||
      if (muted) {
 | 
					      if (muted) {
 | 
				
			||||||
        muted = false;
 | 
					        muted = false;
 | 
				
			||||||
  //      radio.setUnmute();
 | 
					        radio.setUnmute();
 | 
				
			||||||
        Serial.println("tone");
 | 
					        Serial.println("tone");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      if (!muted) {
 | 
					      if (!muted) {
 | 
				
			||||||
        muted = true;
 | 
					        muted = true;
 | 
				
			||||||
  //      radio.setMute();
 | 
					        radio.setMute();
 | 
				
			||||||
        Serial.println("no tone");
 | 
					        Serial.println("no tone");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -139,13 +139,17 @@ void loop() {
 | 
				
			||||||
      // set to transmit
 | 
					      // set to transmit
 | 
				
			||||||
      radio.setModeTransmit();
 | 
					      radio.setModeTransmit();
 | 
				
			||||||
      Serial.println("Tx");
 | 
					      Serial.println("Tx");
 | 
				
			||||||
      //radio.setTxSourceMic();
 | 
					
 | 
				
			||||||
      //radio.setRfPower(1);
 | 
					      radio.setUnmute(); // can't mute during transmit
 | 
				
			||||||
 | 
					      muted = false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else if (currently_tx) {
 | 
					  } else if (currently_tx) {
 | 
				
			||||||
    radio.setModeReceive();
 | 
					    radio.setModeReceive();
 | 
				
			||||||
    currently_tx = false;
 | 
					    currently_tx = false;
 | 
				
			||||||
    Serial.println("Rx");
 | 
					    Serial.println("Rx");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    radio.setMute(); // default to mute during rx
 | 
				
			||||||
 | 
					    muted = true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // handle serial commands
 | 
					  // handle serial commands
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue