Transmit queue and buffers

This commit is contained in:
Mark Qvist 2019-01-29 20:43:46 +01:00
parent 8e836c629c
commit 532e440a3d
5 changed files with 22 additions and 19 deletions

View File

@ -10,7 +10,7 @@
// Voltage references // Voltage references
// TODO: Determine best defaults // TODO: Determine best defaults
#define CONFIG_ADC_REF 128 #define CONFIG_ADC_REF 255
#define CONFIG_DAC_REF 255 #define CONFIG_DAC_REF 255
// TODO: Change this back to default // TODO: Change this back to default
@ -25,9 +25,9 @@
// Serial settings // Serial settings
#define SERIAL_DEBUG false #define SERIAL_DEBUG false
#define TX_MAXWAIT 2UL #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_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_SERIAL_TIMEOUT_MS 10
#define CONFIG_BENCHMARK_MODE false #define CONFIG_BENCHMARK_MODE false
@ -36,7 +36,7 @@
#define CONFIG_CSMA_P 255 #define CONFIG_CSMA_P 255
#define AX25_MIN_FRAME_LEN 1 #define AX25_MIN_FRAME_LEN 1
#define AX25_MAX_FRAME_LEN 1532 #define AX25_MAX_FRAME_LEN 600
// Packet settings // Packet settings
#define CONFIG_PASSALL false #define CONFIG_PASSALL false

View File

@ -40,7 +40,7 @@ inline static uint8_t sinSample(uint16_t i) {
#define CPU_FREQ F_CPU #define CPU_FREQ F_CPU
#define BITRATE 1200 #define BITRATE 2400
#if BITRATE == 300 #if BITRATE == 300
#define CONFIG_ADC_SAMPLERATE 9600UL #define CONFIG_ADC_SAMPLERATE 9600UL

View File

@ -15,5 +15,3 @@ bool bluetooth_enabled(void);
#endif #endif
// CMD/DATA sequence: 0x2b2b2b0d

View File

@ -2,6 +2,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
extern volatile uint8_t queue_height;
void serial_init(Serial *serial) { void serial_init(Serial *serial) {
memset(serial, 0, sizeof(*serial)); memset(serial, 0, sizeof(*serial));
memset(serialBuf, 0, sizeof(serialBuf)); memset(serialBuf, 0, sizeof(serialBuf));
@ -47,8 +49,19 @@ char uart0_getchar_nowait(void) {
ISR(USART0_RX_vect) { ISR(USART0_RX_vect) {
if (serial_available(0)) { if (serial_available(0)) {
LED_COM_ON(); LED_COM_ON();
if (!fifo_isfull(&serialFIFO)) {
char c = uart0_getchar_nowait(); char c = uart0_getchar_nowait();
fifo_push(&serialFIFO, c); 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();
}
}
} }
} }

View File

@ -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) { void kiss_serialCallback(uint8_t sbyte) {
if (IN_FRAME && sbyte == FEND && command == CMD_DATA) { if (IN_FRAME && sbyte == FEND && command == CMD_DATA) {
IN_FRAME = false; IN_FRAME = false;
@ -184,7 +176,7 @@ void kiss_serialCallback(uint8_t sbyte) {
fifo16_push_locked(&packet_lengths, l); fifo16_push_locked(&packet_lengths, l);
current_packet_start = queue_cursor; 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) { } else if (sbyte == FEND) {