From 8dfa3fa4508208cf0a5fc56ef128a874b5106a5f Mon Sep 17 00:00:00 2001 From: Cyril Danilevski <cydanil@gmail.com> Date: Wed, 31 Jan 2024 18:49:07 +0100 Subject: [PATCH] Use WiFi stack for networking --- README.md | 6 ++++++ icbm.ino | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b1015ae..25a1654 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ ESP32 firmware for the IMC, based on Arduino and the `ESP32-Ethernet-Kit_A_V1.2` This project depends on [`Arduino_SNMP`](https://github.com/patricklaf/SNMP). +### Quirks + +Despite communication being over Ethernet, the project makes use of the ESP32 Wifi stack, hence some +references to Wifi here and there (eg. `WiFiUdp`). + + ### Installation Either use the Arduino IDE and use its library manager to find the SNMP library, or use `arduino-cli`: diff --git a/icbm.ino b/icbm.ino index d959ec3..994f17b 100644 --- a/icbm.ino +++ b/icbm.ino @@ -1,8 +1,8 @@ -#include <EthernetUdp.h> +#include <WiFiUdp.h> #include <SNMP.h> #include "esp32_ethernet.hpp" -EthernetUDP udp; +WiFiUDP udp; SNMP::Manager snmp; // Use some SNMP classes @@ -238,9 +238,9 @@ void setup() { // Start start = millis(); // MPOD - //SNMP::Message *message = mpod.setup(); - //snmp.send(message, IPAddress(10, 42, 0, 3), SNMP::PORT::SNMP); - //delete message; + SNMP::Message *message = mpod.setup(); + snmp.send(message, IPAddress(10, 42, 0, 1), SNMP::PORT::SNMP); + delete message; } enum { @@ -269,7 +269,7 @@ void loop() { // If ON or OFF, send SETREQUEST to MPOD SNMP::Message *message = mpod.output(output == ON); Serial.print("Sending message "); - snmp.send(message, IPAddress(10, 42, 0, 3), SNMP::PORT::SNMP); + snmp.send(message, IPAddress(10, 42, 0, 1), SNMP::PORT::SNMP); Serial.println("Sent"); delete message; } @@ -279,7 +279,7 @@ void loop() { start = millis(); // Create message to query MPOD and send it SNMP::Message* message = mpod.read(); - snmp.send(message, IPAddress(10, 42, 0, 3), SNMP::PORT::SNMP); + snmp.send(message, IPAddress(10, 42, 0, 1), SNMP::PORT::SNMP); delete message; } } -- GitLab