Added PTT Output for external Amplifier

This commit is contained in:
dj1an 2021-06-24 19:50:29 +02:00
parent 6587f12eb8
commit 8b75c47257
4 changed files with 52 additions and 0 deletions

View file

@ -27,5 +27,13 @@
"spreading_factor":12,
"signal_bandwidth":125000,
"coding_rate4":5
},
"ptt_output":
{
"active":false,
"io_pin": 4,
"start_delay": 0,
"end_delay": 0,
"reverse":false
}
}

View file

@ -60,6 +60,12 @@ void setup()
setup_gps();
setup_lora();
if (Config.ptt.active)
{
pinMode(Config.ptt.io_pin, OUTPUT);
digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? HIGH : LOW);
}
// make sure wifi and bt is off as we don't need it:
WiFi.mode(WIFI_OFF);
btStop();
@ -244,6 +250,13 @@ void loop()
String data = msg.encode();
logPrintlnD(data);
show_display("<< TX >>", data);
if (Config.ptt.active)
{
digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? LOW : HIGH);
delay(Config.ptt.start_delay);
}
LoRa.beginPacket();
// Header:
LoRa.write('<');
@ -261,6 +274,12 @@ void loop()
lastTxdistance = 0.0;
lastTxTime = millis();
}
if (Config.ptt.active)
{
delay(Config.ptt.end_delay);
digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? HIGH : LOW);
}
}
if(gps_time_update)

View file

@ -68,6 +68,12 @@ Configuration ConfigurationManagement::readConfiguration()
conf.lora.signalBandwidth = data["lora"]["signal_bandwidth"] | 125000;
conf.lora.codingRate4 = data["lora"]["coding_rate4"] | 5;
conf.ptt.active = data["ptt_output"]["active"] | false;
conf.ptt.io_pin = data["ptt_output"]["io_pin"] | 4;
conf.ptt.start_delay = data["ptt_output"]["start_delay"] | 0;
conf.ptt.end_delay = data["ptt_output"]["end_delay"] | 0;
conf.ptt.reverse = data["ptt_output"]["reverse"] | false;
return conf;
}
@ -104,6 +110,12 @@ void ConfigurationManagement::writeConfiguration(Configuration conf)
data["lora"]["signal_bandwidth"] = conf.lora.signalBandwidth;
data["lora"]["coding_rate4"] = conf.lora.codingRate4;
data["ptt_out"]["active"] = conf.ptt.active;
data["ptt_out"]["io_pin"] = conf.ptt.io_pin;
data["ptt_out"]["start_delay"] = conf.ptt.start_delay;
data["ptt_out"]["end_delay"] = conf.ptt.end_delay;
data["ptt_out"]["reverse"] = conf.ptt.reverse;
serializeJson(data, file);
file.close();
}

View file

@ -47,6 +47,18 @@ public:
int codingRate4;
};
class PTT
{
public:
PTT() : active(false), io_pin(4), start_delay(0), end_delay(0), reverse(false) {}
bool active;
int io_pin;
int start_delay;
int end_delay;
bool reverse;
};
Configuration() : callsign("NOCALL-10"), debug(false) {};
String callsign;
@ -54,6 +66,7 @@ public:
Beacon beacon;
Smart_Beacon smart_beacon;
LoRa lora;
PTT ptt;
};
class ConfigurationManagement