SeanMcKeen / IT-Lablights

1 stars 0 forks source link

<!DOCTYPE HTML>

SNMP Lablights Project

This Project is intended for my personal use and was made solely by me, others may use it for their own purposes if they find it useful.

Overview

This Project is an fully configurable LED project that uses SNMP data in order to display lights that show network traffic. Currently pulses have a small trail effect, and can go forward and backward on the strip with Independant data. This means that your first strip can show network traffic on a set list of ports, and the next strip can use another list of ports. This is a seamless process and you will see no lag on your lights while it's polling SNMP. Also, it will not pollute or spam your switch as long as the delay is set at 10 or more seconds. (You may be able to go less, but I wouldn't recommend it).

Roadmap

Eventually I intend to add display/screen functionality for devices like the lilygo and m5stick-c, but as of right now that is a low priority.

Some Important Functions

snmpgrab.h

void SNMPsetup(int Array[]) -- Sets up a list of ports that you will be pulling data from. void snmpLoop(int Array[], int arrayCount, int arrayIndex) -- Calculates the average difference in data since the last poll coming IN and OUT of the switch. void printVariableHeader() -- Prints switch name & uptime to serial monitor. void printVariableFooter() -- Prints elapsed time between polls and summary of data. void callLoop -- Should be called as often as possible according to SNMP library documentation

lablights.h

void initFastLED() -- Will add your strip to fastled index (required) void litArray() -- Must be called in every iteration of your main loop() function (runs as a frame) void forwardEvent(CRGB fColor, int strip) -- Sends a pulse down the strip from index 0. void reverseEvent(CRGB rColor, int strip) -- Sends a pulse towards the beginning from the end of the strip.

mathhandler.cpp handles the data thresholds for colors and pulse amounts, change it to your liking.

Other Important Info

- YOU MUST EDIT YOUR SETTINGS IN globals.h & platformio.ini - Change your WIFI in secrets.h - Make sure platformio is building for your device

Currently Supported Devices: LilyGo T-Display S3, M5Stick-C

Instructions (READ CAREFULLY)

For 4 or Fewer Strips:

- Change your settings in globals.h and secrets.h, making sure everything is set for your device. - In platformio.ini, make sure there's a build for your device, if not, you may have to create it yourself through trial and error. - After setting your arrays and strips in globals.h everything should work without changing anything up to a total of 4 strips.

To Add More Strips:

- Establish new variables in globals.h and change MAX_CHANNELS to the amount of strips you'll use. - In lablights.cpp, fix the #IF statement on lines 14-26 to add bools for your new strips. - Also in lablights.cpp, set more LedSplits on line 31 and repeat the process in initFastLed() for each strip. - In lablights.h extern the bools. - In main.cpp there will be blocks of variables from line 15 to 67, you'll need to follow the instructions in the comments. - On line 76 add arrays, then in setup() follow the pattern and add your arrays to SNMPsetup() - Replicate the process done inside loop() on line 150 to 162 for each strip, changing variable names to the ones you made before. - On line 165 to 173, repeat that process with the variables you made before. - Then call each pulse just as it is done below that on lines 178 to 188. - Then move to snmp.cpp, on lines 47 to 54, replicate that process for each strip. - Again, replicate the process on lines 72 to 82 for each strip. - In handleAllOutputs() again, continue the process for the totals at the top of it. - Then, also in handleAllOutputs(), replicate the else if() loops for each arrayIndex (arrayIndex means strip number) - The first For loop is for INs and the second is for OUTs, you need to continue the else if()s in both. - Remember to change every variable that has a number like lastInOctets4 to lastInOctets5 - in setTotals() again, replicate for each arrayIndex - Optionally you can replicate the print process in printVariableFooter() for debugging. - Finally, in snmpgrab.h, extern each arrTotals variable at the top as done already.