From 5ec514ca8c64e5376151d89eb6fc59c2eec90706 Mon Sep 17 00:00:00 2001 From: JimZAH Date: Mon, 16 Sep 2024 23:48:29 +0100 Subject: [PATCH] testing telemetry --- GB3TX/telemetry.h | 64 +++++++++++++++++++++++++++++++++++++++++++++ GB3TX/telemetry.ino | 1 + 2 files changed, 65 insertions(+) create mode 100644 GB3TX/telemetry.h create mode 100644 GB3TX/telemetry.ino diff --git a/GB3TX/telemetry.h b/GB3TX/telemetry.h new file mode 100644 index 0000000..e55d925 --- /dev/null +++ b/GB3TX/telemetry.h @@ -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 diff --git a/GB3TX/telemetry.ino b/GB3TX/telemetry.ino new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/GB3TX/telemetry.ino @@ -0,0 +1 @@ +