Add debug info

This commit is contained in:
CVR 2021-09-13 14:01:12 +12:00
parent 4f341661e3
commit 56e9a87b25
2 changed files with 11 additions and 4 deletions

View File

@ -31,17 +31,21 @@ int main() {
//mrf.turbo(); //mrf.turbo();
sei(); sei();
DDRD |= (1<<PD4) | (1<<PD5);
printf("Started"); printf("Started");
while(1) { while(1) {
//printf("txxxing...\n\r"); //printf("txxxing...\n\r");
//mrf.send16(0x4201, "abcd"); //mrf.send16(0x4201, "abcd");
//_delay_ms(5000); //_delay_ms(5000);
PORTD ^= (1<<PD5);
_delay_ms(500);
} }
} }
void handle_rx() { void handle_rx() {
PORTD |= (1<<PD4);
printf("------------------------------------------------------\n\r"); printf("------------------------------------------------------\n\r");
printf("received a packet %i bytes long\n\r", mrf.get_rxinfo()->frame_length); printf("received a packet %i bytes long\n\r", mrf.get_rxinfo()->frame_length);
@ -59,6 +63,7 @@ void handle_rx() {
printf("LQI/RSSI="); printf("LQI/RSSI=");
printf("%i/%i\n\r", mrf.get_rxinfo()->lqi, mrf.get_rxinfo()->rssi); printf("%i/%i\n\r", mrf.get_rxinfo()->lqi, mrf.get_rxinfo()->rssi);
PORTD &= ~(1<<PD4);
} }
void handle_tx() { void handle_tx() {

View File

@ -17,6 +17,7 @@
Mrf24j mrf; Mrf24j mrf;
int i = 0;
void handle_rx(); void handle_rx();
void handle_tx(); void handle_tx();
@ -36,15 +37,16 @@ int main() {
//mrf.turbo(); //mrf.turbo();
//mrf.set_power(0b1100000); //mrf.set_power(0b1100000);
//mrf.sleep(); //mrf.sleep();
sei(); sei();
printf("Started\n\r"); printf("Started\n\r");
int i = 0;
char tmp[20]; char tmp[20];
while(1) { while(1) {
printf("txxxing...\n\r"); printf("txxxing... %i\n\r", i++);
//mrf.wake(); //mrf.wake();
sprintf(tmp,"Received %i\n\r", i++); sprintf(tmp,"Received %i\n\r", i);
mrf.send16(0x4202, tmp); mrf.send16(0x4202, tmp);
_delay_ms(2000); _delay_ms(2000);
@ -74,7 +76,7 @@ void handle_rx() {
void handle_tx() { void handle_tx() {
if (mrf.get_txinfo()->tx_ok) { if (mrf.get_txinfo()->tx_ok) {
printf("TX went ok, got ack\n\r"); printf("TX went ok, got ack %i\n\r", i);
} else { } else {
printf("TX failed after %i retries\n\n\r", mrf.get_txinfo()->retries); printf("TX failed after %i retries\n\n\r", mrf.get_txinfo()->retries);
} }