Kernel panic. Never happened with Arduino. Confused
Posted: Sun Apr 25, 2021 5:09 pm
Hi. I am new to the esp32. I figured I would never use an Arduino again if I can have so much more power and features in the esp32. However, when I wrote a sketch to power my x10 home security system I get kernel panics (and some unexpected behavior like a routine to inexplicably change, as if I pressed a button). This is a two part question: 1) are the Arduino chips superior in stability? I have never had a kernel panic on an Arduino. If the sketch loads, it runs. If yes, I am going back to arduino 2) looking at my code below, does anyone see a reason why it would panic or why a sub-routine initiated by a button press would turn itself off? Thank you kindly. PS: I am using the Arduino IDE.
PS: This idiotic forum does limit size so I have to post my code in 2 postings
PS: This idiotic forum does limit size so I have to post my code in 2 postings
Code: Select all
#include <ESP32Time.h>
ESP32Time rtc;
#include <x10.h>
#include <x10constants.h>
#define zcPin 2//2
#define dataPin 19//13
#define repeatTimes 2
x10 myHouse;
int switch1Pin = 18;//23;
int switch2Pin = 5;//33;
int switch3Pin = 17;//25;
int led = 4;//27;
int led2 = 0;//14;
volatile int blinkToken = 0;
int var = 0;
int varMonths = 0;
int varHour = 0;
void patternHome1() {/*MAKE THINNER*/
Serial.println("patterhome1 started");
if ((varHour == 0) && (rtc.getMinute() == 31)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 32)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 37)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 42)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 43)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 0) && (rtc.getMinute() == 44)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 14)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 18)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 1) && (rtc.getMinute() == 40)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 11)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 17)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 32)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 2) && (rtc.getMinute() == 33)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 13)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 16)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 26)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 4) && (rtc.getMinute() == 28)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 6) && (rtc.getMinute() == 55)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 12)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 37)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 7) && (rtc.getMinute() == 42)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 8) && (rtc.getMinute() == 4)) {
}
if ((varHour == 20) && (rtc.getMinute() == 2)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 7)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 23)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 20) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 13)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 34)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 48)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, ON, repeatTimes);
}
if ((varHour == 21) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_A, UNIT_1, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 36)) {
myHouse.write(HOUSE_A, UNIT_2, repeatTimes);
myHouse.write(HOUSE_A, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 51)) {
myHouse.write(HOUSE_B, UNIT_2, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, OFF, repeatTimes);
}
if ((varHour == 23) && (rtc.getMinute() == 56)) {
myHouse.write(HOUSE_B, UNIT_3, repeatTimes);
myHouse.write(HOUSE_B, ON, repeatTimes);
}
}