From 450d05fdea7828c6ebf5326531dcad4327356061 Mon Sep 17 00:00:00 2001 From: Morgan Redfield Date: Sat, 4 Aug 2018 19:47:58 -0700 Subject: [PATCH] add delay after power on to examples, minor bugfixing --- examples/AFSK_PacketTester/AFSK_PacketTester.ino | 3 ++- examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino | 3 ++- examples/AX25Receive/AX25Receive.ino | 3 ++- examples/AppSerialController/AppSerialController.ino | 1 + examples/CrystalCalibration/CrystalCalibration.ino | 1 + examples/DDS/DDS.ino | 1 + examples/FMBeacon/FMBeacon.ino | 1 + examples/FoxHunt/FoxHunt.ino | 1 + examples/FunctionalTest/FunctionalTest.ino | 1 + examples/Gauges/Gauges.ino | 1 + examples/HandyTalkie/HandyTalkie.ino | 2 +- examples/KISS/KISS.ino | 3 ++- examples/PSK31Transmit/PSK31Transmit.ino | 1 + examples/SSTV/SSTV.ino | 1 + examples/SSTV_M1_Static/SSTV_M1_Static.ino | 1 + examples/SerialTransceiver/SerialTransceiver.ino | 1 + examples/SignalTest/SignalTest.ino | 1 + examples/SpeechTX/SpeechTX.ino | 2 +- src/HamShield.cpp | 4 +--- 19 files changed, 23 insertions(+), 9 deletions(-) diff --git a/examples/AFSK_PacketTester/AFSK_PacketTester.ino b/examples/AFSK_PacketTester/AFSK_PacketTester.ino index e858dd4..844d633 100644 --- a/examples/AFSK_PacketTester/AFSK_PacketTester.ino +++ b/examples/AFSK_PacketTester/AFSK_PacketTester.ino @@ -44,13 +44,14 @@ void setup() { pinMode(RESET_PIN, OUTPUT); // turn on pwr to the radio digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); radio.initialize(); radio.frequency(144390); radio.setRfPower(0); - radio.bypassPreDeEmph(); // needed for digital modes + // radio.bypassPreDeEmph(); dds.start(); afsk.start(&dds); delay(100); diff --git a/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino b/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino index 3b25826..2732b38 100644 --- a/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino +++ b/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino @@ -47,6 +47,7 @@ void setup() { pinMode(RESET_PIN, OUTPUT); // turn on the radio digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); @@ -58,7 +59,7 @@ void setup() { radio.setSQHiThresh(-100); radio.setSQLoThresh(-100); radio.setSQOn(); - radio.bypassPreDeEmph(); + //radio.bypassPreDeEmph(); dds.start(); afsk.start(&dds); delay(100); diff --git a/examples/AX25Receive/AX25Receive.ino b/examples/AX25Receive/AX25Receive.ino index 24166e1..d6668b9 100644 --- a/examples/AX25Receive/AX25Receive.ino +++ b/examples/AX25Receive/AX25Receive.ino @@ -36,6 +36,7 @@ void setup() { pinMode(RESET_PIN, OUTPUT); // turn on radio digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); @@ -54,7 +55,7 @@ void setup() { Serial.print(F(" / ")); Serial.println(radio.getSQLoThresh()); radio.setModeReceive(); - radio.bypassPreDeEmph(); // needed for digital modes + //radio.bypassPreDeEmph(); Serial.println(F("DDS Start")); delay(100); dds.start(); diff --git a/examples/AppSerialController/AppSerialController.ino b/examples/AppSerialController/AppSerialController.ino index fc97dbe..5ed3175 100644 --- a/examples/AppSerialController/AppSerialController.ino +++ b/examples/AppSerialController/AppSerialController.ino @@ -26,6 +26,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield"); diff --git a/examples/CrystalCalibration/CrystalCalibration.ino b/examples/CrystalCalibration/CrystalCalibration.ino index 7f00a1b..c1a510a 100644 --- a/examples/CrystalCalibration/CrystalCalibration.ino +++ b/examples/CrystalCalibration/CrystalCalibration.ino @@ -38,6 +38,7 @@ void setup() { pinMode(RESET_PIN, OUTPUT); // turn on radio digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); diff --git a/examples/DDS/DDS.ino b/examples/DDS/DDS.ino index de6e916..353a7d4 100644 --- a/examples/DDS/DDS.ino +++ b/examples/DDS/DDS.ino @@ -36,6 +36,7 @@ void setup() { pinMode(RESET_PIN, OUTPUT); // turn on radio digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up radio.initialize(); radio.setRfPower(0); diff --git a/examples/FMBeacon/FMBeacon.ino b/examples/FMBeacon/FMBeacon.ino index e8d654e..89ab0c2 100644 --- a/examples/FMBeacon/FMBeacon.ino +++ b/examples/FMBeacon/FMBeacon.ino @@ -34,6 +34,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up // Set up the serial port at 9600 Baud Serial.begin(9600); diff --git a/examples/FoxHunt/FoxHunt.ino b/examples/FoxHunt/FoxHunt.ino index 30c9f82..640a62b 100755 --- a/examples/FoxHunt/FoxHunt.ino +++ b/examples/FoxHunt/FoxHunt.ino @@ -38,6 +38,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up // Set up the serial port at 9600 Baud Serial.begin(9600); diff --git a/examples/FunctionalTest/FunctionalTest.ino b/examples/FunctionalTest/FunctionalTest.ino index 2f5a0bc..0b07bb2 100644 --- a/examples/FunctionalTest/FunctionalTest.ino +++ b/examples/FunctionalTest/FunctionalTest.ino @@ -31,6 +31,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield"); diff --git a/examples/Gauges/Gauges.ino b/examples/Gauges/Gauges.ino index 91418d3..17be744 100755 --- a/examples/Gauges/Gauges.ino +++ b/examples/Gauges/Gauges.ino @@ -35,6 +35,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up analogReference(DEFAULT); Serial.begin(9600); diff --git a/examples/HandyTalkie/HandyTalkie.ino b/examples/HandyTalkie/HandyTalkie.ino index b1021b1..4223c17 100644 --- a/examples/HandyTalkie/HandyTalkie.ino +++ b/examples/HandyTalkie/HandyTalkie.ino @@ -24,7 +24,6 @@ HamShield radio; #define LED_PIN 13 #define RSSI_REPORT_RATE_MS 5000 -//TODO: move these into library #define PWM_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -57,6 +56,7 @@ void setup() { // let the AU ot of reset digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.println("beginning radio setup"); diff --git a/examples/KISS/KISS.ino b/examples/KISS/KISS.ino index b01afc9..a3c12b6 100644 --- a/examples/KISS/KISS.ino +++ b/examples/KISS/KISS.ino @@ -45,6 +45,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); @@ -56,7 +57,7 @@ void setup() { radio.setSQLoThresh(-100); radio.setSQOn(); radio.frequency(144390); - radio.bypassPreDeEmph(); + //radio.bypassPreDeEmph(); dds.start(); afsk.start(&dds); diff --git a/examples/PSK31Transmit/PSK31Transmit.ino b/examples/PSK31Transmit/PSK31Transmit.ino index ffaffd4..8958380 100644 --- a/examples/PSK31Transmit/PSK31Transmit.ino +++ b/examples/PSK31Transmit/PSK31Transmit.ino @@ -31,6 +31,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); // put your setup code here, to run once: diff --git a/examples/SSTV/SSTV.ino b/examples/SSTV/SSTV.ino index 30c04d8..f1be40e 100755 --- a/examples/SSTV/SSTV.ino +++ b/examples/SSTV/SSTV.ino @@ -37,6 +37,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.print("Radio status: "); diff --git a/examples/SSTV_M1_Static/SSTV_M1_Static.ino b/examples/SSTV_M1_Static/SSTV_M1_Static.ino index 5b69f0c..7def7b9 100644 --- a/examples/SSTV_M1_Static/SSTV_M1_Static.ino +++ b/examples/SSTV_M1_Static/SSTV_M1_Static.ino @@ -41,6 +41,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); diff --git a/examples/SerialTransceiver/SerialTransceiver.ino b/examples/SerialTransceiver/SerialTransceiver.ino index bdf18ad..473ac6a 100644 --- a/examples/SerialTransceiver/SerialTransceiver.ino +++ b/examples/SerialTransceiver/SerialTransceiver.ino @@ -80,6 +80,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.println(";;;;;;;;;;;;;;;;;;;;;;;;;;"); diff --git a/examples/SignalTest/SignalTest.ino b/examples/SignalTest/SignalTest.ino index 3003f91..cf4f910 100755 --- a/examples/SignalTest/SignalTest.ino +++ b/examples/SignalTest/SignalTest.ino @@ -99,6 +99,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.print("Radio status: "); diff --git a/examples/SpeechTX/SpeechTX.ino b/examples/SpeechTX/SpeechTX.ino index ff5dcf9..fc7bcfd 100644 --- a/examples/SpeechTX/SpeechTX.ino +++ b/examples/SpeechTX/SpeechTX.ino @@ -239,6 +239,7 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); digitalWrite(RESET_PIN, HIGH); + delay(5); // wait for device to come up Serial.begin(9600); Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield"); @@ -269,7 +270,6 @@ void setup() { } void loop() { - //radio.bypassPreDeEmph(); radio.frequency(144025); radio.setModeTransmit(); for(;;) { } diff --git a/src/HamShield.cpp b/src/HamShield.cpp index 7d9029a..cb06864 100644 --- a/src/HamShield.cpp +++ b/src/HamShield.cpp @@ -992,8 +992,6 @@ void HamShield::enableDTMFReceive(){ HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, A1846S_DTMF_ENABLE_BIT, 1, 1); - //HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, A18462_DTMF_DET_TIME_BIT, A18462_DTMF_DET_TIME_LEN, 24); - //HSwriteBitsW(devAddr, 0x57, 0, 1, 1); // send dtmf to speaker out // bypass pre/de-emphasis @@ -1197,7 +1195,7 @@ void HamShield::usePreDeEmph(){ } bool HamShield::getPreDeEmphEnabled(){ HSreadBitW(devAddr, A1846S_EMPH_FILTER_REG, A1846S_EMPH_FILTER_EN, radio_i2c_buf); - return (radio_i2c_buf[0] != 0); + return (radio_i2c_buf[0] == 0); } // Read Only Status Registers