mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-06 06:52:26 +00:00
Take copilot advice and call it a handler
This commit is contained in:
parent
f20c8290d2
commit
9f393dacae
@ -124,8 +124,8 @@ extern void tftSetup(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_UDP_MULTICAST
|
#ifdef HAS_UDP_MULTICAST
|
||||||
#include "mesh/udp/UdpMulticastThread.h"
|
#include "mesh/udp/UdpMulticastHandler.h"
|
||||||
UdpMulticastThread *udpThread = nullptr;
|
UdpMulticastHandler *udpHandler = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TCXO_OPTIONAL)
|
#if defined(TCXO_OPTIONAL)
|
||||||
@ -918,12 +918,12 @@ void setup()
|
|||||||
|
|
||||||
#ifdef HAS_UDP_MULTICAST
|
#ifdef HAS_UDP_MULTICAST
|
||||||
LOG_DEBUG("Start multicast thread");
|
LOG_DEBUG("Start multicast thread");
|
||||||
udpThread = new UdpMulticastThread();
|
udpHandler = new UdpMulticastHandler();
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
// FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call
|
// FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call
|
||||||
// onNetworkConnected there
|
// onNetworkConnected there
|
||||||
if (config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
if (config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
||||||
udpThread->start();
|
udpHandler->start();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,8 +51,8 @@ extern AudioThread *audioThread;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_UDP_MULTICAST
|
#ifdef HAS_UDP_MULTICAST
|
||||||
#include "mesh/udp/UdpMulticastThread.h"
|
#include "mesh/udp/UdpMulticastHandler.h"
|
||||||
extern UdpMulticastThread *udpThread;
|
extern UdpMulticastHandler *udpHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Global Screen singleton.
|
// Global Screen singleton.
|
||||||
|
@ -293,8 +293,8 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_UDP_MULTICAST
|
#if HAS_UDP_MULTICAST
|
||||||
if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
if (udpHandler && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
||||||
udpThread->onSend(const_cast<meshtastic_MeshPacket *>(p));
|
udpHandler->onSend(const_cast<meshtastic_MeshPacket *>(p));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -13,12 +13,11 @@
|
|||||||
#endif // HAS_ETHERNET
|
#endif // HAS_ETHERNET
|
||||||
|
|
||||||
#define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server
|
#define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server
|
||||||
#define UDP_MULTICAST_THREAD_INTERVAL_MS 15000
|
|
||||||
|
|
||||||
class UdpMulticastThread final
|
class UdpMulticastHandler final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UdpMulticastThread() { udpIpAddress = IPAddress(224, 0, 0, 69); }
|
UdpMulticastHandler() { udpIpAddress = IPAddress(224, 0, 0, 69); }
|
||||||
|
|
||||||
void start()
|
void start()
|
||||||
{
|
{
|
@ -133,8 +133,8 @@ static void onNetworkConnected()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_UDP_MULTICAST
|
#if HAS_UDP_MULTICAST
|
||||||
if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
if (udpHandler && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
|
||||||
udpThread->start();
|
udpHandler->start();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user