summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5454564)
It's pretty much impossible to RDF the rocket during flight, and it
interferes with the telemetry data stream. Leave it enabled on the pad
so that radios can be tested, and then re-enable it once the rocket
has landed.
This patch also turns the rdf 'on' time into a parameter so it can be
changed, and then sets that parameter to 500ms, once every 5 seconds.
Signed-off-by: Keith Packard <keithp@keithp.com>
ao_radio_recv(__xdata struct ao_radio_recv *recv) __reentrant;
void
ao_radio_recv(__xdata struct ao_radio_recv *recv) __reentrant;
void
void
ao_radio_rdf_abort(void);
void
ao_radio_rdf_abort(void);
/* slow down the ADC sample rate */
ao_timer_set_adc_interval(10);
/* slow down the ADC sample rate */
ao_timer_set_adc_interval(10);
- /* Enable RDF beacon */
- ao_rdf_set(1);
-
/*
* Start recording min/max accel and pres for a while
* to figure out when the rocket has landed
/*
* Start recording min/max accel and pres for a while
* to figure out when the rocket has landed
/* turn off the ADC capture */
ao_timer_set_adc_interval(0);
/* turn off the ADC capture */
ao_timer_set_adc_interval(0);
+ /* Enable RDF beacon */
+ ao_rdf_set(1);
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
}
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
}
(RDF_DEVIATION_M << RF_DEVIATN_DEVIATION_M_SHIFT)),
/* packet length */
(RDF_DEVIATION_M << RF_DEVIATN_DEVIATION_M_SHIFT)),
/* packet length */
- RF_PKTLEN_OFF, RDF_PACKET_LEN,
RF_PKTCTRL1_OFF, ((1 << PKTCTRL1_PQT_SHIFT)|
PKTCTRL1_ADR_CHK_NONE),
RF_PKTCTRL0_OFF, (RF_PKTCTRL0_PKT_FORMAT_NORMAL|
RF_PKTCTRL1_OFF, ((1 << PKTCTRL1_PQT_SHIFT)|
PKTCTRL1_ADR_CHK_NONE),
RF_PKTCTRL0_OFF, (RF_PKTCTRL0_PKT_FORMAT_NORMAL|
__xdata ao_radio_rdf_value = 0x55;
void
__xdata ao_radio_rdf_value = 0x55;
void
ao_mutex_get(&ao_radio_mutex);
ao_radio_idle();
ao_radio_rdf_running = 1;
for (i = 0; i < sizeof (rdf_setup); i += 2)
RF[rdf_setup[i]] = rdf_setup[i+1];
ao_mutex_get(&ao_radio_mutex);
ao_radio_idle();
ao_radio_rdf_running = 1;
for (i = 0; i < sizeof (rdf_setup); i += 2)
RF[rdf_setup[i]] = rdf_setup[i+1];
+ /*
+ * Compute the packet length as follows:
+ *
+ * 2000 bps (for a 1kHz tone)
+ * so, for 'ms' milliseconds, we need
+ * 2 * ms bits, or ms / 4 bytes
+ */
+ if (ms > (255 * 4))
+ ms = 255 * 4;
+ pkt_len = ms >> 2;
+ RF[RF_PKTLEN_OFF] = pkt_len;
+
ao_dma_set_transfer(ao_radio_dma,
&ao_radio_rdf_value,
&RFDXADDR,
ao_dma_set_transfer(ao_radio_dma,
&ao_radio_rdf_value,
&RFDXADDR,
DMA_CFG0_WORDSIZE_8 |
DMA_CFG0_TMODE_SINGLE |
DMA_CFG0_TRIGGER_RADIO,
DMA_CFG0_WORDSIZE_8 |
DMA_CFG0_TMODE_SINGLE |
DMA_CFG0_TRIGGER_RADIO,
__xdata uint8_t ao_rdf = 0;
__xdata uint16_t ao_rdf_time;
__xdata uint8_t ao_rdf = 0;
__xdata uint16_t ao_rdf_time;
-#define AO_RDF_INTERVAL AO_SEC_TO_TICKS(3)
+#define AO_RDF_INTERVAL_TICKS AO_SEC_TO_TICKS(5)
+#define AO_RDF_LENGTH_MS 500
if (ao_rdf &&
(int16_t) (ao_time() - ao_rdf_time) >= 0)
{
if (ao_rdf &&
(int16_t) (ao_time() - ao_rdf_time) >= 0)
{
- ao_rdf_time = ao_time() + AO_RDF_INTERVAL;
- ao_radio_rdf();
+ ao_rdf_time = ao_time() + AO_RDF_INTERVAL_TICKS;
+ ao_radio_rdf(AO_RDF_LENGTH_MS);
ao_delay(ao_telemetry_interval);
}
}
ao_delay(ao_telemetry_interval);
}
}
ao_rdf = rdf;
if (rdf == 0)
ao_radio_rdf_abort();
ao_rdf = rdf;
if (rdf == 0)
ao_radio_rdf_abort();
+ else
+ ao_rdf_time = ao_time();
}
__xdata struct ao_task ao_telemetry_task;
}
__xdata struct ao_task ao_telemetry_task;