From 69b4a4bb6773762805a8c0f9b66300e8be3ebe0d Mon Sep 17 00:00:00 2001 From: knmcguire Date: Fri, 18 Oct 2019 10:55:20 +0200 Subject: [PATCH] #484 synced up STL buffers, put in limit and removed p2ppacket from message que (for now) --- src/hal/interface/radiolink.h | 2 +- src/hal/interface/syslink.h | 2 +- src/hal/src/radiolink.c | 11 ++--------- src/hal/src/syslink.c | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/hal/interface/radiolink.h b/src/hal/interface/radiolink.h index 542c79700e..293c5c64f3 100644 --- a/src/hal/interface/radiolink.h +++ b/src/hal/interface/radiolink.h @@ -31,7 +31,7 @@ #include #include "syslink.h" -#define P2P_MAX_DATA_SIZE 61 +#define P2P_MAX_DATA_SIZE 60 typedef struct _P2PPacket { diff --git a/src/hal/interface/syslink.h b/src/hal/interface/syslink.h index 0152cc1555..ca4408bc06 100644 --- a/src/hal/interface/syslink.h +++ b/src/hal/interface/syslink.h @@ -29,7 +29,7 @@ #include -#define SYSLINK_MTU 32 +#define SYSLINK_MTU 64 #define CRTP_START_BYTE 0xAA #define SYSLINK_START_BYTE1 0xBC diff --git a/src/hal/src/radiolink.c b/src/hal/src/radiolink.c index 00bd666a0f..7511dfdf88 100644 --- a/src/hal/src/radiolink.c +++ b/src/hal/src/radiolink.c @@ -51,7 +51,6 @@ static xQueueHandle txQueue; static xQueueHandle crtpPacketDelivery; -static xQueueHandle p2pPacketDelivery; static bool isInit; @@ -87,8 +86,6 @@ void radiolinkInit(void) DEBUG_QUEUE_MONITOR_REGISTER(txQueue); crtpPacketDelivery = xQueueCreate(RADIOLINK_CTRP_QUEUE_SIZE, sizeof(CRTPPacket)); DEBUG_QUEUE_MONITOR_REGISTER(crtpPacketDelivery); - p2pPacketDelivery = xQueueCreate(RADIOLINK_P2P_QUEUE_SIZE, sizeof(SyslinkPacket)); - DEBUG_QUEUE_MONITOR_REGISTER(p2pPacketDelivery); ASSERT(crtpPacketDelivery); @@ -178,19 +175,14 @@ void radiolinkSyslinkDispatch(SyslinkPacket *slp) memcpy(&rssi, slp->data, sizeof(uint8_t)); //rssi will not change on disconnect } else if (slp->type == SYSLINK_RADIO_P2P_BROADCAST) { - xQueueSend(p2pPacketDelivery, &slp->length, 0); ledseqRun(LINK_LED, seq_linkup); P2PPacket p2pp; p2pp.port=slp->data[0]; p2pp.rssi = slp->data[1]; memcpy(&p2pp.data[0], &slp->data[2],slp->length-2); - memcpy(&p2pp.raw[0], &slp->data[0],slp->length); p2pp.size=slp->length; - if (p2p_callback) - { p2p_callback(&p2pp); - } } isConnected = radiolinkIsConnected(); @@ -233,13 +225,14 @@ bool radiolinkSendP2PPacketBroadcast(P2PPacket *p) { static SyslinkPacket slp; - ASSERT(p->size <= CRTP_MAX_DATA_SIZE); + ASSERT(p->size <= P2P_MAX_DATA_SIZE); slp.type = SYSLINK_RADIO_P2P_BROADCAST; slp.length = p->size + 1; memcpy(slp.data, p->raw, p->size + 1); syslinkSendPacket(&slp); + ledseqRun(LINK_DOWN_LED, seq_linkup); return true; } diff --git a/src/hal/src/syslink.c b/src/hal/src/syslink.c index 238e1cbb11..7d5bb43d0d 100644 --- a/src/hal/src/syslink.c +++ b/src/hal/src/syslink.c @@ -44,7 +44,7 @@ #include "ow.h" static bool isInit = false; -static uint8_t sendBuffer[64]; +static uint8_t sendBuffer[SYSLINK_MTU + 6]; static void syslinkRouteIncommingPacket(SyslinkPacket *slp);