1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-268 Uncrustified.

This commit is contained in:
Vladimir Zidar 2016-03-25 11:23:06 +01:00
parent 4159449021
commit 8c1b008da1
3 changed files with 17 additions and 17 deletions

View File

@ -112,8 +112,8 @@ static void systemTask(__attribute__((unused)) void *parameters)
portTickType lastSysTime;
uint16_t prev_tx_count = 0;
uint16_t prev_rx_count = 0;
uint16_t prev_tx_seq = 0;
uint16_t prev_rx_seq = 0;
uint16_t prev_tx_seq = 0;
uint16_t prev_rx_seq = 0;
bool first_time = true;
while (!initTaskDone) {
@ -172,20 +172,20 @@ static void systemTask(__attribute__((unused)) void *parameters)
if (first_time) {
first_time = false;
} else {
uint16_t tx_count = radio_stats.tx_byte_count;
uint16_t rx_count = radio_stats.rx_byte_count;
uint16_t tx_count = radio_stats.tx_byte_count;
uint16_t rx_count = radio_stats.rx_byte_count;
uint16_t tx_packets = radio_stats.tx_seq - prev_tx_seq;
uint16_t rx_packets = radio_stats.rx_seq - prev_rx_seq;
uint16_t tx_bytes = (tx_count < prev_tx_count) ? (0xffff - prev_tx_count + tx_count) : (tx_count - prev_tx_count);
uint16_t rx_bytes = (rx_count < prev_rx_count) ? (0xffff - prev_rx_count + rx_count) : (rx_count - prev_rx_count);
uint16_t tx_bytes = (tx_count < prev_tx_count) ? (0xffff - prev_tx_count + tx_count) : (tx_count - prev_tx_count);
uint16_t rx_bytes = (rx_count < prev_rx_count) ? (0xffff - prev_rx_count + rx_count) : (rx_count - prev_rx_count);
oplinkStatus.TXRate = (uint16_t)((float)(tx_bytes * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.RXRate = (uint16_t)((float)(rx_bytes * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.TXPacketRate = (uint16_t)((float)(tx_packets * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.RXPacketRate = (uint16_t)((float)(rx_packets * 1000) / SYSTEM_UPDATE_PERIOD_MS);
prev_tx_count = tx_count;
prev_rx_count = rx_count;
prev_tx_seq = radio_stats.tx_seq;
prev_rx_seq = radio_stats.rx_seq;
prev_tx_seq = radio_stats.tx_seq;
prev_rx_seq = radio_stats.rx_seq;
}
oplinkStatus.TXSeq = radio_stats.tx_seq;
oplinkStatus.RXSeq = radio_stats.rx_seq;

View File

@ -279,8 +279,8 @@ static void systemTask(__attribute__((unused)) void *parameters)
static bool first_time = true;
static uint16_t prev_tx_count = 0;
static uint16_t prev_rx_count = 0;
static uint16_t prev_tx_seq = 0;
static uint16_t prev_rx_seq = 0;
static uint16_t prev_tx_seq = 0;
static uint16_t prev_rx_seq = 0;
oplinkStatus.HeapRemaining = xPortGetFreeHeapSize();
oplinkStatus.DeviceID = PIOS_RFM22B_DeviceID(pios_rfm22b_id);
@ -298,20 +298,20 @@ static void systemTask(__attribute__((unused)) void *parameters)
if (first_time) {
first_time = false;
} else {
uint16_t tx_count = radio_stats.tx_byte_count;
uint16_t rx_count = radio_stats.rx_byte_count;
uint16_t tx_count = radio_stats.tx_byte_count;
uint16_t rx_count = radio_stats.rx_byte_count;
uint16_t tx_packets = radio_stats.tx_seq - prev_tx_seq;
uint16_t rx_packets = radio_stats.rx_seq - prev_rx_seq;
uint16_t tx_bytes = (tx_count < prev_tx_count) ? (0xffff - prev_tx_count + tx_count) : (tx_count - prev_tx_count);
uint16_t rx_bytes = (rx_count < prev_rx_count) ? (0xffff - prev_rx_count + rx_count) : (rx_count - prev_rx_count);
uint16_t tx_bytes = (tx_count < prev_tx_count) ? (0xffff - prev_tx_count + tx_count) : (tx_count - prev_tx_count);
uint16_t rx_bytes = (rx_count < prev_rx_count) ? (0xffff - prev_rx_count + rx_count) : (rx_count - prev_rx_count);
oplinkStatus.TXRate = (uint16_t)((float)(tx_bytes * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.RXRate = (uint16_t)((float)(rx_bytes * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.TXPacketRate = (uint16_t)((float)(tx_packets * 1000) / SYSTEM_UPDATE_PERIOD_MS);
oplinkStatus.RXPacketRate = (uint16_t)((float)(rx_packets * 1000) / SYSTEM_UPDATE_PERIOD_MS);
prev_tx_count = tx_count;
prev_rx_count = rx_count;
prev_tx_seq = radio_stats.tx_seq;
prev_rx_seq = radio_stats.rx_seq;
prev_tx_seq = radio_stats.tx_seq;
prev_rx_seq = radio_stats.rx_seq;
}
oplinkStatus.TXSeq = radio_stats.tx_seq;
oplinkStatus.RXSeq = radio_stats.rx_seq;

View File

@ -1993,7 +1993,7 @@ static enum pios_radio_event radio_receivePacket(struct pios_rfm22b_dev *radio_d
// We couldn't correct the error, so drop the packet.
rfm22b_add_rx_status(radio_dev, RADIO_ERROR_RX_PACKET);
}
// Increment the packet sequence number.
radio_dev->stats.rx_seq++;