From 1cc3ef78d61c4d7bbab31d5aa49ef639297fa957 Mon Sep 17 00:00:00 2001
From: Cyril Danilevski <cydanil@gmail.com>
Date: Fri, 14 Jun 2024 16:33:02 +0200
Subject: [PATCH] Update snmp and mcp dependencies

---
 .gitlab-ci.yml |  5 +++--
 README.md      | 17 +++++++++++------
 rest.cpp       | 11 +++++++++++
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e05db73..329c547 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,12 +22,13 @@ build:
     - arduino-cli core update-index --config-file arduino-cli.yaml
     - arduino-cli core install esp32:esp32
 
-    # Add pyserial for esp32 to chooch
+    # Add pyserial for esp32 tools to chooch
     - pip3 install pyserial
 
     # Install dependencies
     - arduino-cli lib install Ethernet
-    - arduino-cli lib install --git-url https://github.com/patricklaf/SNMP.git --config-file arduino-cli.yaml
+    - arduino-cli lib install SNMP@1.4.0
+    - arduino-cli lib install MCP23S08@0.5.2
 
     # Set version, tag if available else commit sha
     - ICBM_GIT_VERSION=$CI_COMMIT_SHORT_SHA
diff --git a/README.md b/README.md
index 8b904d3..23b1300 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,11 @@
-# IMC Arduino Firmware
+# ICBM Arduino Firmware
 
-ESP32 firmware for the IMC, based on Arduino and the `ESP32-Ethernet-Kit_A_V1.2`.
+ESP32 firmware for the ICBM, based on Arduino and the `ESP32-Ethernet-Kit_A_V1.2`.
+The Intelligent Controller Board for MPODs is a project that aims to automatically
+perform power procedures upon defined inputs.  
 
-This project depends on [`Arduino_SNMP`](https://github.com/patricklaf/SNMP).
+
+This project depends on [`Arduino_SNMP`](https://github.com/patricklaf/SNMP) and [`MCP23S08`](https://github.com/RobTillaart/MCP23S08).
 
 ## Usage
 The IMC is meant to be used over network using HTTP get and post.
@@ -18,7 +21,8 @@ It can be queried as a heartbeat, seeing the uptime increasing.
 ### Serial Interface
 
 The serial interface is available through the micro-usb port.
-It prints basic networking information, as well as a heartbeat (`-` if ethernet is disconnected, else `.`).
+It prints basic networking information, as well as a heartbeat (`-` if ethernet is disconnected, else `.`).  
+It is not possible to control the device or perform queries through the serial interface.
 
 
 ## Development
@@ -62,10 +66,11 @@ Update the Arduino index with:
 
 	arduino-cli core update-index
 
-The required libraries are:
+The required libraries are (minimum versions):
 
     arduino-cli lib install ethernet
-    arduino-cli lib install --git-url https://github.com/patricklaf/SNMP.git
+    arduino-cli lib install SNMP@1.4.0
+    arduino-cli lib install MCP23S08@0.5.2
 
 The project can be compiled so:
 
diff --git a/rest.cpp b/rest.cpp
index d1d2efb..8760bba 100644
--- a/rest.cpp
+++ b/rest.cpp
@@ -52,6 +52,16 @@ void identify() {
 	message += seconds;
 	message += "\"";
 
+    // TODO: Add here mcp23s08 info:
+    // Pin status;
+    // Interrupt status;
+    // seconds since last interrupt.
+    //
+    // TODO: Add here power sequence status
+    // is_ramping_down
+    // current step
+    // percentage
+
 	message += "\n}";
 
     restServer.send(200, "text/json", message);
@@ -104,6 +114,7 @@ void sendSNMP() {
 	}
 
 	auto ipAddr = IPAddress(192,168,140,79);
+    if (output != NONE) {
 		SNMP::Message *snmp_msg = mpod.output(output);
 		snmp.send(snmp_msg, ipAddr, SNMP::PORT::SNMP);
 		delete snmp_msg;
-- 
GitLab