diff --git a/device.h b/device.h index 19907e0..3c4bd47 100755 --- a/device.h +++ b/device.h @@ -10,7 +10,7 @@ // Voltage references // TODO: Determine best defaults -#define CONFIG_ADC_REF 128 +#define CONFIG_ADC_REF 255 #define CONFIG_DAC_REF 255 // TODO: Change this back to default @@ -25,9 +25,9 @@ // Serial settings #define SERIAL_DEBUG false #define TX_MAXWAIT 2UL -#define CONFIG_QUEUE_SIZE 3000 // TODO: Optimise this by saving ram other places, add SD queue +#define CONFIG_QUEUE_SIZE 6000 // TODO: Optimise this by saving ram other places, add SD queue #define CONFIG_QUEUE_MAX_LENGTH 15 -#define CONFIG_SERIAL_BUFFER_SIZE 1532 // TODO: Tune this, what is actually required? +#define CONFIG_SERIAL_BUFFER_SIZE 1536 // TODO: Tune this, what is actually required? #define CONFIG_SERIAL_TIMEOUT_MS 10 #define CONFIG_BENCHMARK_MODE false @@ -36,7 +36,7 @@ #define CONFIG_CSMA_P 255 #define AX25_MIN_FRAME_LEN 1 -#define AX25_MAX_FRAME_LEN 1532 +#define AX25_MAX_FRAME_LEN 600 // Packet settings #define CONFIG_PASSALL false diff --git a/hardware/AFSK.h b/hardware/AFSK.h index acdb065..5c6fae3 100755 --- a/hardware/AFSK.h +++ b/hardware/AFSK.h @@ -40,7 +40,7 @@ inline static uint8_t sinSample(uint16_t i) { #define CPU_FREQ F_CPU -#define BITRATE 1200 +#define BITRATE 2400 #if BITRATE == 300 #define CONFIG_ADC_SAMPLERATE 9600UL diff --git a/hardware/Bluetooth.h b/hardware/Bluetooth.h index 8cc3dd7..05841e2 100644 --- a/hardware/Bluetooth.h +++ b/hardware/Bluetooth.h @@ -14,6 +14,4 @@ void bluetooth_init(void); bool bluetooth_enabled(void); -#endif - -// CMD/DATA sequence: 0x2b2b2b0d +#endif \ No newline at end of file diff --git a/hardware/Serial.c b/hardware/Serial.c index 7dc417c..b94406d 100755 --- a/hardware/Serial.c +++ b/hardware/Serial.c @@ -2,6 +2,8 @@ #include #include +extern volatile uint8_t queue_height; + void serial_init(Serial *serial) { memset(serial, 0, sizeof(*serial)); memset(serialBuf, 0, sizeof(serialBuf)); @@ -47,8 +49,19 @@ char uart0_getchar_nowait(void) { ISR(USART0_RX_vect) { if (serial_available(0)) { LED_COM_ON(); - char c = uart0_getchar_nowait(); - fifo_push(&serialFIFO, c); + if (!fifo_isfull(&serialFIFO)) { + char c = uart0_getchar_nowait(); + fifo_push(&serialFIFO, c); + } else { + // TODO: Remove this + printf("SERIAL FIFO OVERRUN\r\n"); + printf("QH: %d", queue_height); + while(true) { + LED_TX_ON(); + LED_RX_ON(); + LED_COM_ON(); + } + } } } diff --git a/protocol/KISS.c b/protocol/KISS.c index 55fa59e..3210c16 100755 --- a/protocol/KISS.c +++ b/protocol/KISS.c @@ -162,14 +162,6 @@ void kiss_flushQueue(void) { } } -uint8_t kiss_queuedPackets(void) { - return 0; -} - -bool kiss_queueIsFull(void) { - return false; -} - void kiss_serialCallback(uint8_t sbyte) { if (IN_FRAME && sbyte == FEND && command == CMD_DATA) { IN_FRAME = false; @@ -184,7 +176,7 @@ void kiss_serialCallback(uint8_t sbyte) { fifo16_push_locked(&packet_lengths, l); current_packet_start = queue_cursor; - //printf("Queue height %d\r\n", queue_height); + printf("Queue height %d\r\n", queue_height); } } else if (sbyte == FEND) {