testing telemetry

This commit is contained in:
JimZAH 2024-09-16 23:48:29 +01:00
parent dfdfe7e443
commit 5ec514ca8c
2 changed files with 65 additions and 0 deletions

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 @@