Skip to content
Snippets Groups Projects
Commit 8dfa3fa4 authored by Cyril Danilevski's avatar Cyril Danilevski
Browse files

Use WiFi stack for networking

parent 301d2cac
No related branches found
No related tags found
No related merge requests found
......@@ -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`:
......
#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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment