Improve digipeat TRACE. Improve PWM diagnostics.

Development
bob 2018-10-12 11:26:25 +11:00
rodzic c5176e2f25
commit 4ee3a39d5e
5 zmienionych plików z 46 dodań i 22 usunięć

Wyświetl plik

@ -518,10 +518,16 @@ uint8_t pktReleasePWMbuffers(AFSKDemodDriver *myDriver) {
/* Then check that the pool reference points to CCM. */
pktAssertCCMdynamicCheck(myDriver->pwm_buffer_pool.next);
#endif
#if TRACE_PWM_BUFFER_STATS == TRUE
myDriver->active_demod_stream->rlsd++;
#endif
} while((object = next) != NULL);
myFIFO->decode_pwm_queue = NULL;
#if TRACE_PWM_BUFFER_STATS == TRUE
return myDriver->active_demod_stream->rlsd;
#else
return 0;
#endif
}
#endif
@ -841,7 +847,11 @@ THD_FUNCTION(pktAFSKDecoder, arg) {
* Switch to the next queue/buffer object for decoding.
*/
chPoolFree(&myDriver->pwm_buffer_pool, myFIFO->decode_pwm_queue);
#if TRACE_PWM_BUFFER_STATS == TRUE
myFIFO->rlsd++;
if(myDriver->frame_state == FRAME_SEARCH)
myFIFO->sync++;
#endif
myFIFO->decode_pwm_queue = nextObject;
} else {
/*
@ -884,7 +894,6 @@ THD_FUNCTION(pktAFSKDecoder, arg) {
/* Check for change of frame state. */
switch(myDriver->frame_state) {
case FRAME_SEARCH:
//pktLLDradioUpdateIndicator(radio, PKT_INDICATOR_DECODE, PAL_TOGGLE);
continue;
case FRAME_OPEN:
@ -910,7 +919,7 @@ THD_FUNCTION(pktAFSKDecoder, arg) {
/*
* RESET readies the decoder for the next session.
* It frees any held buffers/objects.
* The DSP system is reset and then transitions to IDLE.
* The DSP system is reset and then decoder transitions to IDLE.
* The decoder indicator is extinguished.
*/
case DECODER_RESET: {
@ -981,14 +990,13 @@ THD_FUNCTION(pktAFSKDecoder, arg) {
#if USE_HEAP_PWM_BUFFER == TRUE
/* Release PWM queue/buffer objects back to the pool. */
radio_pwm_fifo_t *myFIFO = myDriver->active_demod_stream;
uint8_t u = myFIFO->in_use;
uint8_t n = pktReleasePWMbuffers(myDriver);
#if TRACE_PWM_BUFFER_STATS == TRUE
uint8_t u = myFIFO->in_use;
TRACE_DEBUG("AFSK > PWM buffer use:"
" pool %d, cycled %d, released %d, queue max %d",
PWM_DATA_BUFFERS, u, n, myFIFO->peak);
" pool %d, cycled %d, search %d, released %d, queue max %d",
PWM_DATA_BUFFERS, u, myFIFO->sync, n, myFIFO->peak);
#else
(void)u;
(void)n;
#endif
#endif

Wyświetl plik

@ -503,9 +503,12 @@ void pktOpenPWMChannelI(ICUDriver *myICU, eventflags_t evt) {
/* Save this object as the one currently receiving PWM. */
myFIFO->radio_pwm_queue = pwm_object;
#if TRACE_PWM_BUFFER_STATS == TRUE
myFIFO->in_use = 1;
myFIFO->sync = 1;
myFIFO->peak = 0;
myFIFO->rlsd = 0;
#endif
myFIFO->decode_pwm_queue = pwm_object;
/*
* Initialize the queue object.
@ -846,14 +849,14 @@ void pktRadioICUPeriod(ICUDriver *myICU) {
myDemod->active_radio_stream->radio_pwm_queue;
qSetLink(&myObject->queue, pwm_object);
#if TRACE_PWM_BUFFER_STATS == TRUE
/* Update statistics. */
myDemod->active_radio_stream->in_use++;
uint8_t out = (myDemod->active_radio_stream->in_use
- myDemod->active_radio_stream->rlsd);
if(out > myDemod->active_radio_stream->peak)
myDemod->active_radio_stream->peak = out;
#endif
/* Write the in-band queue swap message to the current object. */
#if USE_12_BIT_PWM == TRUE

Wyświetl plik

@ -145,9 +145,12 @@ typedef struct {
*/
radio_pwm_object_t *radio_pwm_queue;
radio_pwm_object_t *decode_pwm_queue;
#if TRACE_PWM_BUFFER_STATS == TRUE
uint8_t in_use;
uint8_t sync;
uint8_t rlsd;
uint8_t peak;
#endif
#else
/* Allocate a PWM buffer in the queue object. */
radio_pwm_buffer_t packed_buffer;

Wyświetl plik

@ -1263,7 +1263,7 @@ static bool aprs_decode_message(packet_t pp) {
}
/**
* Digipeat if not a recent packet or our call is not in the list.
* Digipeat handling.
*/
static void aprs_digipeat(packet_t pp) {
if(!dedupe_initialized) {
@ -1271,10 +1271,12 @@ static void aprs_digipeat(packet_t pp) {
dedupe_initialized = true;
}
/* Check if the packet was already repeated recently. */
/* Check the digipeat conditions. */
packet_t result = digipeat_match(conf_sram.aprs.rx.radio_conf.freq,
pp, conf_sram.aprs.rx.call,
conf_sram.aprs.tx.call, alias_re,
pp,
conf_sram.aprs.rx.call,
conf_sram.aprs.tx.call,
alias_re,
wide_re,
conf_sram.aprs.tx.radio_conf.freq,
preempt, NULL);

Wyświetl plik

@ -171,6 +171,7 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
/* could have different calls. */
ax25_set_addr (result, r, mycall_xmit);
ax25_set_h (result, r);
TRACE_INFO("DIGI > Repeat my callsign path");
return (result);
}
@ -215,14 +216,16 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
* My call should be an implied member of this set.
* In this implementation, we already caught it further up.
*/
regex(alias, repeater, &found_len);
char *found = regex(alias, repeater, &found_len);
if(found_len) {
packet_t result = ax25_dup (pp);
if(result == NULL)
return NULL;
char alias[50] = {0};
memcpy(alias, found, found_len);
ax25_set_addr (result, r, mycall_xmit);
ax25_set_h (result, r);
TRACE_INFO("DIGI > Digipeat alias pattern: %s ", alias);
return (result);
}
@ -239,8 +242,10 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
ax25_get_addr_with_ssid(pp, r2, repeater2);
regex(alias, repeater2, &found_len);
found = regex(alias, repeater2, &found_len);
char pre[50] = {0};
if(found_len)
memcpy(pre, found, found_len);
if (strcmp(repeater2, mycall_rec) == 0 ||
found_len != 0) {
packet_t result = ax25_dup (pp);
@ -254,7 +259,7 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
case PREEMPT_DROP: /* remove all prior */
while (r2 > AX25_REPEATER_1) {
ax25_remove_addr (result, r2-1);
r2--;
r2--;
}
break;
@ -262,7 +267,7 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
r2--;
while (r2 >= AX25_REPEATER_1 && ax25_get_h(result,r2) == 0) {
ax25_set_h (result, r2);
r2--;
r2--;
}
break;
@ -270,11 +275,11 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
default:
while (r2 > AX25_REPEATER_1 && ax25_get_h(result,r2-1) == 0) {
ax25_remove_addr (result, r2-1);
r2--;
r2--;
}
break;
} /* End switch. */
TRACE_INFO("DIGI > Digipeat traffic");
TRACE_INFO("DIGI > Digipeat preemptive %s traffic", pre);
return (result);
}
}
@ -283,9 +288,10 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
/*
* For the wide pattern, we check the ssid and decrement it.
*/
regex(wide, repeater, &found_len);
found = regex(wide, repeater, &found_len);
if (found_len != 0) {
char path[50] = {0};
memcpy(path, found, found_len);
/*
* If ssid == 1, we simply replace the repeater with my call and
* mark it as being used.
@ -305,6 +311,7 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
ax25_set_addr (result, r, mycall_xmit);
ax25_set_h (result, r);
TRACE_INFO("DIGI > Digipeat %s traffic", path);
return (result);
}
@ -321,6 +328,7 @@ packet_t digipeat_match (radio_freq_t from_freq, packet_t pp, char *mycall_rec,
ax25_insert_addr (result, r, mycall_xmit);
ax25_set_h (result, r);
}
TRACE_INFO("DIGI > Digipeat %s traffic", path);
return (result);
}
}