Merge pull request #179 from toyo/master

pull/180/head v22.13.0
Peter Buchegger 2022-03-28 11:36:58 +02:00 zatwierdzone przez GitHub
commit 5a8afeb25e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -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);

Wyświetl plik

@ -44,6 +44,7 @@ public:
int packetRssi();
float packetSnr();
long packetFrequencyError();
bool rxSignalDetected();
int rssi();

Wyświetl plik

@ -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);

Wyświetl plik

@ -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());
}
}
}