|
|
|
@ -110,6 +110,9 @@ void setup() {
|
|
|
|
|
|
|
|
|
|
|
|
start_button_isr();
|
|
|
|
start_button_isr();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char call[] = "AMSAT";
|
|
|
|
|
|
|
|
strcpy(callsign, call);
|
|
|
|
|
|
|
|
|
|
|
|
sampleTime = (unsigned int) millis();
|
|
|
|
sampleTime = (unsigned int) millis();
|
|
|
|
|
|
|
|
|
|
|
|
ready = TRUE; // flag for core1 to start looping
|
|
|
|
ready = TRUE; // flag for core1 to start looping
|
|
|
|
@ -139,8 +142,11 @@ void loop() {
|
|
|
|
get_tlm_fox();
|
|
|
|
get_tlm_fox();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mode == AFSK)
|
|
|
|
else if (mode == AFSK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
send_callsign(callsign);
|
|
|
|
|
|
|
|
sleep(1000);
|
|
|
|
send_packet();
|
|
|
|
send_packet();
|
|
|
|
|
|
|
|
}
|
|
|
|
// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100
|
|
|
|
// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100
|
|
|
|
while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100
|
|
|
|
while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100
|
|
|
|
sleep(0.1); // 25); // 0.5); // 25);
|
|
|
|
sleep(0.1); // 25); // 0.5); // 25);
|
|
|
|
@ -3321,20 +3327,38 @@ void transmit_mili(int freq, float duration) { // freq in Hz, duration in milli
|
|
|
|
float period_us = (1.0E6) / (float)(freq);
|
|
|
|
float period_us = (1.0E6) / (float)(freq);
|
|
|
|
bool phase = HIGH;
|
|
|
|
bool phase = HIGH;
|
|
|
|
while((micros() - start) < duration_us) {
|
|
|
|
while((micros() - start) < duration_us) {
|
|
|
|
digitalWrite(AUDIO_OUT_PIN, phase);
|
|
|
|
digitalWrite(AUDIO_OUT_PIN, phase); // ToDo: if no TXC, just turn on PWM carrier
|
|
|
|
phase = !phase;
|
|
|
|
phase = !phase;
|
|
|
|
sleep(min(start + duration_us - micros(), period_us) * 1000.0);
|
|
|
|
sleep(min(start + duration_us - micros(), period_us) * 1000.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
digitalWrite(AUDIO_OUT_PIN, LOW);
|
|
|
|
digitalWrite(AUDIO_OUT_PIN, LOW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void transmit_callsign() {
|
|
|
|
void transmit_callsign(char *callsign) {
|
|
|
|
int freq = 1500;
|
|
|
|
char de[] = "DE ";
|
|
|
|
|
|
|
|
char id[20];
|
|
|
|
|
|
|
|
strcat(id, de);
|
|
|
|
|
|
|
|
strcat(id, callsign);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transmit_on()
|
|
|
|
|
|
|
|
transmit_string(id);
|
|
|
|
|
|
|
|
transmit_off()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void transmit_string(char *string) {
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
char c = 'V'
|
|
|
|
while ((string[i] != '\0') && (i < 256)) {
|
|
|
|
while ((morse_table[char - 48][i] != 0) && (i < 5)) {
|
|
|
|
if (string[i] != ' ')
|
|
|
|
transmit_mili(freq, morse_table[char - 48][i++] * 200);
|
|
|
|
transmit_char(string[i++]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
sleep(3 * morse_timing);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void transmit_char(char character) {
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while ((morse_table[(toupper(character) - '0') % 44][i] != 0) && (i < 5)) {
|
|
|
|
|
|
|
|
transmit_mili(morse_freq, morse_table[(toupper(character) - '0') % 44][i++] * morse_timing);
|
|
|
|
|
|
|
|
sleep(morse_timing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|