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] [portduino_base]
platform = platform =
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop # 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 framework = arduino
build_src_filter = build_src_filter =

View File

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

View File

@ -124,8 +124,8 @@ extern void tftSetup(void);
#endif #endif
#ifdef HAS_UDP_MULTICAST #ifdef HAS_UDP_MULTICAST
#include "mesh/udp/UdpMulticastHandler.h" #include "mesh/udp/UdpMulticastThread.h"
UdpMulticastHandler *udpHandler = nullptr; UdpMulticastThread *udpThread = 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");
udpHandler = new UdpMulticastHandler(); udpThread = new UdpMulticastThread();
#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) {
udpHandler->start(); udpThread->start();
} }
#endif #endif
#endif #endif

View File

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

View File

@ -6,7 +6,6 @@
#define ONE_MINUTE_MS 60 * 1000 #define ONE_MINUTE_MS 60 * 1000
#define THIRTY_SECONDS_MS 30 * 1000 #define THIRTY_SECONDS_MS 30 * 1000
#define FIVE_SECONDS_MS 5 * 1000 #define FIVE_SECONDS_MS 5 * 1000
#define TEN_SECONDS_MS 10 * 1000
#define min_default_telemetry_interval_secs 30 * 60 #define min_default_telemetry_interval_secs 30 * 60
#define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 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(); meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id); service->sendQueueStatusToPhone(qs, 0, p.id);
return false; return false;
} else if (IS_ONE_OF(meshtastic_PortNum_POSITION_APP, meshtastic_PortNum_WAYPOINT_APP, meshtastic_PortNum_ALERT_APP) && } else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
lastPortNumToRadio[p.decoded.portnum] && Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], TEN_SECONDS_MS)) {
// TODO: [Issue #6700] Make this rate limit throttling scale up / down with the preset
LOG_WARN("Rate limit portnum %d", p.decoded.portnum); LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
meshtastic_QueueStatus qs = router->getQueueStatus(); meshtastic_QueueStatus qs = router->getQueueStatus();
service->sendQueueStatusToPhone(qs, 0, p.id); service->sendQueueStatusToPhone(qs, 0, p.id);

View File

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

View File

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

View File

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