#include "cw.h" void sendChar(repeater* myrpt, char c) { if (c < 47 || c > 90) { delay(myrpt->params.cw_speed * 3 * 2); return; } if (c > 57 && c < 65) { return; } int index = c - 47; if (c >= 65) { index = c - 54; } if (index >= sizeof morse/sizeof morse[0]) return; int dd = morse[index]; if (digitalRead(PIP_ATT) && myrpt->state > KEYCHUNK) digitalWrite(PIP_ATT, LOW); for (int i=0; i < 8; i++) { if (dd == 1) { return; } /* * attenuate pips in active T/T */ if (busy(myrpt) && !digitalRead(PIP_ATT)) digitalWrite(PIP_ATT, HIGH); tone(PIP, myrpt->params.cw_pitch); if (dd&1) { delay(myrpt->params.cw_speed * 3); } else { delay(myrpt->params.cw_speed); } dd >>= 1; noTone(PIP); delay(myrpt->params.cw_speed); } } void sendID(repeater* myrpt) { myrpt->id_time = millis(); if (myrpt->callsign == NULL) { return; } delay(500); if (myrpt->state < HANG) digitalWrite(PIP_ATT, HIGH); for (int i=0; i < sizeof ID/sizeof ID[0]; i++) { sendChar(myrpt, myrpt->callsign[i]); delay(myrpt->params.cw_speed * 3); } if (digitalRead(PIP_ATT)) digitalWrite(PIP_ATT, LOW); }