1
0
mirror of https://github.com/peterantypas/maiana.git synced 2025-05-17 07:50:10 -07:00

RXPacket pool

This commit is contained in:
Peter Antypas 2020-11-02 20:05:15 -08:00
parent a7f1524689
commit c8aa111d0f
19 changed files with 154 additions and 76 deletions

View File

@ -903,6 +903,8 @@
<listOptionValue builtIn="false" value="STM32L412xx"/> <listOptionValue builtIn="false" value="STM32L412xx"/>
<listOptionValue builtIn="false" value="DEBUG"/>
</option> </option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting.1148532259" name="Generate assembler listing (-Wa,-adhlns=&quot;$@.lst&quot;)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting.1148532259" name="Generate assembler listing (-Wa,-adhlns=&quot;$@.lst&quot;)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -943,6 +945,8 @@
<listOptionValue builtIn="false" value="STM32L412xx"/> <listOptionValue builtIn="false" value="STM32L412xx"/>
<listOptionValue builtIn="false" value="DEBUG"/>
</option> </option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting.1222462616" name="Generate assembler listing (-Wa,-adhlns=&quot;$@.lst&quot;)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting.1222462616" name="Generate assembler listing (-Wa,-adhlns=&quot;$@.lst&quot;)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>

View File

@ -59,7 +59,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1852595269257746636" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1840966946621754188" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>

View File

@ -22,9 +22,9 @@
#define CIRCULARQUEUE_HPP_ #define CIRCULARQUEUE_HPP_
#include <stddef.h>
#include "_assert.h" #include "_assert.h"
template<typename T> class CircularQueue template<typename T> class CircularQueue
{ {
public: public:
@ -35,7 +35,7 @@ public:
mWritePosition = 0; mWritePosition = 0;
mSize = size; mSize = size;
mBuffer = new T[mSize]; mBuffer = new T[mSize];
ASSERT(mBuffer); ASSERT_VALID_PTR(mBuffer);
} }
inline bool empty() inline bool empty()
@ -77,7 +77,7 @@ private:
volatile int mReadPosition; volatile int mReadPosition;
volatile int mWritePosition; volatile int mWritePosition;
size_t mSize; size_t mSize;
volatile T* mBuffer; volatile T* mBuffer = nullptr;
}; };
#endif /* CIRCULARQUEUE_HPP_ */ #endif /* CIRCULARQUEUE_HPP_ */

View File

@ -27,6 +27,7 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "queue.h" #include "queue.h"
using namespace std; using namespace std;
class EventQueue class EventQueue

View File

