diff --git a/Modem/afsk.c b/Modem/afsk.c index 423798d..43fc930 100644 --- a/Modem/afsk.c +++ b/Modem/afsk.c @@ -93,7 +93,7 @@ INLINE uint8_t sinSample(uint16_t i) { #define PHASE_BITS 8 // How much to increment phase counter each sample #define PHASE_INC 1 // Nudge by an eigth of a sample each adjustment #define PHASE_MAX (SAMPLESPERBIT * PHASE_BITS) // Resolution of our phase counter = 64 -#define PHASE_THRESHOLD (PHASE_MAX / 4) // Target transition point of our phase window +#define PHASE_THRESHOLD (PHASE_MAX / 2) // Target transition point of our phase window // Modulation constants #define MARK_FREQ 1200 // The tone frequency signifying a binary one @@ -373,24 +373,24 @@ void afsk_adc_isr(Afsk *afsk, int8_t currentSample) { // more 1's, we will assume that the transmitter // sent us a one, otherwise we assume a zero - uint8_t bits = afsk->sampledBits & 0x0f; - uint8_t c = 0; - c += bits & BV(1); - c += bits & BV(2); - c += bits & BV(3); - c += bits & BV(4); - c += bits & BV(5); - if (c >= 3) afsk->actualBits |= 1; + // uint8_t bits = afsk->sampledBits & 0x0f; + // uint8_t c = 0; + // c += bits & BV(1); + // c += bits & BV(2); + // c += bits & BV(3); + // c += bits & BV(4); + // c += bits & BV(5); + // if (c >= 3) afsk->actualBits |= 1; //// Alternative using only three bits ////////// - // uint8_t bits = afsk->sampledBits & 0x07; - // if (bits == 0x07 || // 111 - // bits == 0x06 || // 110 - // bits == 0x05 || // 101 - // bits == 0x03 // 011 - // ) { - // afsk->actualBits |= 1; - // } + uint8_t bits = afsk->sampledBits & 0x07; + if (bits == 0x07 || // 111 + bits == 0x06 || // 110 + bits == 0x05 || // 101 + bits == 0x03 // 011 + ) { + afsk->actualBits |= 1; + } ///////////////////////////////////////////////// // Now we can pass the actual bit to the HDLC parser. diff --git a/Modem/hardware.c b/Modem/hardware.c index 2c835e8..1102b85 100644 --- a/Modem/hardware.c +++ b/Modem/hardware.c @@ -67,7 +67,6 @@ void hw_afsk_adcInit(int ch, Afsk *_modem) // temperature variations, but if you have a board with a // crystal that is way off frequency, this can help alot. ICR1 = (((CPU_FREQ+FREQUENCY_CORRECTION)) / 9600) - 1; - kprintf("ICR1=%d",ICR1); // Set reference to AVCC (5V), select pin // Set the ADMUX register. The first part (BV(REFS0)) sets diff --git a/buildrev.h b/buildrev.h index 9471583..75e6e0a 100644 --- a/buildrev.h +++ b/buildrev.h @@ -1,2 +1,2 @@ -#define VERS_BUILD 549 +#define VERS_BUILD 577 #define VERS_HOST "vixen"