Cleanup on AFSK-PacketTester example, verified working with current library and hardware v09
This commit is contained in:
		
							parent
							
								
									75e964289c
								
							
						
					
					
						commit
						868882f81e
					
				| 
						 | 
					@ -4,7 +4,6 @@
 | 
				
			||||||
 *  
 | 
					 *  
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#define DDS_REFCLK_DEFAULT 9600
 | 
					#define DDS_REFCLK_DEFAULT 9600
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <HamShield.h>
 | 
					#include <HamShield.h>
 | 
				
			||||||
| 
						 | 
					@ -14,7 +13,6 @@
 | 
				
			||||||
#define RESET_PIN A3
 | 
					#define RESET_PIN A3
 | 
				
			||||||
#define SWITCH_PIN 2
 | 
					#define SWITCH_PIN 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
HamShield radio;
 | 
					HamShield radio;
 | 
				
			||||||
DDS dds;
 | 
					DDS dds;
 | 
				
			||||||
String messagebuff = "";
 | 
					String messagebuff = "";
 | 
				
			||||||
| 
						 | 
					@ -47,16 +45,12 @@ void setup() {
 | 
				
			||||||
  Serial.println("HELLO");
 | 
					  Serial.println("HELLO");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
String temp[1] = "";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void loop() {
 | 
					void loop() {
 | 
				
			||||||
  messagebuff = "KC7IBT,KC7IBT,:HAMSHIELD TEST";
 | 
					  messagebuff = "KC7IBT,KC7IBT,:HAMSHIELD TEST";
 | 
				
			||||||
  prepMessage();
 | 
					  prepMessage();
 | 
				
			||||||
  delay(10000);
 | 
					  delay(10000);
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
void prepMessage() { 
 | 
					void prepMessage() { 
 | 
				
			||||||
  radio.setModeTransmit();
 | 
					  radio.setModeTransmit();
 | 
				
			||||||
  delay(500);
 | 
					  delay(500);
 | 
				
			||||||
| 
						 | 
					@ -76,7 +70,6 @@ void prepMessage() {
 | 
				
			||||||
  packet->print(textmessage);
 | 
					  packet->print(textmessage);
 | 
				
			||||||
  packet->finish();
 | 
					  packet->finish();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  bool ret = radio.afsk.putTXPacket(packet);
 | 
					  bool ret = radio.afsk.putTXPacket(packet);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(radio.afsk.txReady()) {
 | 
					  if(radio.afsk.txReady()) {
 | 
				
			||||||
| 
						 | 
					@ -99,18 +92,14 @@ void prepMessage() {
 | 
				
			||||||
    delay(50);
 | 
					    delay(50);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  Serial.println("Done sending");
 | 
					  Serial.println("Done sending");
 | 
				
			||||||
    delay(3000);
 | 
					 | 
				
			||||||
  radio.setModeReceive();
 | 
					  radio.setModeReceive();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
ISR(TIMER2_OVF_vect) {
 | 
					ISR(TIMER2_OVF_vect) {
 | 
				
			||||||
  TIFR2 = _BV(TOV2);
 | 
					  TIFR2 = _BV(TOV2);
 | 
				
			||||||
  static uint8_t tcnt = 0;
 | 
					  static uint8_t tcnt = 0;
 | 
				
			||||||
  if(++tcnt == 8) {
 | 
					  if(++tcnt == 8) {
 | 
				
			||||||
  digitalWrite(2, HIGH);
 | 
					 | 
				
			||||||
    dds.clockTick();
 | 
					    dds.clockTick();
 | 
				
			||||||
  digitalWrite(2, LOW);
 | 
					 | 
				
			||||||
    tcnt = 0;
 | 
					    tcnt = 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -118,7 +107,6 @@ ISR(TIMER2_OVF_vect) {
 | 
				
			||||||
ISR(ADC_vect) {
 | 
					ISR(ADC_vect) {
 | 
				
			||||||
  static uint8_t tcnt = 0;
 | 
					  static uint8_t tcnt = 0;
 | 
				
			||||||
  TIFR1 = _BV(ICF1); // Clear the timer flag
 | 
					  TIFR1 = _BV(ICF1); // Clear the timer flag
 | 
				
			||||||
  PORTD |= _BV(2); // Diagnostic pin (D2)
 | 
					 | 
				
			||||||
  dds.clockTick();
 | 
					  dds.clockTick();
 | 
				
			||||||
  if(++tcnt == 1) {
 | 
					  if(++tcnt == 1) {
 | 
				
			||||||
    if(radio.afsk.encoder.isSending()) {
 | 
					    if(radio.afsk.encoder.isSending()) {
 | 
				
			||||||
| 
						 | 
					@ -126,7 +114,4 @@ ISR(ADC_vect) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    tcnt = 0;
 | 
					    tcnt = 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  PORTD &= ~(_BV(2)); // Pin D2 off again
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue