mirror of
https://github.com/okalachev/flix.git
synced 2026-08-16 00:38:56 +00:00
Add parameter WIFI_BROADCAST for always broadcasting mode
May be used in some cases, like multiple gcs
This commit is contained in:
+2
-1
@@ -9,7 +9,7 @@
|
|||||||
extern int channelZero[16], channelMax[16];
|
extern int channelZero[16], channelMax[16];
|
||||||
extern int rollChannel, pitchChannel, throttleChannel, yawChannel, armedChannel, modeChannel;
|
extern int rollChannel, pitchChannel, throttleChannel, yawChannel, armedChannel, modeChannel;
|
||||||
extern int rcRxPin, voltagePin;
|
extern int rcRxPin, voltagePin;
|
||||||
extern int wifiMode, wifiLongRange, udpLocalPort, udpRemotePort, espnowChannel;
|
extern int wifiMode, wifiLongRange, wifiBroadcast, udpLocalPort, udpRemotePort, espnowChannel;
|
||||||
extern float rcLossTimeout, descendTime, disarmTilt;
|
extern float rcLossTimeout, descendTime, disarmTilt;
|
||||||
extern float voltageScale;
|
extern float voltageScale;
|
||||||
extern LowPassFilter<float> voltageFilter;
|
extern LowPassFilter<float> voltageFilter;
|
||||||
@@ -121,6 +121,7 @@ Parameter parameters[] = {
|
|||||||
{"WIFI_PORT_LOC", &udpLocalPort},
|
{"WIFI_PORT_LOC", &udpLocalPort},
|
||||||
{"WIFI_PORT_REM", &udpRemotePort},
|
{"WIFI_PORT_REM", &udpRemotePort},
|
||||||
{"WIFI_LONG_RANGE", &wifiLongRange},
|
{"WIFI_LONG_RANGE", &wifiLongRange},
|
||||||
|
{"WIFI_BROADCAST", &wifiBroadcast},
|
||||||
// espnow
|
// espnow
|
||||||
{"ESPNOW_CHANNEL", &espnowChannel},
|
{"ESPNOW_CHANNEL", &espnowChannel},
|
||||||
// mavlink
|
// mavlink
|
||||||
|
|||||||
+3
-1
@@ -17,6 +17,7 @@ const int W_DISABLED = 0, W_AP = 1, W_STA = 2, W_ESPNOW = 3;
|
|||||||
int wifiMode = W_AP;
|
int wifiMode = W_AP;
|
||||||
|
|
||||||
int wifiLongRange = 0;
|
int wifiLongRange = 0;
|
||||||
|
int wifiBroadcast = 0; // 0 - broadcast until connected, 1 - always broadcast
|
||||||
int udpLocalPort = 14550;
|
int udpLocalPort = 14550;
|
||||||
int udpRemotePort = 14550;
|
int udpRemotePort = 14550;
|
||||||
IPAddress udpRemoteIP = "255.255.255.255";
|
IPAddress udpRemoteIP = "255.255.255.255";
|
||||||
@@ -64,7 +65,8 @@ void sendWiFi(const uint8_t *buf, int len) {
|
|||||||
|
|
||||||
if (WiFi.softAPgetStationNum() == 0 && !WiFi.isConnected()) return;
|
if (WiFi.softAPgetStationNum() == 0 && !WiFi.isConnected()) return;
|
||||||
|
|
||||||
udp.beginPacket(t - mavlinkTime < 5 ? udpRemoteIP : IPAddress(255, 255, 255, 255), udpRemotePort); // broadcast if lost connection
|
bool broadcast = wifiBroadcast || !(t - mavlinkTime < 5); // broadcast if lost connection
|
||||||
|
udp.beginPacket(broadcast ? IPAddress(255, 255, 255, 255) : udpRemoteIP, udpRemotePort);
|
||||||
udp.write(buf, len);
|
udp.write(buf, len);
|
||||||
udp.endPacket();
|
udp.endPacket();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user