mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-19 16:29:31 +00:00
Compare commits
5 Commits
626f6fa872
...
3370954edd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3370954edd | ||
![]() |
877901d229 | ||
![]() |
b2a2eb2d2e | ||
![]() |
b07f9224af | ||
![]() |
f41afb14b1 |
2
.github/actions/setup-native/action.yml
vendored
2
.github/actions/setup-native/action.yml
vendored
@ -11,4 +11,4 @@ runs:
|
|||||||
- name: Install libs needed for native build
|
- name: Install libs needed for native build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev
|
sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev libuv1-dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated).
|
; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated).
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#9f4f73c25502c435a821f36b5b1046e590153df2
|
platform = https://github.com/meshtastic/platform-native.git#df71ed0040e9aad767a002829330965b78fc452a
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
@ -823,7 +823,8 @@ void setup()
|
|||||||
LOG_DEBUG("Start multicast thread");
|
LOG_DEBUG("Start multicast thread");
|
||||||
udpThread = new UdpMulticastThread();
|
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 onNetworkConnected there
|
// FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call
|
||||||
|
// onNetworkConnected there
|
||||||
udpThread->start();
|
udpThread->start();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,13 +22,13 @@ class UdpMulticastThread : public concurrency::OSThread
|
|||||||
|
|
||||||
void start()
|
void start()
|
||||||
{
|
{
|
||||||
if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT)) {
|
if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT, 64)) {
|
||||||
#if !defined(ARCH_PORTDUINO)
|
#if !defined(ARCH_PORTDUINO)
|
||||||
// FIXME(PORTDUINO): arduino lacks IPAddress::toString()
|
// FIXME(PORTDUINO): arduino lacks IPAddress::toString()
|
||||||
LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str());
|
LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str());
|
||||||
#else
|
#else
|
||||||
LOG_DEBUG("UDP Listening");
|
LOG_DEBUG("UDP Listening");
|
||||||
#endif
|
#endif
|
||||||
udp.onPacket([this](AsyncUDPPacket packet) { onReceive(packet); });
|
udp.onPacket([this](AsyncUDPPacket packet) { onReceive(packet); });
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("Failed to listen on UDP");
|
LOG_DEBUG("Failed to listen on UDP");
|
||||||
@ -38,10 +38,10 @@ class UdpMulticastThread : public concurrency::OSThread
|
|||||||
void onReceive(AsyncUDPPacket packet)
|
void onReceive(AsyncUDPPacket packet)
|
||||||
{
|
{
|
||||||
size_t packetLength = packet.length();
|
size_t packetLength = packet.length();
|
||||||
#ifndef ARCH_PORTDUINO
|
#ifndef ARCH_PORTDUINO
|
||||||
// FIXME(PORTDUINO): arduino lacks IPAddress::toString()
|
// FIXME(PORTDUINO): arduino lacks IPAddress::toString()
|
||||||
LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength);
|
LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength);
|
||||||
#endif
|
#endif
|
||||||
meshtastic_MeshPacket mp;
|
meshtastic_MeshPacket mp;
|
||||||
LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetLength);
|
LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetLength);
|
||||||
bool isPacketDecoded = pb_decode_from_bytes(packet.data(), packetLength, &meshtastic_MeshPacket_msg, &mp);
|
bool isPacketDecoded = pb_decode_from_bytes(packet.data(), packetLength, &meshtastic_MeshPacket_msg, &mp);
|
||||||
@ -59,11 +59,11 @@ class UdpMulticastThread : public concurrency::OSThread
|
|||||||
if (!mp || !udp) {
|
if (!mp || !udp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if !defined(ARCH_PORTDUINO)
|
#if !defined(ARCH_PORTDUINO)
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id);
|
LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id);
|
||||||
uint8_t buffer[meshtastic_MeshPacket_size];
|
uint8_t buffer[meshtastic_MeshPacket_size];
|
||||||
size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp);
|
size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp);
|
||||||
|
Loading…
Reference in New Issue
Block a user