Initialize from static "zero" messages rather than using memset.
This commit is contained in:
parent
8b8f8d7a40
commit
36a5c16dd2
|
@ -58,6 +58,7 @@ static inline int slice_phase4(uint16_t *m) {
|
||||||
//
|
//
|
||||||
void demodulate2400(struct mag_buf *mag)
|
void demodulate2400(struct mag_buf *mag)
|
||||||
{
|
{
|
||||||
|
static struct modesMessage zeroMessage;
|
||||||
struct modesMessage mm;
|
struct modesMessage mm;
|
||||||
unsigned char msg1[MODES_LONG_MSG_BYTES], msg2[MODES_LONG_MSG_BYTES], *msg;
|
unsigned char msg1[MODES_LONG_MSG_BYTES], msg2[MODES_LONG_MSG_BYTES], *msg;
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
|
@ -70,7 +71,6 @@ void demodulate2400(struct mag_buf *mag)
|
||||||
|
|
||||||
uint64_t sum_scaled_signal_power = 0;
|
uint64_t sum_scaled_signal_power = 0;
|
||||||
|
|
||||||
memset(&mm, 0, sizeof(mm));
|
|
||||||
msg = msg1;
|
msg = msg1;
|
||||||
|
|
||||||
for (j = 0; j < mlen; j++) {
|
for (j = 0; j < mlen; j++) {
|
||||||
|
@ -297,6 +297,7 @@ void demodulate2400(struct mag_buf *mag)
|
||||||
msglen = modesMessageLenByType(bestmsg[0] >> 3);
|
msglen = modesMessageLenByType(bestmsg[0] >> 3);
|
||||||
|
|
||||||
// Set initial mm structure details
|
// Set initial mm structure details
|
||||||
|
mm = zeroMessage;
|
||||||
mm.timestampMsg = mag->sampleTimestamp + (j*5) + bestphase;
|
mm.timestampMsg = mag->sampleTimestamp + (j*5) + bestphase;
|
||||||
|
|
||||||
// compute message receive time as block-start-time + difference in the 12MHz clock
|
// compute message receive time as block-start-time + difference in the 12MHz clock
|
||||||
|
|
7
net_io.c
7
net_io.c
|
@ -716,6 +716,7 @@ static int decodeBinMessage(struct client *c, char *p) {
|
||||||
int j;
|
int j;
|
||||||
char ch;
|
char ch;
|
||||||
unsigned char msg[MODES_LONG_MSG_BYTES];
|
unsigned char msg[MODES_LONG_MSG_BYTES];
|
||||||
|
static struct modesMessage zeroMessage;
|
||||||
struct modesMessage mm;
|
struct modesMessage mm;
|
||||||
MODES_NOTUSED(c);
|
MODES_NOTUSED(c);
|
||||||
memset(&mm, 0, sizeof(mm));
|
memset(&mm, 0, sizeof(mm));
|
||||||
|
@ -732,6 +733,8 @@ static int decodeBinMessage(struct client *c, char *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgLen) {
|
if (msgLen) {
|
||||||
|
mm = zeroMessage;
|
||||||
|
|
||||||
// Mark messages received over the internet as remote so that we don't try to
|
// Mark messages received over the internet as remote so that we don't try to
|
||||||
// pass them off as being received by this instance when forwarding them
|
// pass them off as being received by this instance when forwarding them
|
||||||
mm.remote = 1;
|
mm.remote = 1;
|
||||||
|
@ -810,8 +813,10 @@ static int decodeHexMessage(struct client *c, char *hex) {
|
||||||
int l = strlen(hex), j;
|
int l = strlen(hex), j;
|
||||||
unsigned char msg[MODES_LONG_MSG_BYTES];
|
unsigned char msg[MODES_LONG_MSG_BYTES];
|
||||||
struct modesMessage mm;
|
struct modesMessage mm;
|
||||||
|
static struct modesMessage zeroMessage;
|
||||||
|
|
||||||
MODES_NOTUSED(c);
|
MODES_NOTUSED(c);
|
||||||
memset(&mm, 0, sizeof(mm));
|
mm = zeroMessage;
|
||||||
|
|
||||||
// Mark messages received over the internet as remote so that we don't try to
|
// Mark messages received over the internet as remote so that we don't try to
|
||||||
// pass them off as being received by this instance when forwarding them
|
// pass them off as being received by this instance when forwarding them
|
||||||
|
|
Loading…
Reference in a new issue