From 0ca501dce6d3a042bbc270aafd16674a804e50b3 Mon Sep 17 00:00:00 2001 From: jimzah Date: Wed, 30 Oct 2024 20:25:37 +0000 Subject: [PATCH] Tidy --- GB3TX/GB3TX.ino | 5 ----- GB3TX/cw.ino | 3 --- GB3TX/repeater.h | 24 ------------------------ GB3TX/repeater.ino | 14 -------------- 4 files changed, 46 deletions(-) diff --git a/GB3TX/GB3TX.ino b/GB3TX/GB3TX.ino index 163a9c2..05565d4 100644 --- a/GB3TX/GB3TX.ino +++ b/GB3TX/GB3TX.ino @@ -44,9 +44,6 @@ void loop() { myrpt->id_time = 0; serial_writer(&myrpt->serial, "READY"); digitalWrite(PIP_ATT, LOW); - myrpt->stats.gw_time = 0; - myrpt->stats.tx_time = 0; - myrpt->stats.rx_time = 0; while (1) { serial_command(&myrpt->serial, myrpt); rx(myrpt); @@ -64,7 +61,6 @@ void loop() { } else { myrpt->state = GW; serial_writer(&myrpt->serial, "RX: GATEWAY"); - myrpt->timer.gw_start = millis(); } tot = millis(); if (myrpt->params.start_up && millis() - myrpt->last_id >= LAST_ID_HOLD) @@ -79,7 +75,6 @@ void loop() { if ((myrpt->receiver.rx && myrpt->gateway.receiver.rx) && myrpt->state > HANG) { serial_writer(&myrpt->serial, "HANG"); if (myrpt->state == GW) - myrpt->stats.gw_time += millis() - myrpt->timer.gw_start; delay(500); myrpt->last = myrpt->state; myrpt->state = HANG; diff --git a/GB3TX/cw.ino b/GB3TX/cw.ino index 214448d..6cb9e69 100644 --- a/GB3TX/cw.ino +++ b/GB3TX/cw.ino @@ -52,9 +52,6 @@ void sendID(repeater* myrpt) { delay(500); - //if (myrpt->state == SLEEP) - // digitalWrite(PIP_ATT, HIGH); - for (int i=0; i < sizeof ID/sizeof ID[0]; i++) { sendChar(myrpt, myrpt->callsign[i]); delay(myrpt->params.cw_speed * 3); diff --git a/GB3TX/repeater.h b/GB3TX/repeater.h index 5aca264..e1e3a39 100644 --- a/GB3TX/repeater.h +++ b/GB3TX/repeater.h @@ -32,27 +32,13 @@ typedef struct { int start_up; }params; -typedef struct { - unsigned long tx_start; - unsigned long rx_start; - unsigned long gw_start; -}timer; - -typedef struct { - unsigned long tx_time; - unsigned long rx_time; - unsigned long gw_time; -}stats; - typedef struct { bool tx; - unsigned long long tx_time; }transmitter; typedef struct { int id; bool rx; - unsigned long long rx_time; }receiver; typedef struct { @@ -75,19 +61,9 @@ typedef struct { params params; receiver receiver; serial serial; - stats stats; state state; - timer timer; transmitter transmitter; unsigned long tail; }repeater; -typedef struct { - byte type; - stats* stats; - bool transmitter; - bool receiver; - bool gateway; -}info; - #endif \ No newline at end of file diff --git a/GB3TX/repeater.ino b/GB3TX/repeater.ino index d859866..2f1e5f1 100644 --- a/GB3TX/repeater.ino +++ b/GB3TX/repeater.ino @@ -4,14 +4,12 @@ void tx(repeater* myrpt) { myrpt->transmitter.tx = true; digitalWrite(PTT,LOW); delay(100); - myrpt->timer.tx_start = millis(); return; } if (myrpt->state < KEYCHUNK && myrpt->transmitter.tx) { serial_writer(&myrpt->serial, "REPEATER: TX OFF"); myrpt->transmitter.tx = false; - myrpt->stats.tx_time += millis() - myrpt->timer.tx_start; digitalWrite(PTT,HIGH); } } @@ -24,14 +22,12 @@ void rx(repeater* myrpt) { serial_writer(&myrpt->serial, "REPEATER: COS"); digitalWrite(GWPTT, true); myrpt->gateway.transmitter.tx = true; - myrpt->timer.rx_start = millis(); return; } if (myrpt->receiver.rx && myrpt->gateway.transmitter.tx) { digitalWrite(GWPTT, false); myrpt->gateway.transmitter.tx = false; - myrpt->stats.rx_time += millis() - myrpt->timer.rx_start; } } @@ -87,21 +83,11 @@ void serial_command(serial* s, repeater* myrpt) { } break; case '3': - Serial.print("RX: "); Serial.println((myrpt->stats.rx_time /1000)); - Serial.print("TX: "); Serial.println((myrpt->stats.tx_time /1000)); - Serial.print("GW: "); Serial.println((myrpt->stats.gw_time /1000)); Serial.print("RX Status: "); Serial.println(!myrpt->receiver.rx); Serial.print("TX Status: "); Serial.println(myrpt->transmitter.tx); Serial.print("GW Status: "); Serial.println(!myrpt->gateway.receiver.rx); break; case '4': - info inf; - inf.type = 254; - inf.stats = &myrpt->stats; - inf.receiver = !myrpt->receiver.rx; - inf.transmitter = myrpt->transmitter.tx; - inf.gateway = !myrpt->gateway.receiver.rx; - Serial.write((byte*)&inf, sizeof(info) + sizeof(stats) - 4); default: break; }