Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By dzid_
#83886 Yo, yo! Let me end this misery.

He just disabled interrupts when under certain conditions, so not really a solution if there is no external conditions available.

Apparently you need ICACHE_RAM_ATTR attribute on your_ISR() function and children functions.
void ICACHE_RAM_ATTR ISR(){};

Here is my example:
Code: Select all#include <Arduino.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <SoftwareSerial.h>
#include <FunctionalInterrupt.h>
class anySignal{  //maybe something good will class become
  public:
    anySignal(int select_pinIN, int select_pinOUT){
      pinIn=select_pinIN;
      pinOut=select_pinOUT;
    }

    void begin(int baud){
      pinMode(pinIn, INPUT);
      pinMode(pinOut, OUTPUT);
      startMirroring();
    }

    void startMirroring(){
      attachInterrupt(pinIn, [this]() { this->mirrorBit_ISR();}, CHANGE );
    }

    void stopMirroring(){
      detachInterrupt(pinIn);
    }

    boolean ICACHE_RAM_ATTR  readBit(){
        return digitalRead(pinIn);   // read the input pin
    };
   
    void ICACHE_RAM_ATTR  writeBit(boolean a){
        a ? digitalWrite(pinOut, HIGH) :  digitalWrite(pinOut, LOW) ;   // read the input pin
    }
  private:
    int pinIn;
    int pinOut;
    bool buf;
    void ICACHE_RAM_ATTR mirrorBit_ISR(){
      writeBit(readBit());
  }
};


According to the link, if I understood correctly, the children function should have the ICACHE_RAM_ATTR as well, but without them, it works as well.

Btw, this is an interrupt in a class, which was another challenge. But somehow it works now.
So enjoy