An other guy who's, as I am, one of the 50 plus who bought that kit what went south. Discovered that the interrupt HIGH wasn't coming from the Arduino, but from the AS3935 detector module and began copy/pasting and swapping things around with the example code and got it to work-ish. It didn't work immediate after resetting, but after the first detection it did.
By looking at is I discovered he hadn't got the pinMode line in his code, so I added is and yeeeeeeeeeeee!
It worked, but no idea what we've done 
#include "I2C.h"
#include "PWFusion_AS3935_I2C.h"
#include <Adafruit_GFX.h>
#include <SoftwareSerial.h>
#include <RDKESP8266.h>
#include <EEPROM.h>
#define LINECLR 1
#define GRFCLR 1
#include <Adafruit_PCD8544.h>
#define CLK 7 //8 (7 = final, 8 = proto)
#define DIN 12 //12
#define DC 11 //11
#define CE 9 //9
#define RST 10 //10
#define LED 13
#define bckLightOff 1
#define bckLightOn 0
#define beepOn 1
#define beepOff 0
// interrupt trigger global var
volatile int8_t AS3935_ISR_Trig = 0;
// defines for hardware config
#define SI_PIN 9
#define IRQ_PIN 2
#define AS3935_ADD 0x03 // x03 - standard PWF SEN-39001-R01 config
#define AS3935_INDOORS 0
#define AS3935_OUTDOORS 1
#define AS3935_DIST_DIS 0
#define AS3935_DIST_EN 1
#define BUTTON 0
#define BEEPER 4
#define btnNone 0
#define btnRight 1
#define btnDown 2
#define btnLeft 3
#define btnUp 4
#define FROMTIME 0
#define FROMMENU 1
#define FROMLIGHTNING 2
#define FROMNOTHING 3
#define HOST "onweer.pi4raz.nl" // Host to contact
#define PAGE "/AddEvent.php?Callsign=PA2RDK&IntType=1&Distance=18" // Web page to request
#define PORT 80
#define dispMinute 0
#define dispHour 1
#define dispDay 2
#define dispStat 3
#define dispHist 4
#define dispTijd 5
#define dispLogo 6
#define dispMenu 7
#define dispMax 5
#define offsetEEPROM 0x0 //offset config
struct StoreStruct {
byte chkDigit;
char ESP_SSID[16];
char ESP_PASS[27];
char MyCall[10];
byte doorMode;
byte distMode;
byte beeperCnt;
byte AS3935_Capacitance;
byte AS3935_NoiseFloorLvl;
int timeCorrection;
byte dispScreen;
byte contrast;
};
StoreStruct storage = {
'#',
"XXX",
"XXX",
"XXX",
AS3935_OUTDOORS,
AS3935_DIST_EN,
2,
112,
2,
1,
4,
55
};
bool isConnected = false;
char receivedString[128];
char IPNo[18];
byte debug = 1;
int myButton = 0;
char chkGS[3] = "GS";
byte minutes[60];
byte maxMinute = 0;
byte divMinute = 1;
byte hours[48];
byte maxHour = 0;
byte divHour = 1;
byte heartBeatCounter = 55;
byte days[30];
byte maxDay = 0;
byte divDay = 1;
uint16_t pulses = 0;
byte minuteBeeped = 0;
unsigned long buttonTime = 0;
bool exitLoop = false;
bool dispStarted = false;
bool handleTime = 0;
int majorVersion=1;
int minorVersion=2; //Eerste uitlevering 15/11/2017
struct histData {
byte dw;
byte hr;
byte mn;
byte sc;
byte dt;
};
histData lastData[10];
byte second = 0;
byte doubleSecond = 0;
byte minute = 0;
byte lastMinute = 0;
byte hour = 0;
byte lastHour = 0;
byte dayOfWeek = 1;
byte lastDayOfWeek = 1;
byte fromSource = 0;
byte dispSide = 0;
byte startPos = 0;
byte height;
byte btnPressed = 0;
// prototypes
void AS3935_ISR();
PWF_AS3935_I2C lightning0((uint8_t)IRQ_PIN, (uint8_t)SI_PIN, (uint8_t)AS3935_ADD);
Adafruit_PCD8544 display = Adafruit_PCD8544(CLK, DIN, DC, CE, RST);
SoftwareSerial esp8266(5, 3); // RX, TX
RDKESP8266 wifi(&esp8266, &Serial, -1);
const unsigned char PROGMEM lightning_bmp[32] = {
0x01, 0xE0, 0x02, 0x20, 0x0C, 0x18, 0x12, 0x24, 0x21, 0x06, 0x10, 0x02, 0x1F, 0xFC, 0x01, 0xF0,
0x01, 0xC0, 0x03, 0x80, 0x07, 0xF8, 0x00, 0xF0, 0x00, 0xC0, 0x01, 0x80, 0x01, 0x00, 0x01, 0x00
};
void loop()
{
{
digitalWrite(2, LOW); // sets the digital pin 2 off
}
//if (buttonTime == 0) dispStop();
// reset interrupt flag
AS3935_ISR_Trig = 0;
attachInterrupt(digitalPinToInterrupt(2), AS3935_ISR, RISING);
fromSource = FROMNOTHING;
while (0 == AS3935_ISR_Trig && analogRead(BUTTON) > 500 && minute == lastMinute && !exitLoop) {
if (buttonTime > 0 && millis() - buttonTime > 10000) {
exitLoop = true;
buttonTime = 0;
}
}
exitLoop = false;
digitalWrite(LED, bckLightOff);
if (AS3935_ISR_Trig > 0){
fromSource = FROMLIGHTNING;
digitalWrite(LED, bckLightOn);
}
delay(5);
detachInterrupt(digitalPinToInterrupt(2));
myButton = analogRead(BUTTON);
if (lastMinute != minute)
{
heartBeatCounter++;
lastMinute = minute;
fromSource = FROMTIME;
if (handleTime == 0) {
moveMinutes();
if (hour != lastHour) {
lastHour = hour;
moveHours();
}
if (dayOfWeek != lastDayOfWeek) {
lastDayOfWeek = dayOfWeek;
moveDays();
}
}
}
if (heartBeatCounter == 60) {
heartBeatCounter = 0;
if (isConnected == 1) {
getNTPData();
sendToSite(0, 0);
}
}
if (myButton < 500) {
fromSource = FROMMENU;
digitalWrite(LED, bckLightOn);
handleMenu(myButton);
}
dispStart(storage.contrast);
Serial.print(F("Escaped from loop:")); Serial.print(fromSource); Serial.print(F(" Buttontime:")); Serial.println(buttonTime);
if (fromSource < FROMNOTHING) {
if (fromSource == FROMLIGHTNING) handleLighting();
dispData();
buttonTime = millis();
}
}
void dispData() {
dispInfo(0);
if (storage.dispScreen == dispMinute) {
printMinutes();
}
if (storage.dispScreen == dispHour) {
printHours();
}
if (storage.dispScreen == dispDay) {
printDays();
}
if (storage.dispScreen == dispStat) {
printStat();
}
if (storage.dispScreen == dispHist) {
printHist();
}
if (storage.dispScreen == dispTijd) {
printTime();
}
if (storage.dispScreen == dispLogo) {
printLogo();
}
refreshDisplay();
}
The only thing left is it freezing up from a user standpoint, it might wait for input of the website and spinning it's wheels, meanwhile I can't operate the buttons nor does it detect. Seemingly it ends up in this status when the connection with the website is lost. I can replecate the situation, but not every time.
By just letting it be and operate will end up in this status every time eventually.
Whats the smart question I have to ask myself?
as3935_lightning_i2c_nocal.ino (6.78 KB)