Serial and pip attenuation

This commit is contained in:
Jim Colderwood 2024-04-04 22:19:30 +01:00
parent 59e51fce3d
commit a298a37c08
3 changed files with 21 additions and 6 deletions

View File

@ -1,14 +1,13 @@
#include "config.h"
#include "repeater.h"
#define PIP_OUT 13
void setup() {
pinMode(3, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(7, INPUT);
pinMode(7, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(PIP_ATT, OUTPUT);
}
void loop() {
@ -35,13 +34,15 @@ void loop() {
delay(1000);
myrpt->transmitter.tx = true;
//sendID(myrpt);
sendID(myrpt);
myrpt->state = SLEEP;
unsigned long ht = millis();
unsigned long tot = ht;
unsigned long kc;
unsigned long id = ht;
serial_writer(&myrpt->serial, "READY");
digitalWrite(PIP_ATT, LOW);
while (1) {
rx(myrpt);

View File

@ -2,6 +2,7 @@
#define CONFIG_H
/* IO */
#define PIP_ATT 13
#define GW_COS 6
#define COS 7
#define PTT 8
@ -26,7 +27,7 @@
#define TAILPIP_PITCH 500
/* SERIAL */
#define SERIAL false
#define SERIAL true
#define SERIAL_SPEED 115200
/* TIMERS */

View File

@ -37,14 +37,27 @@ void sendChar(int speed, int pitch, char c) {
}
void sendID(repeater* myrpt) {
bool pip_att = false;
if (myrpt->callsign == NULL) {
return;
}
for (int i=0; i < sizeof ID/sizeof ID[0]; i++) {
/* attenuate pips in active T/T
* unless first ID from sleep
*/
if (myrpt->state != KEYCHUNK && busy(myrpt) && !pip_att) {
pip_att = true;
digitalWrite(PIP_ATT, HIGH);
}
sendChar(myrpt->params.cw_speed, myrpt->params.cw_pitch, myrpt->callsign[i]);
delay(myrpt->params.cw_speed * 3);
}
if (!busy(myrpt) && pip_att) {
pip_att = false;
digitalWrite(PIP_ATT, LOW);
}
}
}