New GTIlimiter/Diverter with cascading diversion and limiting

for anyone who might be interested - a simple update to my previous GTI limiter/diverter
what is interesting about this Current Sketch.
it is designed to work with emontx sheild, an arduino plus pca9685 PWM shield
but it should also work with my espemontx adaptor shield and library and wemos D1 or arduino. it handle 16 SSR (technically +900 SSR if stacking pca9685 PWM shields) either in level or cascading bucket mode . adjustable PWM frequency- ie if using zero cross or leading edge triac based SSR then lower 128 - 255 frequency is use . if using an analog based SSR 128 - 4096 frequency can be used to divert or GTI limiting . plus the sketch still includes controls of digital pot to handle PWM using pot design at 255 steps.
it still has an intelligent bubble searches for very fast grid zeroing and with the cascade mode can be extremely accurate. smaller diverter load ie 16 - 500 watt loads at 255 steps on a zero crossing SSR has an accuracy of ~2 watts 8 kw diversion load though the arduino a bit slow for that but with wemos more the fast enough for nearly instant zeroing ( the arduino will take a 1/2 moment)

library required
emonlib if using only an arduino
PCA9685-Arduino-master library found on github

emonlibMCPScalable if using esp/arduino mcp3008 emontx
shield found in this community forum
MCP3008scalable found on this forum
if using emonMCP/mcp3008 for the esp/arduino you need to modify the sketch slightly (4.2 KB)

good luck have fun