Compare commits

..

No commits in common. "845088e45b573496a2e58475c7141999d8b7962b" and "216fbf23434a60d200e2519c002ed1d010febdea" have entirely different histories.

9 changed files with 33 additions and 30 deletions

View File

@ -2,7 +2,7 @@
[portduino_base]
platform =
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
https://github.com/meshtastic/platform-native/archive/622341c6de8a239704318b10c3dbb00c21a3eab3.zip
https://github.com/meshtastic/platform-native/archive/e19f77e034590669feaaf26214667b76d0821d06.zip
framework = arduino
build_src_filter =

View File

@ -11,7 +11,6 @@
#ifdef ARCH_PORTDUINO
#include "PortduinoGlue.h"
#include <thread>
#endif
DeviceScreen *deviceScreen = nullptr;
@ -27,10 +26,12 @@ CallbackObserver<DeviceScreen, esp_sleep_wakeup_cause_t> endSleepObserver =
void tft_task_handler(void *param = nullptr)
{
while (true) {
spiLock->lock();
deviceScreen->task_handler();
spiLock->unlock();
deviceScreen->sleep();
if (deviceScreen) {
spiLock->lock();
deviceScreen->task_handler();
spiLock->unlock();
deviceScreen->sleep();
}
}
}
@ -115,15 +116,11 @@ void tftSetup(void)
}
#endif
if (deviceScreen) {
#ifdef ARCH_ESP32
tftSleepObserver.observe(&notifyLightSleep);
endSleepObserver.observe(&notifyLightSleepEnd);
xTaskCreatePinnedToCore(tft_task_handler, "tft", 10240, NULL, 1, NULL, 0);
#elif defined(ARCH_PORTDUINO)
std::thread *tft_task = new std::thread([] { tft_task_handler(); });
tftSleepObserver.observe(&notifyLightSleep);
endSleepObserver.observe(&notifyLightSleepEnd);
xTaskCreatePinnedToCore(tft_task_handler, "tft", 10240, NULL, 1, NULL, 0);
#endif
}
}
#endif

View File

@ -124,8 +124,8 @@ extern void tftSetup(void);
#endif
#ifdef HAS_UDP_MULTICAST
#include "mesh/udp/UdpMulticastHandler.h"
UdpMulticastHandler *udpHandler = nullptr;
#include "mesh/udp/UdpMulticastThread.h"
UdpMulticastThread *udpThread = nullptr;
#endif
#if defined(TCXO_OPTIONAL)
@ -918,12 +918,12 @@ void setup()
#ifdef HAS_UDP_MULTICAST
LOG_DEBUG("Start multicast thread");
udpHandler = new UdpMulticastHandler();
udpThread = new UdpMulticastThread();
#ifdef ARCH_PORTDUINO
// FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call
// onNetworkConnected there
if (config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
udpHandler->start();
udpThread->start();
}
#endif
#endif

View File

@ -51,8 +51,8 @@ extern AudioThread *audioThread;
#endif
#ifdef HAS_UDP_MULTICAST
#include "mesh/udp/UdpMulticastHandler.h"
extern UdpMulticastHandler *udpHandler;
#include "mesh/udp/UdpMulticastThread.h"
extern UdpMulticastThread *udpThread;
#endif
// Global Screen singleton.

View File

@ -6,7 +6,6 @@
#define ONE_MINUTE_MS 60 * 1000
#define THIRTY_SECONDS_MS 30 * 1000
#define FIVE_SECONDS_MS 5 * 1000
#define TEN_SECONDS_MS 10 * 1000
#define min_default_telemetry_interval_secs 30 * 60
#define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 60)

View File

@ -649,10 +649,8 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id);
return false;
} else if (IS_ONE_OF(meshtastic_PortNum_POSITION_APP, meshtastic_PortNum_WAYPOINT_APP, meshtastic_PortNum_ALERT_APP) &&
lastPortNumToRadio[p.decoded.portnum] &&
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], TEN_SECONDS_MS)) {
// TODO: [Issue #6700] Make this rate limit throttling scale up / down with the preset
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id);

View File

@ -293,8 +293,8 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
}
#if HAS_UDP_MULTICAST
if (udpHandler && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
udpHandler->onSend(const_cast<meshtastic_MeshPacket *>(p));
if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
udpThread->onSend(const_cast<meshtastic_MeshPacket *>(p));
}
#endif

View File

@ -13,11 +13,12 @@
#endif // HAS_ETHERNET
#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 UdpMulticastHandler final
class UdpMulticastThread : public concurrency::OSThread
{
public:
UdpMulticastHandler() { udpIpAddress = IPAddress(224, 0, 0, 69); }
UdpMulticastThread() : OSThread("UdpMulticast") { udpIpAddress = IPAddress(224, 0, 0, 69); }
void start()
{
@ -70,6 +71,14 @@ class UdpMulticastHandler final
return true;
}
protected:
int32_t runOnce() override
{
canSleep = true;
// TODO: Implement nodeinfo broadcast
return UDP_MULTICAST_THREAD_INTERVAL_MS;
}
private:
IPAddress udpIpAddress;
AsyncUDP udp;

View File

@ -133,8 +133,8 @@ static void onNetworkConnected()
}
#if HAS_UDP_MULTICAST
if (udpHandler && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
udpHandler->start();
if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) {
udpThread->start();
}
#endif
}