master
jacob.eva 2 weeks ago
parent accb5d907c
commit 1d62fdd52e
No known key found for this signature in database
GPG Key ID: B92E083BBCCAA1E
  1. 22
      RNode_Firmware_CE.ino

@ -659,10 +659,10 @@ void flush_queue(RadioInterface* radio) {
} }
queue_flushing = false;
queue_height[index] = 0; queue_height[index] = 0;
queued_bytes[index] = 0; queued_bytes[index] = 0;
selected_radio->updateAirtime(); radio->updateAirtime();
queue_flushing = false;
#if HAS_DISPLAY #if HAS_DISPLAY
display_tx[radio->getIndex()] = true; display_tx[radio->getIndex()] = true;
@ -675,11 +675,7 @@ void pop_queue(RadioInterface* radio) {
queue_flushing = true; queue_flushing = true;
led_tx_on(); uint16_t processed = 0; led_tx_on(); uint16_t processed = 0;
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
if (!fifo16_isempty(&packet_starts[index])) { if (!fifo16_isempty(&packet_starts[index])) {
#else
if (!fifo16_isempty_locked(&packet_starts[index])) {
#endif
uint16_t start = fifo16_pop(&packet_starts[index]); uint16_t start = fifo16_pop(&packet_starts[index]);
uint16_t length = fifo16_pop(&packet_lengths[index]); uint16_t length = fifo16_pop(&packet_lengths[index]);
@ -691,6 +687,7 @@ void pop_queue(RadioInterface* radio) {
transmit(radio, length); processed++; transmit(radio, length); processed++;
} }
queue_height[index] -= processed; queue_height[index] -= processed;
queued_bytes[index] -= length; queued_bytes[index] -= length;
} }
@ -705,6 +702,7 @@ void pop_queue(RadioInterface* radio) {
#if HAS_DISPLAY #if HAS_DISPLAY
display_tx[radio->getIndex()] = true; display_tx[radio->getIndex()] = true;
#endif #endif
} }
void transmit(RadioInterface* radio, uint16_t size) { void transmit(RadioInterface* radio, uint16_t size) {
@ -728,8 +726,15 @@ void transmit(RadioInterface* radio, uint16_t size) {
// Only start a new packet if this is a split packet and it has // Only start a new packet if this is a split packet and it has
// exceeded the length of a single packet // exceeded the length of a single packet
if (written == 255 && header & 0x0F) { if (written == 255 && isSplitPacket(header)) {
radio->endPacket(); radio->addAirtime(); if (!radio->endPacket()) {
kiss_indicate_error(ERROR_MODEM_TIMEOUT);
kiss_indicate_error(ERROR_TXFAILED);
led_indicate_error(5);
hard_reset();
}
radio->addAirtime();
radio->beginPacket(); radio->beginPacket();
radio->write(header); radio->write(header);
written = 1; written = 1;
@ -876,6 +881,7 @@ void serial_callback(uint8_t sbyte) {
if (frame_len < CMD_L) cmdbuf[frame_len++] = sbyte; if (frame_len < CMD_L) cmdbuf[frame_len++] = sbyte;
} }
if (frame_len == 4) { if (frame_len == 4) {
selected_radio = interface_obj[interface]; selected_radio = interface_obj[interface];
uint32_t bw = (uint32_t)cmdbuf[0] << 24 | (uint32_t)cmdbuf[1] << 16 | (uint32_t)cmdbuf[2] << 8 | (uint32_t)cmdbuf[3]; uint32_t bw = (uint32_t)cmdbuf[0] << 24 | (uint32_t)cmdbuf[1] << 16 | (uint32_t)cmdbuf[2] << 8 | (uint32_t)cmdbuf[3];

Loading…
Cancel
Save