Merge pull request #34 from dj1an/dj1an-ptt
Added PTT Output for external Amplifier
This commit is contained in:
commit
5a28898255
|
@ -28,5 +28,13 @@
|
||||||
"spreading_factor":12,
|
"spreading_factor":12,
|
||||||
"signal_bandwidth":125000,
|
"signal_bandwidth":125000,
|
||||||
"coding_rate4":5
|
"coding_rate4":5
|
||||||
|
},
|
||||||
|
"ptt_output":
|
||||||
|
{
|
||||||
|
"active":false,
|
||||||
|
"io_pin": 4,
|
||||||
|
"start_delay": 0,
|
||||||
|
"end_delay": 0,
|
||||||
|
"reverse":false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,12 @@ void setup()
|
||||||
setup_gps();
|
setup_gps();
|
||||||
setup_lora();
|
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:
|
// make sure wifi and bt is off as we don't need it:
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
btStop();
|
btStop();
|
||||||
|
@ -263,6 +269,13 @@ void loop()
|
||||||
String data = msg.encode();
|
String data = msg.encode();
|
||||||
logPrintlnD(data);
|
logPrintlnD(data);
|
||||||
show_display("<< TX >>", 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();
|
LoRa.beginPacket();
|
||||||
// Header:
|
// Header:
|
||||||
LoRa.write('<');
|
LoRa.write('<');
|
||||||
|
@ -280,6 +293,12 @@ void loop()
|
||||||
lastTxdistance = 0.0;
|
lastTxdistance = 0.0;
|
||||||
lastTxTime = millis();
|
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)
|
if(gps_time_update)
|
||||||
|
|
|
@ -68,6 +68,12 @@ Configuration ConfigurationManagement::readConfiguration()
|
||||||
conf.lora.signalBandwidth = data["lora"]["signal_bandwidth"] | 125000;
|
conf.lora.signalBandwidth = data["lora"]["signal_bandwidth"] | 125000;
|
||||||
conf.lora.codingRate4 = data["lora"]["coding_rate4"] | 5;
|
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;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +111,12 @@ void ConfigurationManagement::writeConfiguration(Configuration conf)
|
||||||
data["lora"]["signal_bandwidth"] = conf.lora.signalBandwidth;
|
data["lora"]["signal_bandwidth"] = conf.lora.signalBandwidth;
|
||||||
data["lora"]["coding_rate4"] = conf.lora.codingRate4;
|
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);
|
serializeJson(data, file);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,18 @@ public:
|
||||||
int codingRate4;
|
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), enhance_precision(true) {};
|
Configuration() : callsign("NOCALL-10"), debug(false), enhance_precision(true) {};
|
||||||
|
|
||||||
String callsign;
|
String callsign;
|
||||||
|
@ -55,6 +67,7 @@ public:
|
||||||
Beacon beacon;
|
Beacon beacon;
|
||||||
Smart_Beacon smart_beacon;
|
Smart_Beacon smart_beacon;
|
||||||
LoRa lora;
|
LoRa lora;
|
||||||
|
PTT ptt;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigurationManagement
|
class ConfigurationManagement
|
||||||
|
|
Loading…
Reference in a new issue