o Corrects several errors that prevented the DIP switch from being read correctly after a sync.
pull/25/head^2
DigitalConfections 2020-08-11 21:15:54 -04:00
rodzic d983c25a1f
commit 067cd632d8
2 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -170,12 +170,6 @@ void softwareReset(void);
pinMode(PIN_AUDIO_OUT, OUTPUT); pinMode(PIN_AUDIO_OUT, OUTPUT);
digitalWrite(PIN_AUDIO_OUT, OFF); digitalWrite(PIN_AUDIO_OUT, OFF);
pinMode(PIN_SYNC, INPUT_PULLUP); /* Sync button */
pinMode(PIN_DIP_0, INPUT_PULLUP); /* DIP switch LSB */
pinMode(PIN_DIP_1, INPUT_PULLUP); /* DIP switch middle bit */
pinMode(PIN_DIP_2, INPUT_PULLUP); /* DIP switch MSB */
digitalWrite(PIN_LED, OFF); /* Turn off led sync switch is now open */
/* Set unused pins as outputs pulled high */ /* Set unused pins as outputs pulled high */
pinMode(PIN_UNUSED_7, INPUT_PULLUP); pinMode(PIN_UNUSED_7, INPUT_PULLUP);
pinMode(PIN_UNUSED_8, INPUT_PULLUP); pinMode(PIN_UNUSED_8, INPUT_PULLUP);
@ -296,7 +290,7 @@ void softwareReset(void);
************************************************************************/ ************************************************************************/
ISR(PCINT2_vect) ISR(PCINT2_vect)
{ {
BOOL pinVal = digitalRead(3); BOOL pinVal = digitalRead(PIN_SYNC);
if(pinVal) /* Sync is high */ if(pinVal) /* Sync is high */
{ {
@ -1554,13 +1548,19 @@ void doSynchronization()
g_sync_pin_stable = FALSE; g_sync_pin_stable = FALSE;
digitalWrite(PIN_LED,LOW); digitalWrite(PIN_LED,LOW);
g_on_the_air = FALSE; g_on_the_air = FALSE;
g_fox_counter = 1; /* Don't count on the 1-sec timer setting this in time */ g_fox_counter = 1; /* Don't count on the 1-sec timer resetting this quickly enough */
sei(); sei();
} }
void setupForFox() void setupForFox()
{ {
cli(); cli();
pinMode(PIN_SYNC, INPUT_PULLUP); /* Sync button */
pinMode(PIN_DIP_0, INPUT_PULLUP); /* DIP switch LSB */
pinMode(PIN_DIP_1, INPUT_PULLUP); /* DIP switch middle bit */
pinMode(PIN_DIP_2, INPUT_PULLUP); /* DIP switch MSB */
digitalWrite(PIN_LED, OFF); /* Turn off led sync switch is now open */
g_seconds_since_sync = 0; /* Total elapsed time counter */ g_seconds_since_sync = 0; /* Total elapsed time counter */
g_on_the_air = FALSE; /* Controls transmitter Morse activity */ g_on_the_air = FALSE; /* Controls transmitter Morse activity */
g_code_throttle = 0; /* Adjusts Morse code speed */ g_code_throttle = 0; /* Adjusts Morse code speed */
@ -1593,14 +1593,18 @@ void setupForFox()
} }
else /* Read DIP Switches */ else /* Read DIP Switches */
{ {
g_fox = (FoxType)0;
if(digitalRead(PIN_DIP_0) == LOW) /*Lsb */ if(digitalRead(PIN_DIP_0) == LOW) /*Lsb */
{ {
g_fox++; g_fox += 1;
} }
if(digitalRead(PIN_DIP_1) == LOW) /* middle bit */ if(digitalRead(PIN_DIP_1) == LOW) /* middle bit */
{ {
g_fox += 2; g_fox += 2;
} }
if(digitalRead(PIN_DIP_2) == LOW) /* MSB */ if(digitalRead(PIN_DIP_2) == LOW) /* MSB */
{ {
g_fox += 4; g_fox += 4;

Wyświetl plik

@ -70,7 +70,7 @@
/****************************************************** /******************************************************
* Set the text that gets displayed to the user */ * Set the text that gets displayed to the user */
#define SW_REVISION "0.20" #define SW_REVISION "0.21"
//#define TRANQUILIZE_WATCHDOG //#define TRANQUILIZE_WATCHDOG