Compare commits

...

2 Commits

Author SHA1 Message Date
5ec514ca8c testing telemetry 2024-09-16 23:48:29 +01:00
dfdfe7e443 testing 2024-09-16 20:50:25 +01:00
6 changed files with 86 additions and 22 deletions

View File

@ -12,7 +12,7 @@ void setup() {
void loop() {
repeater rpt;
repeater* myrpt;
repeater *myrpt;
myrpt = &rpt;
myrpt->callsign = ID;
myrpt->params.cw_pitch = CW_PITCH;
@ -58,6 +58,8 @@ void loop() {
}
if (myrpt->state == KEYCHUNK && millis() - kc > KEYCHUNK_TIME) {
if (myrpt->params.start_up)
sendID(myrpt);
if (!myrpt->receiver.rx) {
myrpt->state = TT;
serial_writer(&myrpt->serial, "RX: RF");
@ -67,8 +69,6 @@ void loop() {
myrpt->timer.gw_start = millis();
}
tot = millis();
if (myrpt->params.start_up)
sendID(myrpt);
}
if ((myrpt->receiver.rx && myrpt->gateway.receiver.rx) && myrpt->state == KEYCHUNK) {
@ -138,7 +138,7 @@ void loop() {
serial_writer(&myrpt->serial, "REPEATER: TIMEOUT RESET");
}
if (myrpt->state > SLEEP && millis() - myrpt->id_time >= (IDTIME - 60000)) {
if (millis() - myrpt->id_time >= (IDTIME - 60000)) {
/* Check if the repeater is in use
* wait the full ID time
@ -162,4 +162,4 @@ void loop() {
tx(myrpt);
}
}
}

View File

@ -10,32 +10,32 @@
#define PIP 3
/* CW ID SETTINGS */
#define ID "MX0WVV"
#define CW_SPEED 25
#define CW_PITCH 950
#define ID "G5BSD"
#define CW_SPEED 18
#define CW_PITCH 625
/* PARAMS */
#define COURTESY CW
#define CLOSEDOWN 1
#define GWPIPLEN 1200 / CW_SPEED
#define PIP_LETTER 'W'
#define PIP_GW_LETTER 'X'
#define RFPIP 950
#define PIP_LETTER 'E'
#define PIP_GW_LETTER 'T'
#define RFPIP 1255
#define RFPIPLEN 1200 / CW_SPEED
#define START 0
#define TAILPIPS true
#define TAILPIP_PITCH 950
#define TAILPIP_PITCH 625
/* SERIAL */
#define SERIAL true
#define SERIAL_SPEED 115200
/* TIMERS */
#define HANGTIME 5000
#define KEYCHUNK_TIME 2500
#define HANGTIME 6000
#define KEYCHUNK_TIME 1000
#define TIMEOUT 300000
#define IDTIME 300000
#define PIP_KEYCHUNK 2000
#define TAIL_PIP_DELAY 1000
#define PIP_KEYCHUNK 1
#define TAIL_PIP_DELAY 3500
#endif
#endif

View File

@ -20,7 +20,7 @@ void sendChar(repeater* myrpt, char c) {
int dd = morse[index];
if (digitalRead(PIP_ATT) && myrpt->state != SLEEP)
if (digitalRead(PIP_ATT) && myrpt->state > KEYCHUNK)
digitalWrite(PIP_ATT, LOW);
for (int i=0; i < 8; i++) {
if (dd == 1) {
@ -51,7 +51,7 @@ void sendID(repeater* myrpt) {
delay(500);
if (myrpt->state == SLEEP)
if (myrpt->state < HANG)
digitalWrite(PIP_ATT, HIGH);
for (int i=0; i < sizeof ID/sizeof ID[0]; i++) {
@ -61,4 +61,3 @@ void sendID(repeater* myrpt) {
if (digitalRead(PIP_ATT))
digitalWrite(PIP_ATT, LOW);
}

View File

@ -18,7 +18,7 @@ void tx(repeater* myrpt) {
void rx(repeater* myrpt) {
myrpt->receiver.rx = digitalRead(COS);
myrpt->gateway.receiver.rx = digitalRead(GW_COS);
myrpt->gateway.receiver.rx = 1; //digitalRead(GW_COS);
if (!myrpt->receiver.rx && !myrpt->gateway.transmitter.tx) {
serial_writer(&myrpt->serial, "REPEATER: COS");
@ -113,4 +113,4 @@ void serial_writer(serial* s, char* buff) {
return;
Serial.write(buff);
Serial.write('\n');
}
}

64
GB3TX/telemetry.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef TELEMENTRY
#define TELEMENTRY
#include "repeater.h"
#include "cw.h"
#define TELE_QUEUE 5
typedef enum {
MORSE,
BEEP,
}tele_t;
typedef struct {
tele_t type;
union {
char* message;
struct {
int pitch;
int t_len;
};
};
}tele_m;
typedef struct {
tele_m tele_msg[TELE_QUEUE];
int _s;
}tele_msg;
int tele_add_cw(tele_msg *msg, tele_t type, char* message, repeater *myrpt) {
if (msg->_s >= TELE_QUEUE)
return 1;
tele_m _m;
if (type == MORSE) {
_m.type = MORSE;
_m.message = message;
} else {
return 1;
}
serial_writer(&myrpt->serial, "ADDING TELEMETRY MORSE MESSAGE");
msg->tele_msg[msg->_s++] = _m;
msg->_s++;
return 0;
}
int tele_run(tele_msg *msg, repeater *myrpt) {
if (msg->_s == 0) {
return 1;
}
for (int i=1; i < msg->_s; i++) {
if (msg->tele_msg[i-1].type == MORSE) {
sendChar(myrpt, msg->tele_msg[i-1].message[0]);
// for now dec count, need to actually remove message from list.
msg->_s--;
}
}
}
#endif

1
GB3TX/telemetry.ino Normal file
View File

@ -0,0 +1 @@