@ -29,6 +29,7 @@
#include "RXPacket.hpp" #include "RXPacket.hpp"
#include "ObjectPool.hpp" #include "ObjectPool.hpp"
#include "AISChannels.h" #include "AISChannels.h"
//#include "RadioManager.hpp"
using namespace std; using namespace std;
@ -67,23 +68,27 @@ typedef struct {
uint8_t rssi; uint8_t rssi;
} RSSISample; } RSSISample;
class Event class Event
{ {
public: public:
EventType type; EventType type;
uint32_t flags; uint32_t flags;
Event() Event();
: type(UNKNOWN_EVENT), flags(0) {
}
#if 0
Event(EventType t) Event(EventType t)
: type(t), flags(0) : type(t), flags(0), rxPacket(nullptr)
{ {
} }
#endif
RXPacket rxPacket;
void reset();
// This is an object, so it can't be a member of the union ...
RXPacket *rxPacket;
union { union {
NMEABuffer nmeaBuffer; NMEABuffer nmeaBuffer;
@ -108,7 +113,7 @@ public:
virtual void processEvent(const Event &event)=0; virtual void processEvent(const Event &event)=0;
}; };
#if 1
class EventPool class EventPool
{ {
public: public:
@ -119,11 +124,15 @@ public:
void deleteEvent(Event *event); void deleteEvent(Event *event);
uint32_t utilization(); uint32_t utilization();
uint32_t maxUtilization(); uint32_t maxUtilization();
RXPacket *newRXPacket();
void releaseRXPacket(RXPacket *);
private:
EventPool();
private: private:
ObjectPool<Event> *mISRPool; ObjectPool<Event> mISRPool;
ObjectPool<Event> *mThreadPool; ObjectPool<Event> mThreadPool;
ObjectPool<RXPacket> mRXPool;
}; };
#endif
#endif /* EVENTS_HPP_ */ #endif /* EVENTS_HPP_ */

View File

@ -64,7 +64,7 @@
#define configTICK_RATE_HZ ((TickType_t)1000) #define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES ( 7 ) #define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)20480) #define configTOTAL_HEAP_SIZE ((size_t)22480)
#define configMAX_TASK_NAME_LEN ( 16 ) #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 0 #define configUSE_MUTEXES 0

View File

@ -41,11 +41,13 @@ public:
mUtilization = 0; mUtilization = 0;
mMaxUtilization = 0; mMaxUtilization = 0;
//printf_serial_now("ObjectPool @%p\r\n", this);
for ( uint32_t i = 0; i < mSize; ++i ) for ( uint32_t i = 0; i < mSize; ++i )
{ {
T *p = new T(); T *p = new T();
ASSERT(p); ASSERT_VALID_PTR(p);
mQueue.push(p); mQueue.push(p);
//printf_serial_now("\t@%p\r\n", p);
} }
} }
@ -61,7 +63,6 @@ public:
mQueue.push(o); mQueue.push(o);
} }
uint32_t maxUtilization() uint32_t maxUtilization()
{ {
return mMaxUtilization; return mMaxUtilization;

View File

@ -25,6 +25,8 @@
#include "_assert.h" #include "_assert.h"
#include "AISChannels.h" #include "AISChannels.h"
#include "config.h" #include "config.h"
#include "ObjectPool.hpp"
using namespace std; using namespace std;

View File

@ -30,7 +30,7 @@
#include "AISChannels.h" #include "AISChannels.h"
class RadioManager : public GPSDelegate, public EventConsumer class RadioManager : public GPSDelegate, EventConsumer
{ {
public: public:
static RadioManager &instance(); static RadioManager &instance();
@ -49,7 +49,6 @@ public:
void transmitCW(VHFChannel channel); void transmitCW(VHFChannel channel);
VHFChannel alternateChannel(VHFChannel channel); VHFChannel alternateChannel(VHFChannel channel);
private: private:
RadioManager(); RadioManager();
void spiOff(); void spiOff();
@ -58,9 +57,9 @@ private:
Transceiver *mTransceiverIC; Transceiver *mTransceiverIC;
Receiver *mReceiverIC; Receiver *mReceiverIC;
bool mInitializing; bool mInitializing;
CircularQueue<TXPacket*> *mTXQueue;
time_t mUTC; time_t mUTC;
CircularQueue<TXPacket*> mTXQueue;
}; };
#endif /* RADIOMANAGER_HPP_ */ #endif /* RADIOMANAGER_HPP_ */

View File

@ -57,7 +57,7 @@ protected:
void processNRZIBit(uint8_t level); void processNRZIBit(uint8_t level);
virtual void configureGPIOsForRX(); virtual void configureGPIOsForRX();
protected: protected:
RXPacket mRXPacket; RXPacket *mRXPacket = nullptr;
uint16_t mBitWindow; uint16_t mBitWindow;
uint8_t mLastNRZIBit; uint8_t mLastNRZIBit;
uint32_t mBitCount; uint32_t mBitCount;

View File

@ -23,10 +23,10 @@
#include "Receiver.hpp" #include "Receiver.hpp"
#include "TXPacket.hpp" #include "TXPacket.hpp"
#include "EventQueue.hpp" #include "Events.hpp"
#include <map> #include <map>
class Transceiver : public Receiver, EventConsumer class Transceiver : public Receiver, public EventConsumer
{ {
public: public:
Transceiver(GPIO_TypeDef *sdnPort, Transceiver(GPIO_TypeDef *sdnPort,

View File

@ -20,16 +20,18 @@
#ifndef ASSERT_H_ #ifndef ASSERT_H_
#define ASSERT_H_ #define ASSERT_H_
#include <cassert>
#include "config.h"
#include "printf_serial.h"
#if DEV_MODE #ifdef DEBUG
#define ASSERT(b) if (!(b)) {assert_failed((uint8_t*)__FILE__, (uint32_t)__LINE__); } #define ASSERT(b) if (!(b)) {asm("bkpt 0");}
#else #else
#define ASSERT(b) assert(b); #define ASSERT(b)
#endif
#ifdef DEBUG
#define ASSERT_VALID_PTR(p) ASSERT((uint32_t)p >= 0x20000000 && (uint32_t)p <= 0x20009FFF)
#else
#define ASSERT_VALID_PTR(p)
#endif #endif

View File

@ -21,17 +21,52 @@
#include "Events.hpp" #include "Events.hpp"
#include "printf_serial.h" #include "printf_serial.h"
#if 1
///////////////////////////////////////////////////////////////////////////////
//
// Event
//
///////////////////////////////////////////////////////////////////////////////
Event::Event()
: type(UNKNOWN_EVENT), flags(0), rxPacket(nullptr)
{
}
void Event::reset()
{
if ( rxPacket )
{
ASSERT_VALID_PTR(rxPacket);
EventPool::instance().releaseRXPacket(rxPacket);
}
rxPacket = nullptr;
type = UNKNOWN_EVENT;
}
///////////////////////////////////////////////////////////////////////////////
//
// EventPool
//
///////////////////////////////////////////////////////////////////////////////
EventPool &EventPool::instance() EventPool &EventPool::instance()
{ {
static EventPool __instance; static EventPool __instance;
return __instance; return __instance;
} }
EventPool::EventPool()
: mISRPool(25), mThreadPool(10), mRXPool(20)
{
}
void EventPool::init() void EventPool::init()
{ {
mISRPool = new ObjectPool<Event>(25);
mThreadPool = new ObjectPool<Event>(10);
} }
Event *EventPool::newEvent(EventType type) Event *EventPool::newEvent(EventType type)
@ -39,20 +74,22 @@ Event *EventPool::newEvent(EventType type)
Event *result = nullptr; Event *result = nullptr;
if ( Utils::inISR() ) if ( Utils::inISR() )
{ {
result = mISRPool->get(); result = mISRPool.get();
if ( result ) if ( result )
{ {
result->type = type; result->type = type;
result->flags = 1; result->flags = 1;
ASSERT(!result->rxPacket);
} }
} }
else else
{ {
result = mThreadPool->get(); result = mThreadPool.get();
if ( result ) if ( result )
{ {
result->type = type; result->type = type;
result->flags = 0; result->flags = 0;
ASSERT(!result->rxPacket);
} }
} }
@ -60,25 +97,43 @@ Event *EventPool::newEvent(EventType type)
//if ( !result) //if ( !result)
//printf2_now("\r\n[DEBUG]newEvent(0x%.8x) failed\r\n", type); //printf2_now("\r\n[DEBUG]newEvent(0x%.8x) failed\r\n", type);
if ( result == nullptr )
return result;
ASSERT_VALID_PTR(result);
return result; return result;
} }
void EventPool::deleteEvent(Event *event) void EventPool::deleteEvent(Event *event)
{ {
ASSERT(event); ASSERT_VALID_PTR(event);
event->reset();
if ( event->flags ) if ( event->flags )
mISRPool->put(event); mISRPool.put(event);
else else
mThreadPool->put(event); mThreadPool.put(event);
} }
uint32_t EventPool::maxUtilization() uint32_t EventPool::maxUtilization()
{ {
return std::max(mISRPool->maxUtilization(), mThreadPool->maxUtilization()); return std::max(mISRPool.maxUtilization(), mThreadPool.maxUtilization());
} }
uint32_t EventPool::utilization() uint32_t EventPool::utilization()
{ {
return std::max(mISRPool->utilization(), mThreadPool->utilization()); return std::max(mISRPool.utilization(), mThreadPool.utilization());
} }
#endif
RXPacket *EventPool::newRXPacket()
{
RXPacket *p = mRXPool.get();
ASSERT_VALID_PTR(p);
return p;
}
void EventPool::releaseRXPacket(RXPacket *packet)
{
ASSERT_VALID_PTR(packet);
mRXPool.put(packet);
}

View File

@ -182,15 +182,14 @@ void GPS::onPPS()
void GPS::processEvent(const Event &event) void GPS::processEvent(const Event &event)
{ {
//printf2("-> GPS::processEvent()\r\n");
processLine(event.nmeaBuffer.sentence); processLine(event.nmeaBuffer.sentence);
//printf2("<- GPS::processEvent()\r\n"); ASSERT(event.rxPacket == nullptr);
} }
void GPS::processLine(const char* buff) void GPS::processLine(const char* buff)
{ {
if ( buff[0] == '$' && buff[1] != '$' ) { if ( buff[0] == '$' && buff[1] != '$' )
{
unsigned reportedHash; unsigned reportedHash;
char *starPos = strstr(buff, "*"); char *starPos = strstr(buff, "*");
if ( starPos && sscanf(starPos + 1, "%x", &reportedHash) == 1 ) if ( starPos && sscanf(starPos + 1, "%x", &reportedHash) == 1 )

View File

@ -15,11 +15,13 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/> along with this program. If not, see <https://www.gnu.org/licenses/>
*/ */
#include <stdio.h> #include <stdio.h>
#include "_assert.h"
#include "config.h" #include "config.h"
#include "RadioManager.hpp"
#include "RXPacketProcessor.hpp" #include "RXPacketProcessor.hpp"
#include "AISMessages.hpp" #include "AISMessages.hpp"
#include "DataTerminal.hpp" #include "DataTerminal.hpp"
@ -51,13 +53,14 @@ void RXPacketProcessor::processEvent(const Event &e)
{ {
case AIS_PACKET_EVENT: case AIS_PACKET_EVENT:
{ {
if (e.rxPacket.isBad() || !e.rxPacket.checkCRC ()) ASSERT(e.rxPacket);
if (e.rxPacket->isBad() || !e.rxPacket->checkCRC ())
return; return;
if ( e.rxPacket.messageType() == 15 ) if ( e.rxPacket->messageType() == 15 )
{ {
AISMessage15 msg; AISMessage15 msg;
if ( msg.decode(e.rxPacket) ) if ( msg.decode(*e.rxPacket) )
{ {
// Make sure we actually can transmit something // Make sure we actually can transmit something
if ( mStationData.magic != STATION_DATA_MAGIC ) if ( mStationData.magic != STATION_DATA_MAGIC )
@ -100,9 +103,8 @@ void RXPacketProcessor::processEvent(const Event &e)
mSentences.clear(); mSentences.clear();
// Need to make a copy to mutate the packet ASSERT_VALID_PTR(e.rxPacket);
RXPacket p(e.rxPacket); mEncoder.encode(*(e.rxPacket), mSentences);
mEncoder.encode(p, mSentences);
for (vector<string>::iterator i = mSentences.begin(); i != mSentences.end(); ++i) for (vector<string>::iterator i = mSentences.begin(); i != mSentences.end(); ++i)
{ {
#ifdef MULTIPLEXED_OUTPUT #ifdef MULTIPLEXED_OUTPUT
@ -116,7 +118,7 @@ void RXPacketProcessor::processEvent(const Event &e)
// Special handling for specific messages that we care about // Special handling for specific messages that we care about
switch (e.rxPacket.messageType()) switch (e.rxPacket->messageType())
{ {
case 20: case 20:
// TODO: This is a time slot reservation from a base station. Use this information to block those time slots. // TODO: This is a time slot reservation from a base station. Use this information to block those time slots.

View File

@ -34,11 +34,12 @@ RadioManager &RadioManager::instance()
} }
RadioManager::RadioManager() RadioManager::RadioManager()
: mTXQueue(4)
{ {
mTransceiverIC = NULL; mTransceiverIC = NULL;
mReceiverIC = NULL; mReceiverIC = NULL;
mInitializing = true; mInitializing = true;
mTXQueue = new CircularQueue<TXPacket*>(4); //mTXQueue = new CircularQueue<TXPacket*>(4);
mUTC = 0; mUTC = 0;
EventQueue::instance().addObserver(this, CLOCK_EVENT); EventQueue::instance().addObserver(this, CLOCK_EVENT);
} }
@ -104,11 +105,11 @@ void RadioManager::processEvent(const Event &e)
// Evaluate the state of the transceiver IC and our queue ... // Evaluate the state of the transceiver IC and our queue ...
if ( mTransceiverIC->assignedTXPacket() == NULL ) if ( mTransceiverIC->assignedTXPacket() == NULL )
{ {
if ( !mTXQueue->empty() ) if ( !mTXQueue.empty() )
{ {
// There is no current TX operation pending, so we assign one // There is no current TX operation pending, so we assign one
TXPacket *packet = NULL; TXPacket *packet = NULL;
mTXQueue->pop(packet); mTXQueue.pop(packet);
ASSERT(packet); ASSERT(packet);
VHFChannel txChannel = packet->channel(); VHFChannel txChannel = packet->channel();
@ -161,7 +162,7 @@ void RadioManager::timeSlotStarted(uint32_t slotNumber)
void RadioManager::scheduleTransmission(TXPacket *packet) void RadioManager::scheduleTransmission(TXPacket *packet)
{ {
if ( mTXQueue->push(packet) ) if ( mTXQueue.push(packet) )
{ {
//DBG("RadioManager queued TX packet for channel %d\r\n", ORDINAL_TO_ITU(packet->channel())); //DBG("RadioManager queued TX packet for channel %d\r\n", ORDINAL_TO_ITU(packet->channel()));
} }

View File

@ -40,6 +40,8 @@ Receiver::Receiver(GPIO_TypeDef *sdnPort, uint32_t sdnPin, GPIO_TypeDef *csPort,
mSwitchToChannel = mChannel; mSwitchToChannel = mChannel;
mRXByte = 0; mRXByte = 0;
mBitWindow = 0; mBitWindow = 0;
mRXPacket = EventPool::instance().newRXPacket();
ASSERT_VALID_PTR(mRXPacket);
} }
Receiver::~Receiver() Receiver::~Receiver()
@ -100,7 +102,7 @@ void Receiver::resetBitScanner()
mRXByte = 0; mRXByte = 0;
mBitState = BIT_STATE_PREAMBLE_SYNC; mBitState = BIT_STATE_PREAMBLE_SYNC;
mRXPacket.reset(); mRXPacket->reset();
} }
void Receiver::onBitClock() void Receiver::onBitClock()
@ -109,20 +111,16 @@ void Receiver::onBitClock()
if ( gRadioState == RADIO_TRANSMITTING ) if ( gRadioState == RADIO_TRANSMITTING )
return; return;
bsp_signal_high(); //bsp_signal_high();
uint8_t bit = HAL_GPIO_ReadPin(mDataPort, mDataPin); uint8_t bit = HAL_GPIO_ReadPin(mDataPort, mDataPin);
processNRZIBit(bit); processNRZIBit(bit);
#if 1
if ( mSlotBitNumber != 0xffff && mSlotBitNumber++ == CCA_SLOT_BIT - 1 ) if ( mSlotBitNumber != 0xffff && mSlotBitNumber++ == CCA_SLOT_BIT - 1 )
{ {
uint8_t rssi = reportRSSI(); uint8_t rssi = reportRSSI();
mRXPacket.setRSSI(rssi); mRXPacket->setRSSI(rssi);
} }
#else //bsp_signal_low();
++mSlotBitNumber;
#endif
bsp_signal_low();
} }
void Receiver::timeSlotStarted(uint32_t slot) void Receiver::timeSlotStarted(uint32_t slot)
@ -136,7 +134,7 @@ void Receiver::timeSlotStarted(uint32_t slot)
if ( mBitState == BIT_STATE_IN_PACKET ) if ( mBitState == BIT_STATE_IN_PACKET )
return; return;
mRXPacket.setSlot(slot); mRXPacket->setSlot(slot);
if ( mSwitchAtNextSlot ) if ( mSwitchAtNextSlot )
{ {
mSwitchAtNextSlot = false; mSwitchAtNextSlot = false;
@ -168,14 +166,14 @@ void Receiver::processNRZIBit(uint8_t bit)
if ( mBitWindow == 0b1010101001111110 || mBitWindow == 0b0101010101111110 ) if ( mBitWindow == 0b1010101001111110 || mBitWindow == 0b0101010101111110 )
{ {
mBitState = BIT_STATE_IN_PACKET; mBitState = BIT_STATE_IN_PACKET;
mRXPacket.setChannel(mChannel); mRXPacket->setChannel(mChannel);
} }
break; break;
} }
case BIT_STATE_IN_PACKET: case BIT_STATE_IN_PACKET:
{ {
if ( mRXPacket.size() >= MAX_AIS_RX_PACKET_SIZE ) if ( mRXPacket->size() >= MAX_AIS_RX_PACKET_SIZE )
{ {
// Start over // Start over
startReceiving(mChannel); startReceiving(mChannel);
@ -240,7 +238,7 @@ bool Receiver::addBit(uint8_t bit)
if ( mBitCount == 8 ) if ( mBitCount == 8 )
{ {
// Commit to the packet! // Commit to the packet!
mRXPacket.addByte(mRXByte); mRXPacket->addByte(mRXByte);
mBitCount = 0; mBitCount = 0;
mRXByte = 0; mRXByte = 0;
} }
@ -251,14 +249,19 @@ bool Receiver::addBit(uint8_t bit)
void Receiver::pushPacket() void Receiver::pushPacket()
{ {
Event *p = EventPool::instance().newEvent(AIS_PACKET_EVENT); Event *p = EventPool::instance().newEvent(AIS_PACKET_EVENT);
RXPacket *currPacket = mRXPacket;
mRXPacket = EventPool::instance().newRXPacket();
ASSERT_VALID_PTR(mRXPacket);
if ( p ) if ( p )
{ {
bsp_signal_high(); bsp_signal_high();
p->rxPacket = mRXPacket; p->rxPacket = currPacket;
bsp_signal_low();
EventQueue::instance().push(p); EventQueue::instance().push(p);
bsp_signal_low();
} }
mRXPacket.reset();
mRXPacket->reset();
} }
uint8_t Receiver::reportRSSI() uint8_t Receiver::reportRSSI()

View File

@ -217,7 +217,7 @@ void Transceiver::onBitClock()
} }
else if ( mUTC && mSlotBitNumber == CCA_SLOT_BIT && mTXPacket->channel() == mChannel ) else if ( mUTC && mSlotBitNumber == CCA_SLOT_BIT && mTXPacket->channel() == mChannel )
{ {
int rssi = mRXPacket.rssi(); int rssi = mRXPacket->rssi();
int nf = NoiseFloorDetector::instance().getNoiseFloor(AIS_CHANNELS[mChannel].designation); int nf = NoiseFloorDetector::instance().getNoiseFloor(AIS_CHANNELS[mChannel].designation);
if ( rssi <= nf + TX_CCA_HEADROOM ) if ( rssi <= nf + TX_CCA_HEADROOM )
{ {

View File

@ -97,7 +97,7 @@ int main(void)
bsp_hw_init(); bsp_hw_init();
TaskHandle_t xHandle; TaskHandle_t xHandle;
if ( xTaskCreate(mainTask, "main", 2048u, NULL, tskIDLE_PRIORITY+4, &xHandle) != pdPASS ) if ( xTaskCreate(mainTask, "main", 2248u, NULL, tskIDLE_PRIORITY+4, &xHandle) != pdPASS )
{ {
asm("BKPT 0"); asm("BKPT 0");
} }