void setupRadio() { printf_begin(); // Setup and configure radio radio.begin(); radio.setAutoAck(1); // Ensure autoACK is enabled radio.enableAckPayload(); // Allow optional ack payloads radio.setRetries(2,15); // Smallest time between retries, max no. of retries radio.setPayloadSize(8); radio.setDataRate(RF24_250KBPS); if( radio.getDataRate() == RF24_250KBPS ) { debugPrint("Radio is available"); radio_hw_available = true; radio.startListening(); // Start listening radio.powerUp(); radio.openWritingPipe(pipes[0]); // Open different pipes when writing. Write on pipe 0, address 0 radio.openReadingPipe(1,pipes[1]); // Read on pipe 1, as address 1 } else { debugPrint("Radio is NOT available"); } //radio.printDetails(); // Dump the configuration of the rf unit for debugging }
void drawRF24Pad(){ wclear(rf24Pad); mvwprintw(rf24Pad,1,0,"Address: 0%o\n",mesh.mesh_address); wprintw(rf24Pad,"nodeID: %d\n",mesh.getNodeID()); wprintw(rf24Pad,"En Mesh: %s\n", gw.meshEnabled() ? "True" : "False"); int dr = radio.getDataRate(); wprintw(rf24Pad,"Data-Rate: %s\n", dr == 0 ? "1MBPS" : dr == 1 ? "2MBPS" : dr == 2 ? "250KBPS" : "ERROR" ); int pa = radio.getPALevel(); wprintw(rf24Pad,"PA Level: %s\n", pa == 0 ? "MIN" : pa == 1 ? "LOW" : pa == 2 ? "HIGH" : pa == 3 ? "MAX" : "ERROR" ); wprintw(rf24Pad,"IF Type: %s\n", gw.config_TUN == 1 ? "TUN" : "TAP" ); wprintw(rf24Pad,"IF Drops: %u\n", gw.ifDropped() ); #if defined (ENABLE_NETWORK_STATS) uint32_t ok,fail; network.failures(&fail,&ok); wprintw(rf24Pad,"TX Packets: %u\n", ok ); wprintw(rf24Pad,"TX Drops: %u\n", fail ); #endif if(padSelection == 1){ wattron(rf24Pad,COLOR_PAIR(1)); mvwhline(rf24Pad,rf24Scroll,0,ACS_HLINE, maxY); wattroff(rf24Pad,COLOR_PAIR(1)); mvwprintw(rf24Pad,rf24Scroll,3," RF24Network Info: "); }else{ wattroff(rf24Pad,COLOR_PAIR(1)); mvwhline(rf24Pad,rf24Scroll,0,ACS_HLINE, maxY); mvwprintw(rf24Pad,rf24Scroll,3," RF24Network Info: "); } }