Skip to content

Commit

Permalink
#484 synced up STL buffers, put in limit and removed p2ppacket from m…
Browse files Browse the repository at this point in the history
…essage que (for now)
  • Loading branch information
knmcguire committed Oct 18, 2019
1 parent 4f00885 commit 69b4a4b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/hal/interface/radiolink.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdbool.h>
#include "syslink.h"

#define P2P_MAX_DATA_SIZE 61
#define P2P_MAX_DATA_SIZE 60

typedef struct _P2PPacket
{
Expand Down
2 changes: 1 addition & 1 deletion src/hal/interface/syslink.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <stdbool.h>

#define SYSLINK_MTU 32
#define SYSLINK_MTU 64

#define CRTP_START_BYTE 0xAA
#define SYSLINK_START_BYTE1 0xBC
Expand Down
11 changes: 2 additions & 9 deletions src/hal/src/radiolink.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

static xQueueHandle txQueue;
static xQueueHandle crtpPacketDelivery;
static xQueueHandle p2pPacketDelivery;

static bool isInit;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hal/src/syslink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 69b4a4b

Please sign in to comment.