#include "cw.h" void sendChar(rpt* myrpt, char c) { if (c < 47 || c > 90) { delay(myrpt->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]; for (int i=0; i < 8; i++) { if (dd == 1) { return; } tone(PIP, myrpt->cw_pitch); if (dd&1) { delay(myrpt->cw_speed * 3); } else { delay(myrpt->cw_speed); } dd >>= 1; noTone(PIP); delay(myrpt->cw_speed); } } void sendID(rpt* myrpt) { myrpt->id = millis(); if (myrpt->callsign == NULL) { return; } delay(500); for (int i=0; i < sizeof ID/sizeof ID[0]; i++) { sendChar(myrpt, myrpt->callsign[i]); delay(myrpt->cw_speed * 3); } myrpt->is_id = false; }