Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Firmware/radio/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ radio_transmit_simple(__data uint8_t length, __xdata uint8_t * __pdata buf, __pd
// it seems that this gives us an occasional
// fifo overflow error, so put in just 4 bytes
// at a time
n = 4;
n = 1;
if (n > length) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the n = 1 assignment, it looks like this "if" statement is rendered ineffective: length != 0 at this point, so n will always be less than or equal to length. Similarly at line 359.

n = length;
}
Expand All @@ -355,7 +355,7 @@ radio_transmit_simple(__data uint8_t length, __xdata uint8_t * __pdata buf, __pd
// the FIFO is below the high threshold. See
// comment above on how many bytes we add to
// the FIFO
n = 4;
n = 1;
if (n > length) {
n = length;
}
Expand Down
41 changes: 22 additions & 19 deletions Firmware/radio/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,24 +462,27 @@ serial_device_valid_speed(register uint8_t speed)
static
void serial_device_set_speed(register uint8_t speed)
{
uint8_t i;
uint8_t num_rates = ARRAY_LENGTH(serial_rates);

for (i = 0; i < num_rates; i++) {
if (speed == serial_rates[i].rate) {
break;
}
}
if (i == num_rates) {
i = 3; // 57600 default
}

// set the rates in the UART
TH1 = serial_rates[i].th1;
CKCON = (CKCON & ~0x0b) | serial_rates[i].ckcon;

// tell the packet layer how fast the serial link is. This is
// needed for packet framing timeouts
packet_set_serial_speed(speed*125UL);
uint8_t i;
bool valid_speed = false;
uint8_t num_rates = ARRAY_LENGTH(serial_rates);

for (i = 0; i < num_rates; i++) {
if (speed == serial_rates[i].rate) {
valid_speed = true;
break;
}
}
if (! valid_speed) {
i = 6; // 57600 default
speed = serial_rates[i].rate;
}

// set the rates in the UART
TH1 = serial_rates[i].th1;
CKCON = (CKCON & ~0x0b) | serial_rates[i].ckcon;

// tell the packet layer how fast the serial link is. This is
// needed for packet framing timeouts
packet_set_serial_speed(speed*125UL);
}