only test for ax5043 if AFSK mode

pull/121/head
alanbjohnston 5 years ago committed by GitHub
parent df2f7558df
commit f9ea248199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -117,39 +117,42 @@ int main(int argc, char * argv[]) {
wiringPiSetup(); wiringPiSetup();
if (mode == AFSK)
{
// Check for SPI and AX-5043 Digital Transceiver Board // Check for SPI and AX-5043 Digital Transceiver Board
FILE * file = popen("sudo raspi-config nonint get_spi", "r"); FILE * file = popen("sudo raspi-config nonint get_spi", "r");
// printf("getc: %c \n", fgetc(file)); // printf("getc: %c \n", fgetc(file));
if (fgetc(file) == 48) { if (fgetc(file) == 48) {
printf("SPI is enabled!\n"); printf("SPI is enabled!\n");
FILE * file2 = popen("ls /dev/spidev0.* 2>&1", "r"); FILE * file2 = popen("ls /dev/spidev0.* 2>&1", "r");
printf("Result getc: %c \n", getc(file2)); printf("Result getc: %c \n", getc(file2));
if (fgetc(file2) != 'l') { if (fgetc(file2) != 'l') {
printf("SPI devices present!\n"); printf("SPI devices present!\n");
// } // }
setSpiChannel(SPI_CHANNEL); setSpiChannel(SPI_CHANNEL);
setSpiSpeed(SPI_SPEED); setSpiSpeed(SPI_SPEED);
initializeSpi(); initializeSpi();
ax25_init( & hax25, (uint8_t * ) dest_addr, '1', (uint8_t * ) call, '1', AX25_PREAMBLE_LEN, AX25_POSTAMBLE_LEN); ax25_init( & hax25, (uint8_t * ) dest_addr, '1', (uint8_t * ) call, '1', AX25_PREAMBLE_LEN, AX25_POSTAMBLE_LEN);
if (init_rf()) { if (init_rf()) {
printf("AX5043 successfully initialized!\n"); printf("AX5043 successfully initialized!\n");
ax5043 = TRUE; ax5043 = TRUE;
cw_id = OFF; cw_id = OFF;
mode = AFSK; // mode = AFSK;
// cycle = OFF; // cycle = OFF;
printf("Mode AFSK with AX5043\n"); printf("Mode AFSK with AX5043\n");
transmit = TRUE; transmit = TRUE;
// sleep(10); // just in case CW ID is sent // sleep(10); // just in case CW ID is sent
} else } else
printf("AX5043 not present!\n"); printf("AX5043 not present!\n");
pclose(file2); pclose(file2);
}
} }
} pclose(file);
}
pclose(file);
txLed = 0; // defaults for vB3 board without TFB txLed = 0; // defaults for vB3 board without TFB
txLedOn = LOW; txLedOn = LOW;
txLedOff = HIGH; txLedOff = HIGH;

Loading…
Cancel
Save

Powered by TurnKey Linux.