Uno R4 Wifi support
This commit is contained in:
parent
7a9df4aec5
commit
812661547d
@ -3,14 +3,20 @@
|
|||||||
#if defined(ARDUINO)
|
#if defined(ARDUINO)
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <HTTPClient.h>
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266httpUpdate.h>
|
#include <ESP8266httpUpdate.h>
|
||||||
|
#include <HTTPClient.h>
|
||||||
|
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
|
#include <HTTPClient.h>
|
||||||
#include <HTTPUpdate.h>
|
#include <HTTPUpdate.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
#elif defined(UNO_R4)
|
||||||
|
#include <WiFi.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* hotspotSSID = "Roboid";
|
const char* hotspotSSID = "Roboid";
|
||||||
@ -139,6 +145,9 @@ bool StartWifi(const char* wifiSsid, const char* wifiPassword, bool hotspotFallb
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckFirmware(String url, String FIRMWARE_NAME, int FIRMWARE_VERSION) {
|
void CheckFirmware(String url, String FIRMWARE_NAME, int FIRMWARE_VERSION) {
|
||||||
|
#if defined(UNO_R4) // Uno R4 Wifi does not support this kind of firmware update (as far as I know)
|
||||||
|
return;
|
||||||
|
#else
|
||||||
Serial.println("Checking for firmware updates.");
|
Serial.println("Checking for firmware updates.");
|
||||||
|
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
@ -188,5 +197,6 @@ void CheckFirmware(String url, String FIRMWARE_NAME, int FIRMWARE_VERSION) {
|
|||||||
Serial.print("Http Error: ");
|
Serial.print("Http Error: ");
|
||||||
Serial.println(httpCode);
|
Serial.println(httpCode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -7,6 +7,12 @@
|
|||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
#elif defined(UNO_R4)
|
||||||
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
#elif defined(ARDUINO_ARCH_RP2040) // not functional, for future use
|
||||||
|
#include <WifiNINA.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -19,10 +25,17 @@ void Participant::Setup(int localPort, const char* remoteIpAddress, int remotePo
|
|||||||
this->remotePort = remotePort;
|
this->remotePort = remotePort;
|
||||||
GetBroadcastAddress();
|
GetBroadcastAddress();
|
||||||
|
|
||||||
|
#if defined(UNO_R4)
|
||||||
|
if (WiFi.status() == WL_NO_MODULE) {
|
||||||
|
std::cout << "No network available!\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (WiFi.isConnected() == false) {
|
if (WiFi.isConnected() == false) {
|
||||||
std::cout << "No network available!\n";
|
std::cout << "No network available!\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
udp.begin(localPort);
|
udp.begin(localPort);
|
||||||
|
|
||||||
std::cout << "Wifi sync started to port " << this->remotePort << "\n";
|
std::cout << "Wifi sync started to port " << this->remotePort << "\n";
|
||||||
@ -70,10 +83,10 @@ void Participant::Receive() {
|
|||||||
|
|
||||||
bool Participant::Send(RemoteParticipant* remoteParticipant, int bufferSize) {
|
bool Participant::Send(RemoteParticipant* remoteParticipant, int bufferSize) {
|
||||||
#if defined(ARDUINO)
|
#if defined(ARDUINO)
|
||||||
// std::cout << "Sending to:\n " << remoteParticipant->ipAddress << ":"
|
// std::cout << "Sending to:\n " << remoteParticipant->ipAddress << ":"
|
||||||
// << remoteParticipant->port << "\n";
|
// << remoteParticipant->port << "\n";
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
do {
|
do {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
std::cout << "Retry sending\n";
|
std::cout << "Retry sending\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user