kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
commit
5a8afeb25e
|
@ -18,6 +18,7 @@
|
|||
#define REG_FIFO_RX_CURRENT_ADDR 0x10
|
||||
#define REG_IRQ_FLAGS 0x12
|
||||
#define REG_RX_NB_BYTES 0x13
|
||||
#define REG_MODEM_STAT 0x18
|
||||
#define REG_PKT_SNR_VALUE 0x19
|
||||
#define REG_PKT_RSSI_VALUE 0x1a
|
||||
#define REG_RSSI_VALUE 0x1b
|
||||
|
@ -251,6 +252,10 @@ float LoRaClass::packetSnr() {
|
|||
return ((int8_t)readRegister(REG_PKT_SNR_VALUE)) * 0.25;
|
||||
}
|
||||
|
||||
bool LoRaClass::rxSignalDetected() {
|
||||
return (readRegister(REG_MODEM_STAT) & 0x01) == 0x01;
|
||||
}
|
||||
|
||||
long LoRaClass::packetFrequencyError() {
|
||||
int32_t freqError = 0;
|
||||
freqError = static_cast<int32_t>(readRegister(REG_FREQ_ERROR_MSB) & B111);
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
int packetRssi();
|
||||
float packetSnr();
|
||||
long packetFrequencyError();
|
||||
bool rxSignalDetected();
|
||||
|
||||
int rssi();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "TaskWifi.h"
|
||||
#include "project_configuration.h"
|
||||
|
||||
#define VERSION "22.12.4"
|
||||
#define VERSION "22.13.0"
|
||||
#define MODULE_NAME "Main"
|
||||
|
||||
String create_lat_aprs(double lat);
|
||||
|
|
|
@ -45,13 +45,18 @@ bool ModemTask::loop(System &system) {
|
|||
}
|
||||
|
||||
if (!_toModem.empty()) {
|
||||
std::shared_ptr<APRSMessage> msg = _toModem.getElement();
|
||||
if (system.getUserConfig()->lora.tx_enable) {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] Transmitting packet '%s'", timeString().c_str(), msg->toString().c_str());
|
||||
_lora_aprs.sendMessage(msg);
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] TX done", timeString().c_str());
|
||||
if (_lora_aprs.rxSignalDetected()) {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] RX signal detected. Waiting TX", timeString().c_str());
|
||||
delay(1000);
|
||||
} else {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] NOT transmitting packet as TX is not enabled '%s'", timeString().c_str(), msg->toString().c_str());
|
||||
std::shared_ptr<APRSMessage> msg = _toModem.getElement();
|
||||
if (system.getUserConfig()->lora.tx_enable) {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] Transmitting packet '%s'", timeString().c_str(), msg->toString().c_str());
|
||||
_lora_aprs.sendMessage(msg);
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] TX done", timeString().c_str());
|
||||
} else {
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] NOT transmitting packet as TX is not enabled '%s'", timeString().c_str(), msg->toString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue