Skip to content

Commit

Permalink
ESP_Gaszaehler_V1_91_Core263_ICACHE_RAM
Browse files Browse the repository at this point in the history
Core 2.6.3
add ICACHE_RAM_ATTR to ISR
  • Loading branch information
elektron-bbs committed Feb 14, 2020
1 parent f1f7587 commit 3357ec6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 48 deletions.
48 changes: 47 additions & 1 deletion ESP-Gaszaehler-GZ16.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const float ADC_DIV = 190.0; // Divisor für Batteriespannung bei HW-Vers
#endif

#define VERSION 1
#define BUILD 90
#define BUILD 91
#define DEBUG_OUTPUT_SERIAL false
//#define DEBUG_OUTPUT_SERIAL true

Expand Down Expand Up @@ -170,6 +170,52 @@ boolean saveLogDayBool = false;
boolean SerialOutput; // serielle Ausgabe ein/aus
long DiagrammTimestamp;

void ICACHE_RAM_ATTR Interrupt_Button() {
int reading = digitalRead(Input_Button); // Get the pin reading.
if (reading == Button_Input_State) return; // Ignore dupe readings.
boolean debounce = false;
// Check to see if the change is within a debounce delay threshold.
if ((millis() - Button_last_debounce_time) <= Button_debounce_delay) {
debounce = true;
}
// This update to the last debounce check is necessary regardless of debounce state.
Button_last_debounce_time = millis();
if (debounce) return; // Ignore reads within a debounce delay threshold.
Button_Input_State = reading; // All is good, persist the reading as the state.
if (Button_Input_State == 0) { // Botton pressed
Button_Press_Time = 0;
Button_Press_Count++; // increase button press count
digitalWrite(LED_red, LOW) ; // LED ein
if (SerialOutput == 1) { // serielle Ausgabe eingeschaltet
Serial.print(F("Button pressed #"));
Serial.println(Button_Press_Count);
}
}
}

void ICACHE_RAM_ATTR Interrupt_S0() {
int reading = digitalRead(Input_S0_Count); // Get the pin reading.
if (reading == S0_Input_State) return; // Ignore dupe readings.
boolean debounce = false;
// Check to see if the change is within a debounce delay threshold.
if ((millis() - S0_last_debounce_time) <= S0_debounce_delay) {
debounce = true;
}
// This update to the last debounce check is necessary regardless of debounce state.
S0_last_debounce_time = millis();
if (debounce) return; // Ignore reads within a debounce delay threshold.
S0_Input_State = reading; // All is good, persist the reading as the state.
if (S0_Input_State == 0) { // S0-Pulse finished
s0_count_abs++; // increase S0-Counter
s0_count_mqtt++; // increase S0-Counter MQTT
s0_count_hour++; // increase S0-Counter hour
s0_count_day++; // increase S0-Counter day
s0_count_month++; // increase S0-Counter month
s0_count_year++; // increase S0-Counter year
S0_count_changed = true; // S0-Counts changed
}
}

void setup (void) {
// set pins to output
pinMode(LED_yellow, OUTPUT);
Expand Down
46 changes: 0 additions & 46 deletions Misc.ino
Original file line number Diff line number Diff line change
@@ -1,49 +1,3 @@
void Interrupt_Button() {
int reading = digitalRead(Input_Button); // Get the pin reading.
if (reading == Button_Input_State) return; // Ignore dupe readings.
boolean debounce = false;
// Check to see if the change is within a debounce delay threshold.
if ((millis() - Button_last_debounce_time) <= Button_debounce_delay) {
debounce = true;
}
// This update to the last debounce check is necessary regardless of debounce state.
Button_last_debounce_time = millis();
if (debounce) return; // Ignore reads within a debounce delay threshold.
Button_Input_State = reading; // All is good, persist the reading as the state.
if (Button_Input_State == 0) { // Botton pressed
Button_Press_Time = 0;
Button_Press_Count++; // increase button press count
digitalWrite(LED_red, LOW) ; // LED ein
if (SerialOutput == 1) { // serielle Ausgabe eingeschaltet
Serial.print(F("Button pressed #"));
Serial.println(Button_Press_Count);
}
}
}

void Interrupt_S0() {
int reading = digitalRead(Input_S0_Count); // Get the pin reading.
if (reading == S0_Input_State) return; // Ignore dupe readings.
boolean debounce = false;
// Check to see if the change is within a debounce delay threshold.
if ((millis() - S0_last_debounce_time) <= S0_debounce_delay) {
debounce = true;
}
// This update to the last debounce check is necessary regardless of debounce state.
S0_last_debounce_time = millis();
if (debounce) return; // Ignore reads within a debounce delay threshold.
S0_Input_State = reading; // All is good, persist the reading as the state.
if (S0_Input_State == 0) { // S0-Pulse finished
s0_count_abs++; // increase S0-Counter
s0_count_mqtt++; // increase S0-Counter MQTT
s0_count_hour++; // increase S0-Counter hour
s0_count_day++; // increase S0-Counter day
s0_count_month++; // increase S0-Counter month
s0_count_year++; // increase S0-Counter year
S0_count_changed = true; // S0-Counts changed
}
}

String WebsiteStatistikJahreszeiten(String str, byte monat, long s0_count_ges_int, int tage, String ye) {
if (SerialOutput == 1) { // serielle Ausgabe eingeschaltet
Serial.print(F("S0-Count Jahreszeit "));
Expand Down
12 changes: 11 additions & 1 deletion ZLog.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@
D:\Eigene Dateien\Eigene Dokumente\Arduino\tools\ESP8266FS\tool\esp8266fs.jar
---------------------------------------------------------------------------------------------------------------------
2020-02-14
Interrupt-Routinen verschoben von Misc.ino in ESP_Gaszaehler_V1_91_Core263_ICACHE_RAM.ino
und Attribut ICACHE_RAM_ATTR bei beiden ISR hinzugefügt.
Der Sketch verwendet 478224 Bytes (45%) des Programmspeicherplatzes. Das Maximum sind 1044464 Bytes.
Globale Variablen verwenden 36976 Bytes (45%) des dynamischen Speichers, 44944 Bytes für lokale Variablen verbleiben. Das Maximum sind 81920 Bytes.
Arduino 1.8.10, esp8266-2.6.3 - ESP_Gaszaehler_V1_91_Core263_ICACHE_RAM
-----------------------------------------------------------------------
2019-11-23
Versuch Firmwareupdate mit esp8266-2.6.1 - dauernde Neustarts, zurück auf esp8266-2.5.0
Der Sketch verwendet 468988 Bytes (44%) des Programmspeicherplatzes. Das Maximum sind 1044464 Bytes.
Globale Variablen verwenden 37740 Bytes (46%) des dynamischen Speichers, 44180 Bytes für lokale Variablen verbleiben. Das Maximum sind 81920 Bytes.
Expand Down

0 comments on commit 3357ec6

Please sign in to comment.