kopia lustrzana https://github.com/sh123/esp32_loraprs
Small refactoring
rodzic
5f4b5a7ddb
commit
c2e65d9bf6
|
@ -46,7 +46,8 @@ private:
|
|||
bool reconnectAprsis();
|
||||
void attachKissNetworkClient();
|
||||
|
||||
bool isRigRxBusy() const;
|
||||
inline bool isRigRxBusy() const { return config_.LoraUseCad && rigIsRxActive_; }
|
||||
|
||||
void onRigTaskRxPacket();
|
||||
void onRigTaskTxPacket();
|
||||
static void rigTask(void *self);
|
||||
|
|
|
@ -282,31 +282,34 @@ void Service::setupBt(const String &btName)
|
|||
|
||||
void Service::loop()
|
||||
{
|
||||
// wifi connectivity check
|
||||
if (needsWifi() && WiFi.status() != WL_CONNECTED) {
|
||||
reconnectWifi();
|
||||
}
|
||||
// aprs connectivity check
|
||||
if (needsAprsis() && !aprsisConnection_.connected() && config_.EnablePersistentAprsConnection) {
|
||||
reconnectAprsis();
|
||||
}
|
||||
// tcp/ip kiss client connectivity check
|
||||
if (config_.KissEnableTcpIp) {
|
||||
attachKissNetworkClient();
|
||||
}
|
||||
|
||||
// RX path, Rig -> Serial
|
||||
bool isRigToSerialProcessed = false;
|
||||
isRigToSerialProcessed = processRigToSerial();
|
||||
|
||||
// TX path, Serial -> Rig
|
||||
if (!isRigToSerialProcessed) {
|
||||
if (!processRigToSerial()) {
|
||||
|
||||
// TX path, Serial -> Rig
|
||||
long currentTime = millis();
|
||||
if (!isRigRxBusy() && currentTime > csmaSlotTimePrev_ + csmaSlotTime_ && random(0, 255) < csmaP_) {
|
||||
// new data from aprsis
|
||||
if (aprsisConnection_.available() > 0) {
|
||||
onAprsisDataAvailable();
|
||||
}
|
||||
// periodic beacon
|
||||
if (needsBeacon()) {
|
||||
sendPeriodicBeacon();
|
||||
}
|
||||
// tx if data available
|
||||
processSerialToRig();
|
||||
csmaSlotTimePrev_ = currentTime;
|
||||
}
|
||||
|
@ -318,10 +321,6 @@ void Service::loop()
|
|||
}
|
||||
}
|
||||
|
||||
bool Service::isRigRxBusy() const {
|
||||
return config_.LoraUseCad && rigIsRxActive_;
|
||||
}
|
||||
|
||||
ICACHE_RAM_ATTR void Service::onRigIsrRxPacket() {
|
||||
BaseType_t xHigherPriorityTaskWoken;
|
||||
if (rigIsRxIsrEnabled_) {
|
||||
|
|
Ładowanie…
Reference in New Issue