Problem with two digitalPinToInterrupt on Nano

Can not make work two digitalPinToInterrupt on nano.
One or another works well.
RoofSensor and all application does work for few months.
Trying to add one more WindGuage and even setup() doesn't work (at the end of setup it should be message "Program started", bit no message when two digitalPinToInterrupt in setup().

Could you please help with my problem

#include <SoftwareSerial.h>
//#include <OneWire.h>
#include <stdio.h>

//Pronting to Bluetooth or defailt Serial ports
#define BT

//Define LED Modes and initiate LED variables
#define Led_OFF  0b0000000000000000
#define Led_ON   0b1111111111111111
#define Led_1_1  0b0101010101010101
#define Led_1_3  0b0001000100010001
#define Led_3_1  0b0111011101110111
#define Led_1_7  0b0000000100000001
#define Led_7_1  0b0111111101111111
#define Led_1_15 0b0000000000000001
#define Led_15_1 0b0111111111111111
#define Led_2_2  0b0011001100110011
#define Led_2_6  0b0000001100000011
#define Led_6_2  0b0011111100111111
#define Led_2_14 0b0000000000000011
#define Led_14_2 0b0011111111111111
#define Led_4_4  0b0000111100001111
#define Led_4_12 0b0000000000001111
#define Led_12_4 0b0000111111111111
#define Led_8_8  0b0000000011111111
unsigned int LED_Mode = Led_OFF;            //Variable keeps currnet LED mode
unsigned int oldLED_Mode = Led_ON;          //Variable keeps previous LED mode
byte LED_Status = LED_Mode & 0b1;  //Variable keeps currnet LED status
//Programm will curcle with left shift LED_Mode on each programm loop

#define WindGuage 2           // Wind speed guage based on Interruptins(Interruptions allowed only on D2 and D3)
                              // Count rotates of the Wind Guage (for future use)
#define RoofSensor 3          // RoofSensor to Interrupt and status (Interruptions allowed only on D2 and D3)
                              // LOW - Roof opened; HIGH - Roof Closed
#define RainSensorPower 4     // Reserved Powering RainSensor on demand
#define RainSensor 5          // Rain Sensor Digital input.
                              // Pin is LOW when precipitation detected 
#define OneWirePin 6          // OneWire Pin (CURRENTLY NOT IN USE)
#define BTSerialRX 7          // BlueTooth RX Pin - the pin on which Arduino to receive serial data
#define BTSerialTX 8          // BlueTooth TX Pin - the pin on which Arduino to transmit serial data 
#define ActuatorRetButton 10  // Switch or Button for Activating Retraction of Actuatorunsigned (PULLED UP, Low when pressed)
#define ActuatorExtButton 11  // Switch or Button for Activating Extraction of Actuator (PULLED UP, Low when pressed)
                              // Keep pressed to use ControlPower to Open andd Close the Roof
#define ControlPower 12       // Control Power Source (5V - 12V) Status.
                              // Pin is LOW when Power is OK.
#define StatusLED 13          // Buildin Status LED
#define ActuatorRet A0        // Actuator Retraction to Relay 1 (with two Normal-Closed Micro Switches for Emergency Stop Retraction)
                              // "+" on Actuator Connector
#define ActuatorExt A1        // Actuator Extraction to Relay 2 (with embedded in Actuator Full Extraction Auto Stop Switch)
                              // "-" on Actuator Connector
#define Locker A2             // Roof locker to Relay 3
#define Reserved A3           // Reserved to Relay 4 (NOT IN USE)
#define RetPower A7           // Status received back from IN1 of Relay Module (Retraction Power). Not always accurate
                              // <10 - Roof is closing; <1023 - Roof is closed; =1023 - Roof is opened

#define LoopDelay 100                                                    //Milliseconds of delay between program loops
float LoopDurartion = (float)LoopDelay/1000;                             //Milliseconds of delay between program loops
byte MaxExtractionDuration = 90;                                         //Maximum duration of Actuator Extraction in seconds
byte MaxRetractionDuration = 90;                                         //Maximum duration of Actuator Retraction in seconds
unsigned int MaxExtractionLoops = MaxExtractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int MaxRetractionLoops = MaxRetractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int RemainActuatorLoops;                                        //How many programm loops ramain before stop Actuator
unsigned int RecoveryDelay = 10;                                         //Recovery time for failed power or Trigered Rain Sensor in seconds
unsigned int RecoveryLoops = RecoveryDelay/LoopDurartion;                //Recovery time for failed power or Trigered Rain Sensor in programm loops
unsigned int RemainRecoveryLoops;                                        //How many programm loops remain before Actuator can be used
unsigned int ReinSensorSleepTimer = 15;                                  //Sleep timer in seconds for Rain Sensor when Roof Closed to reduce Sensor corrosion
                                                                         //Should be higher than RecoveryDelay as during it could be sent to sleep during recovery
unsigned int ReinSensorSleepLoops = ReinSensorSleepTimer/LoopDurartion;  //Sleep timer in loops for Rain Sensor when Roof Closed to reduce Sensor corrosion
unsigned int ReinSensorWakeUpTimer = 600;                                //WakeUp timer in seconds for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorWakeUpLoops = ReinSensorWakeUpTimer/LoopDurartion;//WakeUp timer in loops for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorSleepTracker = 0;                                 //Counter the loops RainSensor Active after the Roof closed and sensor does not sleep
unsigned int ReinSensorWakeUpTracker = 0;                                //Counter the loops RainSensor Inactive to wake it up and check is Rain
boolean RainSensorMemory = HIGH;                                         //To remember last Rain status when sendor is sleeping
unsigned int ReportFrequince = 1;                                        //Reports frequince in Seconds
unsigned int ReportFrequinceLoops = ReportFrequince/LoopDurartion;       //Reports frequince in Loops
unsigned int ReportFrequinceTracker = 0;                                 //Coonter the loops from previous report
boolean RoofClosed = true;                                               //Keep previous Roof status. Consider Roof Closed when controller started
boolean NormalOperations = true;                                         //Tracking operation mode by checking ControlPower and Precipoitation Sensor
#define DUMMY  0                                                         //No roof operation 
#define BUTTON  1                                                        //Operation activated by Button
#define COMMAND 2                                                        //Operation activated by Command
#define INTERRUPT 3                                                      //Operation activated by Interruntion
char ActivationType = DUMMY;                                             //Activation type: 0 - No ongoing operations; 1 - Activated by Button; 2 - Activated by Command; 3 - Interruption happened

SoftwareSerial BTSerial (BTSerialRX,BTSerialTX);                         //00:14:03:05:5a:52

   
void setup() {
  //Initializing Pins
  //Relays at first
  pinMode(ActuatorRet, OUTPUT);
  digitalWrite(ActuatorRet, HIGH);
  pinMode(ActuatorExt, OUTPUT);
  digitalWrite(ActuatorExt, HIGH);
  pinMode(Locker, OUTPUT);
  digitalWrite(Locker, HIGH);
  pinMode(Reserved, OUTPUT);
  digitalWrite(Reserved, HIGH);
  //Other Pins
  pinMode(RoofSensor, INPUT_PULLUP);
  pinMode(RainSensor, INPUT_PULLUP);
  pinMode(WindGuage, INPUT_PULLUP);
  pinMode(RainSensorPower, OUTPUT);
  digitalWrite(RainSensorPower, HIGH);
  //OneWire ds(OneWirePin);
  pinMode(RetPower, INPUT);
  pinMode(ActuatorRetButton, INPUT_PULLUP);
  pinMode(ActuatorExtButton, INPUT_PULLUP);
  pinMode(ControlPower, INPUT_PULLUP);
  pinMode(StatusLED, OUTPUT);
  digitalWrite(StatusLED, LOW);

  attachInterrupt(digitalPinToInterrupt(RoofSensor),intRoofClosed,FALLING);
  delay(100);
  //attachInterrupt(digitalPinToInterrupt(WindGuage),intWindGuage,FALLING);
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
    Lock();
  } else {
    RoofClosed = false;
  }
 
  Serial.begin(9600);
  BTSerial.begin(9600);
  echo("Program started");
}

void loop() {
....

Where are your ISRs ?

void intRoofClosed() {
  if (digitalRead(ActuatorRet) == LOW) {
    echo("Received Roof closed interraption.");
    StopRoof(INTERRUPT);
    RoofClosed = true;
  }
}

void intWindGuage() {
  echo("Turn");
}

Full code is bellow:

#include <SoftwareSerial.h>
//#include <OneWire.h>
#include <stdio.h>

//Pronting to Bluetooth or defailt Serial ports
#define BT

//Define LED Modes and initiate LED variables
#define Led_OFF  0b0000000000000000
#define Led_ON   0b1111111111111111
#define Led_1_1  0b0101010101010101
#define Led_1_3  0b0001000100010001
#define Led_3_1  0b0111011101110111
#define Led_1_7  0b0000000100000001
#define Led_7_1  0b0111111101111111
#define Led_1_15 0b0000000000000001
#define Led_15_1 0b0111111111111111
#define Led_2_2  0b0011001100110011
#define Led_2_6  0b0000001100000011
#define Led_6_2  0b0011111100111111
#define Led_2_14 0b0000000000000011
#define Led_14_2 0b0011111111111111
#define Led_4_4  0b0000111100001111
#define Led_4_12 0b0000000000001111
#define Led_12_4 0b0000111111111111
#define Led_8_8  0b0000000011111111
unsigned int LED_Mode = Led_OFF;            //Variable keeps currnet LED mode
unsigned int oldLED_Mode = Led_ON;          //Variable keeps previous LED mode
byte LED_Status = LED_Mode & 0b1;  //Variable keeps currnet LED status
//Programm will curcle with left shift LED_Mode on each programm loop

#define WindGuage 2           // Wind speed guage based on Interruptins(Interruptions allowed only on D2 and D3)
                              // Count rotates of the Wind Guage (for future use)
#define RoofSensor 3          // RoofSensor to Interrupt and status (Interruptions allowed only on D2 and D3)
                              // LOW - Roof opened; HIGH - Roof Closed
#define RainSensorPower 4     // Reserved Powering RainSensor on demand
#define RainSensor 5          // Rain Sensor Digital input.
                              // Pin is LOW when precipitation detected 
#define OneWirePin 6          // OneWire Pin (CURRENTLY NOT IN USE)
#define BTSerialRX 7          // BlueTooth RX Pin - the pin on which Arduino to receive serial data
#define BTSerialTX 8          // BlueTooth TX Pin - the pin on which Arduino to transmit serial data 
#define ActuatorRetButton 10  // Switch or Button for Activating Retraction of Actuatorunsigned (PULLED UP, Low when pressed)
#define ActuatorExtButton 11  // Switch or Button for Activating Extraction of Actuator (PULLED UP, Low when pressed)
                              // Keep pressed to use ControlPower to Open andd Close the Roof
#define ControlPower 12       // Control Power Source (5V - 12V) Status.
                              // Pin is LOW when Power is OK.
#define StatusLED 13          // Buildin Status LED
#define ActuatorRet A0        // Actuator Retraction to Relay 1 (with two Normal-Closed Micro Switches for Emergency Stop Retraction)
                              // "+" on Actuator Connector
#define ActuatorExt A1        // Actuator Extraction to Relay 2 (with embedded in Actuator Full Extraction Auto Stop Switch)
                              // "-" on Actuator Connector
#define Locker A2             // Roof locker to Relay 3
#define Reserved A3           // Reserved to Relay 4 (NOT IN USE)
#define RetPower A7           // Status received back from IN1 of Relay Module (Retraction Power). Not always accurate
                              // <10 - Roof is closing; <1023 - Roof is closed; =1023 - Roof is opened

#define LoopDelay 100                                                    //Milliseconds of delay between program loops
float LoopDurartion = (float)LoopDelay/1000;                             //Milliseconds of delay between program loops
byte MaxExtractionDuration = 90;                                         //Maximum duration of Actuator Extraction in seconds
byte MaxRetractionDuration = 90;                                         //Maximum duration of Actuator Retraction in seconds
unsigned int MaxExtractionLoops = MaxExtractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int MaxRetractionLoops = MaxRetractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int RemainActuatorLoops;                                        //How many programm loops ramain before stop Actuator
unsigned int RecoveryDelay = 10;                                         //Recovery time for failed power or Trigered Rain Sensor in seconds
unsigned int RecoveryLoops = RecoveryDelay/LoopDurartion;                //Recovery time for failed power or Trigered Rain Sensor in programm loops
unsigned int RemainRecoveryLoops;                                        //How many programm loops remain before Actuator can be used
unsigned int ReinSensorSleepTimer = 15;                                  //Sleep timer in seconds for Rain Sensor when Roof Closed to reduce Sensor corrosion
                                                                         //Should be higher than RecoveryDelay as during it could be sent to sleep during recovery
unsigned int ReinSensorSleepLoops = ReinSensorSleepTimer/LoopDurartion;  //Sleep timer in loops for Rain Sensor when Roof Closed to reduce Sensor corrosion
unsigned int ReinSensorWakeUpTimer = 600;                                //WakeUp timer in seconds for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorWakeUpLoops = ReinSensorWakeUpTimer/LoopDurartion;//WakeUp timer in loops for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorSleepTracker = 0;                                 //Counter the loops RainSensor Active after the Roof closed and sensor does not sleep
unsigned int ReinSensorWakeUpTracker = 0;                                //Counter the loops RainSensor Inactive to wake it up and check is Rain
boolean RainSensorMemory = HIGH;                                         //To remember last Rain status when sendor is sleeping
unsigned int ReportFrequince = 1;                                        //Reports frequince in Seconds
unsigned int ReportFrequinceLoops = ReportFrequince/LoopDurartion;       //Reports frequince in Loops
unsigned int ReportFrequinceTracker = 0;                                 //Coonter the loops from previous report
boolean RoofClosed = true;                                               //Keep previous Roof status. Consider Roof Closed when controller started
boolean NormalOperations = true;                                         //Tracking operation mode by checking ControlPower and Precipoitation Sensor
#define DUMMY  0                                                         //No roof operation 
#define BUTTON  1                                                        //Operation activated by Button
#define COMMAND 2                                                        //Operation activated by Command
#define INTERRUPT 3                                                      //Operation activated by Interruntion
char ActivationType = DUMMY;                                             //Activation type: 0 - No ongoing operations; 1 - Activated by Button; 2 - Activated by Command; 3 - Interruption happened

SoftwareSerial BTSerial (BTSerialRX,BTSerialTX);                         //00:14:03:05:5a:52

   
void setup() {
  //Initializing Pins
  //Relays at first
  pinMode(ActuatorRet, OUTPUT);
  digitalWrite(ActuatorRet, HIGH);
  pinMode(ActuatorExt, OUTPUT);
  digitalWrite(ActuatorExt, HIGH);
  pinMode(Locker, OUTPUT);
  digitalWrite(Locker, HIGH);
  pinMode(Reserved, OUTPUT);
  digitalWrite(Reserved, HIGH);
  //Other Pins
  pinMode(RoofSensor, INPUT_PULLUP);
  pinMode(RainSensor, INPUT_PULLUP);
  pinMode(WindGuage, INPUT_PULLUP);
  pinMode(RainSensorPower, OUTPUT);
  digitalWrite(RainSensorPower, HIGH);
  //OneWire ds(OneWirePin);
  pinMode(RetPower, INPUT);
  pinMode(ActuatorRetButton, INPUT_PULLUP);
  pinMode(ActuatorExtButton, INPUT_PULLUP);
  pinMode(ControlPower, INPUT_PULLUP);
  pinMode(StatusLED, OUTPUT);
  digitalWrite(StatusLED, LOW);

  attachInterrupt(digitalPinToInterrupt(RoofSensor),intRoofClosed,FALLING);
  delay(100);
  //attachInterrupt(digitalPinToInterrupt(WindGuage),intWindGuage,FALLING);
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
    Lock();
  } else {
    RoofClosed = false;
  }
 
  Serial.begin(9600);
  BTSerial.begin(9600);
  echo("Program started");
}

void loop() {

  if (digitalRead(ControlPower) == HIGH or ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW))){
  //if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)){
    //Environment is not suitable for Telescop Operations.

    if (NormalOperations) {
      //It has just happenes.
      
      //Logging Event
      if (digitalRead(ControlPower) == HIGH) {
        echo("Control Power has just faled.");
      }
      if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)) {
        echo("Precipitation sensor just triggered.");
      }
      CloseRoof(MaxRetractionLoops,COMMAND);

    } else {
 
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      } else {
        if (digitalRead(RoofSensor) == LOW) {
          echo("Roof still be opened!!!");
          CloseRoof(MaxRetractionLoops/2,COMMAND);  
        }
      }

     RemainRecoveryLoops = RecoveryLoops; //Recovery hasn't started
 
      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    }
    NormalOperations = false;

  } else {
    // Environment  is acceptable for Telescop Operations

    NormalOperations = true;
    if (RemainRecoveryLoops > 0 ) {
      // Environment is acceptable for Telescop Operations but recover delay is still in progress, no normal oiperations permitted
 
      if (RemainRecoveryLoops == RecoveryLoops ) {
            Wakeup();
            //Logging Event
            echo("Recovery initiated");
      }
      if (RemainRecoveryLoops == 1 ) {
            //Logging Event
            echo("Operations Recovered");
      }

      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      RemainRecoveryLoops = RemainRecoveryLoops - 1;

      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    } else {
      //Normal roof operartional mode
      //NormalOperations = true;      //CHECK
      
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        CloseRoof(1,BUTTON);
      } else if (digitalRead(ActuatorExtButton) == LOW) {
        //Acruator Extraction Button Pressed
        OpenRoof(1,BUTTON);
      }
    }
  }


  //Circular shifting to the left the bits in the LED_Mode, Updatthe LED
  LED_Status = LED_Mode & 0b1;
  digitalWrite(StatusLED, LED_Status);
  LED_Mode = LED_Mode >> 1;
  bitWrite(LED_Mode,15,LED_Status);

  //Tracking if Rain Sensor can be send to sleep 
  if (digitalRead(RoofSensor) == HIGH) {
    if (digitalRead(RainSensorPower) == HIGH){
      RainSensorMemory = digitalRead(RainSensor);
      if (ReinSensorSleepTracker < ReinSensorSleepLoops) {
        ReinSensorSleepTracker = ReinSensorSleepTracker +1;
      } else {
        ReinSensorWakeUpTracker = 0;
        digitalWrite(RainSensorPower,LOW);
        //Logging Event
        echo("Precipitation Sensor sent to sleep.");
      }
    }
  } else {
    ReinSensorSleepTracker = 0;
  }
  
  //Tracking if Rain Sensor must be waked up
  if (digitalRead(RainSensorPower) == LOW){
    if (ReinSensorWakeUpTracker < ReinSensorWakeUpLoops) {
      ReinSensorWakeUpTracker += 1;
    } else {
      Wakeup();
    }
  }

  ReportFrequinceTracker += 1;
  if (ReportFrequinceTracker >= ReportFrequinceLoops) {
    ReportFrequinceTracker = 0;
    Report();
  }


  delay(LoopDelay);
}

void Lock() {
  //Lock the Roof
  if (digitalRead(Locker)) {
    digitalWrite(Locker, LOW);
    echo("Roof has been lock");
  }
}

void Unlock() {
  //Unlock the Roof
  if (!digitalRead(Locker)) {
    digitalWrite(Locker, HIGH);
    echo("Roof has been unlock");
  }
}

void Report() {
  unsigned int code = 0; 
  if (digitalRead(RoofSensor) == LOW) {
    code += 128;
  }
  if (!digitalRead(Locker)) {
    code += 64;
  }
  if (!digitalRead(ActuatorRet)) {
    code += 32;
  }
  if (!digitalRead(ActuatorExt)) {
    code += 16;
  }
  if (digitalRead(RainSensorPower) == LOW) {
    code += 8;
    if (RainSensorMemory == LOW) {
      code += 4;
    }
  } else if (digitalRead(RainSensor) == LOW) {
    code += 4;
  }
  if (digitalRead(ControlPower) == HIGH) {
    code += 1;
  }
  echo("Status: " + String(code)+" "+String(digitalRead(WindGuage)));
}

void StopRoof(char Type) {

  //Logging Event
  if (Type == BUTTON) {
    echo("Button Released");
  } else if (Type == COMMAND) {
    echo("Roof command completed");
  } else if (Type == INTERRUPT) {
    echo("Roof operation interrupted.");
  } else {
    echo("Roof operation stopped by command");
  }

  unsigned int isRetraction = digitalRead(ActuatorRet);
  digitalWrite(ActuatorExt, HIGH);
  digitalWrite(ActuatorRet, HIGH);
  RemainActuatorLoops = 0;

  //Check Roof Sensor if operation was closing (ActuatorRet == LOW)
  delay(10);
  if (isRetraction == LOW and digitalRead(RoofSensor) == LOW) {
    echo("Roof Senser reports it still be opened!");
    setLED(Led_ON);
  } else {
    Lock();
    setLED(Led_OFF);
  }

  ActivationType = DUMMY;
}

void CloseRoof(int Duration, char Type) {

  //Verify RootSensor one more time; update status
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
  } else {
    RoofClosed = false;
  }
 
  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if closing operation already in progress
    if (digitalRead(ActuatorRet) != LOW and !RoofClosed) {
      echo("Closing the Roof by button.");
    }
  } else {
    echo("Closing the Roof by command.");
  }

  if (RoofClosed) {
    if (Type == COMMAND) {
      echo("Closing the Roof ignored as RoofSensor reports Roof is closed.");
      Lock();
    }
  } else {
    digitalWrite(ActuatorExt, HIGH);
    delay(50);
    digitalWrite(ActuatorRet, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
  
    setLED(Led_1_1);
    ActivationType = Type;
  }
}

void Wakeup() {
  if (digitalRead(RainSensorPower) == LOW) {
    digitalWrite(RainSensorPower, HIGH);
    //Logging Event
    echo("Precipitation Sensor waked up.");
    delay(100);
  }
  ReinSensorSleepTracker = 0;
}

void OpenRoof(int Duration, char Type) {

  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if openning operation already in progress
    if (digitalRead(ActuatorExt) != LOW) {
      echo("Openning the Roof by button.");
    }
  } else {
    echo("Openning the Roof by command.");
  }

  RoofClosed = false; //Consider Roof not closed

  Wakeup();
  
  //Disable roof opening if Precipitation Sensor triggered
  if (digitalRead(RainSensor) == LOW){
    echo("Roof should not be open when Precipitation Sensor tirggered !");
  } else {
    Unlock();
    digitalWrite(ActuatorRet, HIGH);
    delay(50);
    digitalWrite(ActuatorExt, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
    setLED(Led_8_8);
    ActivationType = Type;
  }
}

void intRoofClosed() {
  if (digitalRead(ActuatorRet) == LOW) {
    echo("Received Roof closed interraption.");
    StopRoof(INTERRUPT);
    RoofClosed = true;
  }
}

void intWindGuage() {
  echo("Turn");
}

void setLED(int newLED_Mode) {
  if (oldLED_Mode != newLED_Mode) {
    oldLED_Mode = newLED_Mode;
    LED_Mode = newLED_Mode;
  }
}

void echo(String msg) {
//  timestamp();
  #ifdef BT
    BTSerial.println(msg);
  #else
    Serial.println(msg);
  #endif
}

I removed echo() from second ISR and it looks it started.
Probably calling the same function echo() was a problem.

I can go without echo(), as it was added just to check if interruption works.
It still be strange and I am worrying will face the same problem down the road writing the code.

Neither Serial print nor software serial print will work and they can cause problems in an ISR. Both rely on interrupts and interrupts are disabled during an ISR.

Thank you!

Apparently this is no longer the case.

It looks for me now that some problem with (String) construction, but not with ISRs

In main loop
Works:

unsigned int strangetest = Wsize;

Doesn't work:

String strangetest = (String)Wsize;

All code:

#include <SoftwareSerial.h>
//#include <OneWire.h>
#include <stdio.h>

//Pronting to Bluetooth or defailt Serial ports
#define BT

//Define LED Modes and initiate LED variables
#define Led_OFF  0b0000000000000000
#define Led_ON   0b1111111111111111
#define Led_1_1  0b0101010101010101
#define Led_1_3  0b0001000100010001
#define Led_3_1  0b0111011101110111
#define Led_1_7  0b0000000100000001
#define Led_7_1  0b0111111101111111
#define Led_1_15 0b0000000000000001
#define Led_15_1 0b0111111111111111
#define Led_2_2  0b0011001100110011
#define Led_2_6  0b0000001100000011
#define Led_6_2  0b0011111100111111
#define Led_2_14 0b0000000000000011
#define Led_14_2 0b0011111111111111
#define Led_4_4  0b0000111100001111
#define Led_4_12 0b0000000000001111
#define Led_12_4 0b0000111111111111
#define Led_8_8  0b0000000011111111
unsigned int LED_Mode = Led_OFF;            //Variable keeps currnet LED mode
unsigned int oldLED_Mode = Led_ON;          //Variable keeps previous LED mode
byte LED_Status = LED_Mode & 0b1;  //Variable keeps currnet LED status
//Programm will curcle with left shift LED_Mode on each programm loop

#define WindGuage 2           // Wind speed guage based on Interruptins(Interruptions allowed only on D2 and D3)
                              // Count rotates of the Wind Guage (for future use)
#define RoofSensor 3          // RoofSensor to Interrupt and status (Interruptions allowed only on D2 and D3)
                              // LOW - Roof opened; HIGH - Roof Closed
#define RainSensorPower 4     // Reserved Powering RainSensor on demand
#define RainSensor 5          // Rain Sensor Digital input.
                              // Pin is LOW when precipitation detected 
#define OneWirePin 6          // OneWire Pin (CURRENTLY NOT IN USE)
#define BTSerialRX 7          // BlueTooth RX Pin - the pin on which Arduino to receive serial data
#define BTSerialTX 8          // BlueTooth TX Pin - the pin on which Arduino to transmit serial data 
#define ActuatorRetButton 10  // Switch or Button for Activating Retraction of Actuatorunsigned (PULLED UP, Low when pressed)
#define ActuatorExtButton 11  // Switch or Button for Activating Extraction of Actuator (PULLED UP, Low when pressed)
                              // Keep pressed to use ControlPower to Open andd Close the Roof
#define ControlPower 12       // Control Power Source (5V - 12V) Status.
                              // Pin is LOW when Power is OK.
#define StatusLED 13          // Buildin Status LED
#define ActuatorRet A0        // Actuator Retraction to Relay 1 (with two Normal-Closed Micro Switches for Emergency Stop Retraction)
                              // "+" on Actuator Connector
#define ActuatorExt A1        // Actuator Extraction to Relay 2 (with embedded in Actuator Full Extraction Auto Stop Switch)
                              // "-" on Actuator Connector
#define Locker A2             // Roof locker to Relay 3
#define Reserved A3           // Reserved to Relay 4 (NOT IN USE)
#define RetPower A7           // Status received back from IN1 of Relay Module (Retraction Power). Not always accurate
                              // <10 - Roof is closing; <1023 - Roof is closed; =1023 - Roof is opened

#define LoopDelay 100                                                    //Milliseconds of delay between program loops
float LoopDurartion = (float)LoopDelay/1000;                             //Milliseconds of delay between program loops
byte MaxExtractionDuration = 90;                                         //Maximum duration of Actuator Extraction in seconds
byte MaxRetractionDuration = 90;                                         //Maximum duration of Actuator Retraction in seconds
unsigned int MaxExtractionLoops = MaxExtractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int MaxRetractionLoops = MaxRetractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int RemainActuatorLoops;                                        //How many programm loops ramain before stop Actuator
unsigned int RecoveryDelay = 10;                                         //Recovery time for failed power or Trigered Rain Sensor in seconds
unsigned int RecoveryLoops = RecoveryDelay/LoopDurartion;                //Recovery time for failed power or Trigered Rain Sensor in programm loops
unsigned int RemainRecoveryLoops;                                        //How many programm loops remain before Actuator can be used
unsigned int ReinSensorSleepTimer = 15;                                  //Sleep timer in seconds for Rain Sensor when Roof Closed to reduce Sensor corrosion
                                                                         //Should be higher than RecoveryDelay as during it could be sent to sleep during recovery
unsigned int ReinSensorSleepLoops = ReinSensorSleepTimer/LoopDurartion;  //Sleep timer in loops for Rain Sensor when Roof Closed to reduce Sensor corrosion
unsigned int ReinSensorWakeUpTimer = 600;                                //WakeUp timer in seconds for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorWakeUpLoops = ReinSensorWakeUpTimer/LoopDurartion;//WakeUp timer in loops for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorSleepTracker = 0;                                 //Counter the loops RainSensor Active after the Roof closed and sensor does not sleep
unsigned int ReinSensorWakeUpTracker = 0;                                //Counter the loops RainSensor Inactive to wake it up and check is Rain
boolean RainSensorMemory = HIGH;                                         //To remember last Rain status when sendor is sleeping
unsigned int ReportFrequince = 1;                                        //Reports frequince in Seconds
unsigned int ReportFrequinceLoops = ReportFrequince/LoopDurartion;       //Reports frequince in Loops
unsigned int ReportFrequinceTracker = 0;                                 //Coonter the loops from previous report
boolean RoofClosed = true;                                               //Keep previous Roof status. Consider Roof Closed when controller started
boolean NormalOperations = true;                                         //Tracking operation mode by checking ControlPower and Precipoitation Sensor
#define DUMMY  0                                                         //No roof operation 
#define BUTTON  1                                                        //Operation activated by Button
#define COMMAND 2                                                        //Operation activated by Command
#define INTERRUPT 3                                                      //Operation activated by Interruntion
char ActivationType = DUMMY;                                             //Activation type: 0 - No ongoing operations; 1 - Activated by Button; 2 - Activated by Command; 3 - Interruption happened
volatile unsigned int Wintervals[25];                                    //Array to keep intervals (miliseconds) between Wind Guage ticks
const unsigned int Wsize = sizeof(Wintervals)/2;                           //Size of Wintervals[]
volatile unsigned int Wcurrent = 0;                                      //Carrend element of Wintervals[] array to update
volatile unsigned long Wtotal = 0;                                        //Total meleseconds for all intervals
volatile unsigned int Wlast = 0;                                         //Timer of the last Wind Tick
volatile unsigned int Wspeed = 0;                                         //Wind speed in Ticks/sec
const float Wcoefficient = 2.4*(Wlast)/1000;                             //Wind speed coeficient - Not in use. Used RPMs

SoftwareSerial BTSerial (BTSerialRX,BTSerialTX);                         //00:14:03:05:5a:52

   
void setup() {
  //Initializing Pins
  //Relays at first
  pinMode(ActuatorRet, OUTPUT);
  digitalWrite(ActuatorRet, HIGH);
  pinMode(ActuatorExt, OUTPUT);
  digitalWrite(ActuatorExt, HIGH);
  pinMode(Locker, OUTPUT);
  digitalWrite(Locker, HIGH);
  pinMode(Reserved, OUTPUT);
  digitalWrite(Reserved, HIGH);
  //Other Pins
  pinMode(RoofSensor, INPUT_PULLUP);
  pinMode(RainSensor, INPUT_PULLUP);
  pinMode(WindGuage, INPUT_PULLUP);
  pinMode(RainSensorPower, OUTPUT);
  digitalWrite(RainSensorPower, HIGH);
  //OneWire ds(OneWirePin);
  pinMode(RetPower, INPUT);
  pinMode(ActuatorRetButton, INPUT_PULLUP);
  pinMode(ActuatorExtButton, INPUT_PULLUP);
  pinMode(ControlPower, INPUT_PULLUP);
  pinMode(StatusLED, OUTPUT);
  digitalWrite(StatusLED, LOW);

  
  for( int i=0; i < Wsize; i++) {
    const int Winit = 10000;
    Wintervals[i] = Winit;
    Wtotal += Winit;
  }
  Wlast = millis();
  Wspeed = 1000*Wsize/Wtotal;
  
  
  attachInterrupt(digitalPinToInterrupt(RoofSensor),intRoofClosed,FALLING);
  attachInterrupt(digitalPinToInterrupt(WindGuage),intWindGuage,FALLING);
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
    Lock();
  } else {
    RoofClosed = false;
  }
 
  Serial.begin(9600);
  BTSerial.begin(9600);
  echo("Program started");
}

void loop() {

  //String strangetest = (String)Wsize;
  unsigned int strangetest = Wsize;
  //echo(strangetest);
  

  if (digitalRead(ControlPower) == HIGH or ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW))){
  //if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)){
    //Environment is not suitable for Telescop Operations.

    if (NormalOperations) {
      //It has just happenes.
      
      //Logging Event
      if (digitalRead(ControlPower) == HIGH) {
        echo("Control Power has just faled.");
      }
      if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)) {
        echo("Precipitation sensor just triggered.");
      }
      CloseRoof(MaxRetractionLoops,COMMAND);

    } else {
 
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      } else {
        if (digitalRead(RoofSensor) == LOW) {
          echo("Roof still be opened!!!");
          CloseRoof(MaxRetractionLoops/2,COMMAND);  
        }
      }

     RemainRecoveryLoops = RecoveryLoops; //Recovery hasn't started
 
      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    }
    NormalOperations = false;

  } else {
    // Environment  is acceptable for Telescop Operations

    NormalOperations = true;
    if (RemainRecoveryLoops > 0 ) {
      // Environment is acceptable for Telescop Operations but recover delay is still in progress, no normal oiperations permitted
 
      if (RemainRecoveryLoops == RecoveryLoops ) {
            Wakeup();
            //Logging Event
            echo("Recovery initiated");
      }
      if (RemainRecoveryLoops == 1 ) {
            //Logging Event
            echo("Operations Recovered");
      }

      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      RemainRecoveryLoops = RemainRecoveryLoops - 1;

      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    } else {
      //Normal roof operartional mode
      //NormalOperations = true;      //CHECK
      
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        CloseRoof(1,BUTTON);
      } else if (digitalRead(ActuatorExtButton) == LOW) {
        //Acruator Extraction Button Pressed
        OpenRoof(1,BUTTON);
      }
    }
  }


  //Circular shifting to the left the bits in the LED_Mode, Updatthe LED
  LED_Status = LED_Mode & 0b1;
  digitalWrite(StatusLED, LED_Status);
  LED_Mode = LED_Mode >> 1;
  bitWrite(LED_Mode,15,LED_Status);

  //Tracking if Rain Sensor can be send to sleep 
  if (digitalRead(RoofSensor) == HIGH) {
    if (digitalRead(RainSensorPower) == HIGH){
      RainSensorMemory = digitalRead(RainSensor);
      if (ReinSensorSleepTracker < ReinSensorSleepLoops) {
        ReinSensorSleepTracker = ReinSensorSleepTracker +1;
      } else {
        ReinSensorWakeUpTracker = 0;
        digitalWrite(RainSensorPower,LOW);
        //Logging Event
        echo("Precipitation Sensor sent to sleep.");
      }
    }
  } else {
    ReinSensorSleepTracker = 0;
  }
  
  //Tracking if Rain Sensor must be waked up
  if (digitalRead(RainSensorPower) == LOW){
    if (ReinSensorWakeUpTracker < ReinSensorWakeUpLoops) {
      ReinSensorWakeUpTracker += 1;
    } else {
      Wakeup();
    }
  }

  ReportFrequinceTracker += 1;
  if (ReportFrequinceTracker >= ReportFrequinceLoops) {
    ReportFrequinceTracker = 0;
    int test = 555;
    Report((String)test);
    //Report((String)Wsize);
  }


  delay(LoopDelay);
}

void Lock() {
  //Lock the Roof
  if (digitalRead(Locker)) {
    digitalWrite(Locker, LOW);
    echo("Roof has been lock");
  }
}

void Unlock() {
  //Unlock the Roof
  if (!digitalRead(Locker)) {
    digitalWrite(Locker, HIGH);
    echo("Roof has been unlock");
  }
}

void Report(String Wind) {
  unsigned int code = 0; 
  if (digitalRead(RoofSensor) == LOW) {
    code += 128;
  }
  if (!digitalRead(Locker)) {
    code += 64;
  }
  if (!digitalRead(ActuatorRet)) {
    code += 32;
  }
  if (!digitalRead(ActuatorExt)) {
    code += 16;
  }
  if (digitalRead(RainSensorPower) == LOW) {
    code += 8;
    if (RainSensorMemory == LOW) {
      code += 4;
    }
  } else if (digitalRead(RainSensor) == LOW) {
    code += 4;
  }
  if (digitalRead(ControlPower) == HIGH) {
    code += 1;
  }
  echo("Status: " + String(code)+" "+Wind);
}

void StopRoof(char Type) {

  //Logging Event
  if (Type == BUTTON) {
    echo("Button Released");
  } else if (Type == COMMAND) {
    echo("Roof command completed");
  } else if (Type == INTERRUPT) {
    echo("Roof operation interrupted.");
  } else {
    echo("Roof operation stopped by command");
  }

  unsigned int isRetraction = digitalRead(ActuatorRet);
  digitalWrite(ActuatorExt, HIGH);
  digitalWrite(ActuatorRet, HIGH);
  RemainActuatorLoops = 0;

  //Check Roof Sensor if operation was closing (ActuatorRet == LOW)
  delay(10);
  if (isRetraction == LOW and digitalRead(RoofSensor) == LOW) {
    echo("Roof Senser reports it still be opened!");
    setLED(Led_ON);
  } else {
    Lock();
    setLED(Led_OFF);
  }

  ActivationType = DUMMY;
}

void CloseRoof(int Duration, char Type) {

  //Verify RootSensor one more time; update status
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
  } else {
    RoofClosed = false;
  }
 
  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if closing operation already in progress
    if (digitalRead(ActuatorRet) != LOW and !RoofClosed) {
      echo("Closing the Roof by button.");
    }
  } else {
    echo("Closing the Roof by command.");
  }

  if (RoofClosed) {
    if (Type == COMMAND) {
      echo("Closing the Roof ignored as RoofSensor reports Roof is closed.");
      Lock();
    }
  } else {
    digitalWrite(ActuatorExt, HIGH);
    delay(50);
    digitalWrite(ActuatorRet, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
  
    setLED(Led_1_1);
    ActivationType = Type;
  }
}

void Wakeup() {
  if (digitalRead(RainSensorPower) == LOW) {
    digitalWrite(RainSensorPower, HIGH);
    //Logging Event
    echo("Precipitation Sensor waked up.");
    delay(100);
  }
  ReinSensorSleepTracker = 0;
}

void OpenRoof(int Duration, char Type) {

  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if openning operation already in progress
    if (digitalRead(ActuatorExt) != LOW) {
      echo("Openning the Roof by button.");
    }
  } else {
    echo("Openning the Roof by command.");
  }

  RoofClosed = false; //Consider Roof not closed

  Wakeup();
  
  //Disable roof opening if Precipitation Sensor triggered
  if (digitalRead(RainSensor) == LOW){
    echo("Roof should not be open when Precipitation Sensor tirggered !");
  } else {
    Unlock();
    digitalWrite(ActuatorRet, HIGH);
    delay(50);
    digitalWrite(ActuatorExt, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
    setLED(Led_8_8);
    ActivationType = Type;
  }
}

void intRoofClosed() {
  if (digitalRead(ActuatorRet) == LOW) {
    echo("Received Roof closed interraption.");
    StopRoof(INTERRUPT);
    RoofClosed = true;
  }
}

void intWindGuage() {
  //WindTick(0);
  /**
  unsigned long interval = millis() - Wlast;
  if (interval <= 0) {
    interval = Wtotal/Wsize;
  }
  Wtotal = Wtotal-Wintervals[Wcurrent]+interval;
  Wintervals[Wcurrent] = interval;
  Wlast = millis();
  Wspeed = 1000*Wsize/Wtotal;
  Wcurrent = (Wcurrent+1)%Wsize;
  **/
}


void setLED(int newLED_Mode) {
  if (oldLED_Mode != newLED_Mode) {
    oldLED_Mode = newLED_Mode;
    LED_Mode = newLED_Mode;
  }
}

void echo(String msg) {
  //detachInterrupt(digitalPinToInterrupt(RoofSensor));
  //detachInterrupt(digitalPinToInterrupt(WindGuage));
  //#ifdef BT
    BTSerial.println(msg);
  //#else
  //  Serial.println(msg);
  //#endif
  //attachInterrupt(digitalPinToInterrupt(RoofSensor),intRoofClosed,FALLING);
  //attachInterrupt(digitalPinToInterrupt(WindGuage),intWindGuage,FALLING);
}

It looks it doesn't work with any arrays including (String) as a chr array. Checking if i can do this operations atomar.

Gave up on (String), rewrite roport() function like:

  #ifdef BT
    BTSerial.print("Status: ");
    BTSerial.print(code);
    BTSerial.print(" ");
    BTSerial.println(Wspeed);
  #else
    Serial.print("Status: ");
    Serial.print(code);
    Serial.print(" ");
    Serial.println(Wspeed);
  #endif

Rush into the next problem.
Whenever I try to modify from ISR global volatile variable application doesn't work.
Any commented lines from ISR will not let application to start:

void intWindGuage() {
  unsigned long interval = millis() - Wlast;
  if (interval <= 0) {
    interval = Wtotal/Wsize;
  }
  /**
  Wtotal = Wtotal-Wintervals[Wcurrent]+interval;
  Wintervals[Wcurrent] = interval;
  Wlast = millis();
  Wspeed = 1000*Wsize/Wtotal;
  Wcurrent = (Wcurrent+1)%Wsize;
  **/
}

should be volatile

Thank you!

Made RoofClosed and all variables from called from ISR function volatile, but still not able to change any of global variables from second ISR.

volatile unsigned int LED_Mode = Led_OFF;            //Variable keeps currnet LED mode
volatile unsigned int oldLED_Mode = Led_ON;          //Variable keeps previous LED mode
volatile unsigned int RemainActuatorLoops;                                        //How many programm loops ramain before stop Actuator

volatile boolean RoofClosed = true;                                               //Keep previous Roof status. Consider Roof Closed when controller started

And the first ISR() works for several months even without making theses variables volatile.

Try CHANGE mode instead of FALLING to see if both are triggered at least, if so, you can then add additional check inside ISR to use CHANGE

For NANO, A6 and A7 are always analog lines. They are not supposed to be used as digital IO lines. However, it can be used as digital input line provided that the input high value is above >= 3V (VIH).

Sorry for long response.

Yes, CHANE triggers ISR in both directions.

I can not believe.
RepPower was abandoned time ago as it didn't work as expected.
So it is only pin definition and mode was in program.
Commenting these two lines looks like resolved my problems.

While I was fighting with the issues I rewrite ISR to use mostly local static variables.

Thank you all for help and I will continue to optimize it (and probably check if I can return (String) back.

Current code:

#include <SoftwareSerial.h>
//#include <OneWire.h>
#include <stdio.h>

//Pronting to Bluetooth or defailt Serial ports
#define BT

//Define LED Modes and initiate LED variables
#define Led_OFF  0b0000000000000000
#define Led_ON   0b1111111111111111
#define Led_1_1  0b0101010101010101
#define Led_1_3  0b0001000100010001
#define Led_3_1  0b0111011101110111
#define Led_1_7  0b0000000100000001
#define Led_7_1  0b0111111101111111
#define Led_1_15 0b0000000000000001
#define Led_15_1 0b0111111111111111
#define Led_2_2  0b0011001100110011
#define Led_2_6  0b0000001100000011
#define Led_6_2  0b0011111100111111
#define Led_2_14 0b0000000000000011
#define Led_14_2 0b0011111111111111
#define Led_4_4  0b0000111100001111
#define Led_4_12 0b0000000000001111
#define Led_12_4 0b0000111111111111
#define Led_8_8  0b0000000011111111
volatile unsigned int LED_Mode = Led_OFF;            //Variable keeps currnet LED mode
volatile unsigned int oldLED_Mode = Led_ON;          //Variable keeps previous LED mode
byte LED_Status = LED_Mode & 0b1;  //Variable keeps currnet LED status
//Programm will curcle with left shift LED_Mode on each programm loop

#define WindGuage 2           // Wind speed guage based on Interruptins(Interruptions allowed only on D2 and D3)
                              // Count rotates of the Wind Guage (for future use)
#define RoofSensor 3          // RoofSensor to Interrupt and status (Interruptions allowed only on D2 and D3)
                              // LOW - Roof opened; HIGH - Roof Closed
#define RainSensorPower 4     // Reserved Powering RainSensor on demand
#define RainSensor 5          // Rain Sensor Digital input.
                              // Pin is LOW when precipitation detected 
#define OneWirePin 6          // OneWire Pin (CURRENTLY NOT IN USE)
#define BTSerialRX 7          // BlueTooth RX Pin - the pin on which Arduino to receive serial data
#define BTSerialTX 8          // BlueTooth TX Pin - the pin on which Arduino to transmit serial data 
#define ActuatorRetButton 10  // Switch or Button for Activating Retraction of Actuatorunsigned (PULLED UP, Low when pressed)
#define ActuatorExtButton 11  // Switch or Button for Activating Extraction of Actuator (PULLED UP, Low when pressed)
                              // Keep pressed to use ControlPower to Open andd Close the Roof
#define ControlPower 12       // Control Power Source (5V - 12V) Status.
                              // Pin is LOW when Power is OK.
#define StatusLED 13          // Buildin Status LED
#define ActuatorRet A0        // Actuator Retraction to Relay 1 (with two Normal-Closed Micro Switches for Emergency Stop Retraction)
                              // "+" on Actuator Connector
#define ActuatorExt A1        // Actuator Extraction to Relay 2 (with embedded in Actuator Full Extraction Auto Stop Switch)
                              // "-" on Actuator Connector
#define Locker A2             // Roof locker to Relay 3
#define Reserved A3           // Reserved to Relay 4 (NOT IN USE)
//#define RetPower A7           // Status received back from IN1 of Relay Module (Retraction Power). Not always accurate
                              // <10 - Roof is closing; <1023 - Roof is closed; =1023 - Roof is opened

#define LoopDelay 100                                                    //Milliseconds of delay between program loops
float LoopDurartion = (float)LoopDelay/1000;                             //Milliseconds of delay between program loops
byte MaxExtractionDuration = 90;                                         //Maximum duration of Actuator Extraction in seconds
byte MaxRetractionDuration = 90;                                         //Maximum duration of Actuator Retraction in seconds
unsigned int MaxExtractionLoops = MaxExtractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
unsigned int MaxRetractionLoops = MaxRetractionDuration/LoopDurartion;   //Maximum duration of Actuator Move in programm loops
volatile unsigned int RemainActuatorLoops;                                        //How many programm loops ramain before stop Actuator
unsigned int RecoveryDelay = 10;                                         //Recovery time for failed power or Trigered Rain Sensor in seconds
unsigned int RecoveryLoops = RecoveryDelay/LoopDurartion;                //Recovery time for failed power or Trigered Rain Sensor in programm loops
unsigned int RemainRecoveryLoops;                                        //How many programm loops remain before Actuator can be used
unsigned int ReinSensorSleepTimer = 15;                                  //Sleep timer in seconds for Rain Sensor when Roof Closed to reduce Sensor corrosion
                                                                         //Should be higher than RecoveryDelay as during it could be sent to sleep during recovery
unsigned int ReinSensorSleepLoops = ReinSensorSleepTimer/LoopDurartion;  //Sleep timer in loops for Rain Sensor when Roof Closed to reduce Sensor corrosion
unsigned int ReinSensorWakeUpTimer = 600;                                //WakeUp timer in seconds for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorWakeUpLoops = ReinSensorWakeUpTimer/LoopDurartion;//WakeUp timer in loops for Rain Sensor when Roof Closed to periodically check Rain Sensors
unsigned int ReinSensorSleepTracker = 0;                                 //Counter the loops RainSensor Active after the Roof closed and sensor does not sleep
unsigned int ReinSensorWakeUpTracker = 0;                                //Counter the loops RainSensor Inactive to wake it up and check is Rain
boolean RainSensorMemory = HIGH;                                         //To remember last Rain status when sendor is sleeping
unsigned int ReportFrequince = 1;                                        //Reports frequince in Seconds
unsigned int ReportFrequinceLoops = ReportFrequince/LoopDurartion;       //Reports frequince in Loops
unsigned int ReportFrequinceTracker = 0;                                 //Coonter the loops from previous report
volatile boolean RoofClosed = true;                                               //Keep previous Roof status. Consider Roof Closed when controller started
boolean NormalOperations = true;                                         //Tracking operation mode by checking ControlPower and Precipoitation Sensor
#define DUMMY  0                                                         //No roof operation 
#define BUTTON  1                                                        //Operation activated by Button
#define COMMAND 2                                                        //Operation activated by Command
#define INTERRUPT 3                                                      //Operation activated by Interruntion
char ActivationType = DUMMY;                                             //Activation type: 0 - No ongoing operations; 1 - Activated by Button; 2 - Activated by Command; 3 - Interruption happened
volatile unsigned int Wspeed = 0;                                        //Wind speed in Ticks/sec
volatile boolean Wactive = false;                                        //Wind Guage genarate at least one interruption

SoftwareSerial BTSerial (BTSerialRX,BTSerialTX);                         //00:14:03:05:5a:52

   
void setup() {
  //Initializing Pins
  //Relays at first
  pinMode(ActuatorRet, OUTPUT);
  digitalWrite(ActuatorRet, HIGH);
  pinMode(ActuatorExt, OUTPUT);
  digitalWrite(ActuatorExt, HIGH);
  pinMode(Locker, OUTPUT);
  digitalWrite(Locker, HIGH);
  pinMode(Reserved, OUTPUT);
  digitalWrite(Reserved, HIGH);
  //Other Pins
  pinMode(RoofSensor, INPUT_PULLUP);
  pinMode(RainSensor, INPUT_PULLUP);
  pinMode(WindGuage, INPUT_PULLUP);
  pinMode(RainSensorPower, OUTPUT);
  digitalWrite(RainSensorPower, HIGH);
  //OneWire ds(OneWirePin);
  //pinMode(RetPower, INPUT);
  pinMode(ActuatorRetButton, INPUT_PULLUP);
  pinMode(ActuatorExtButton, INPUT_PULLUP);
  pinMode(ControlPower, INPUT_PULLUP);
  pinMode(StatusLED, OUTPUT);
  digitalWrite(StatusLED, LOW);

  /**
  for( int i=0; i < Wsize; i++) {
    const int Winit = 100;
    Wintervals[i] = Winit;
    Wtotal += Winit;
  }
  Wlast = millis();
  Wspeed = 1000*Wsize/Wtotal;
  **/
  
  attachInterrupt(digitalPinToInterrupt(RoofSensor),intRoofClosed,FALLING);
  attachInterrupt(digitalPinToInterrupt(WindGuage),intWindGuage,FALLING);
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
    Lock();
  } else {
    RoofClosed = false;
  }
 
  Serial.begin(9600);
  BTSerial.begin(9600);
  echo("Program started");
}

void loop() {

  if (digitalRead(ControlPower) == HIGH or ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW))){
  //if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)){
    //Environment is not suitable for Telescop Operations.

    if (NormalOperations) {
      //It has just happenes.
      
      //Logging Event
      if (digitalRead(ControlPower) == HIGH) {
        echo("Control Power has just faled.");
      }
      if ((digitalRead(RainSensorPower) == HIGH and digitalRead(RainSensor) == LOW)) {
        echo("Precipitation sensor just triggered.");
      }
      CloseRoof(MaxRetractionLoops,COMMAND);

    } else {
 
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      } else {
        if (digitalRead(RoofSensor) == LOW) {
          echo("Roof still be opened!!!");
          CloseRoof(MaxRetractionLoops/2,COMMAND);  
        }
      }

     RemainRecoveryLoops = RecoveryLoops; //Recovery hasn't started
 
      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    }
    NormalOperations = false;

  } else {
    // Environment  is acceptable for Telescop Operations

    NormalOperations = true;
    if (RemainRecoveryLoops > 0 ) {
      // Environment is acceptable for Telescop Operations but recover delay is still in progress, no normal oiperations permitted
 
      if (RemainRecoveryLoops == RecoveryLoops ) {
            Wakeup();
            //Logging Event
            echo("Recovery initiated");
      }
      if (RemainRecoveryLoops == 1 ) {
            //Logging Event
            echo("Operations Recovered");
      }

      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      RemainRecoveryLoops = RemainRecoveryLoops - 1;

      //It still be permitted to close the Roof pressing  the button
      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        //Implement only in case of remaining actuators loops less or equil 2
        if (RemainActuatorLoops <= 2) {
          CloseRoof(1,BUTTON);
        }
      }
    } else {
      //Normal roof operartional mode
      //NormalOperations = true;      //CHECK
      
      //Keep Actuator operations if Loops remain
      if (RemainActuatorLoops > 0) {
        //Logging operation status on the last loop
        if (RemainActuatorLoops == 1) {
          StopRoof(ActivationType);
        } else {
          RemainActuatorLoops = RemainActuatorLoops - 1;
        }
      }

      if (digitalRead(ActuatorRetButton) == LOW) {
        //Acruator Retraction Button Pressed; Retraction prefered to Extraction
        CloseRoof(1,BUTTON);
      } else if (digitalRead(ActuatorExtButton) == LOW) {
        //Acruator Extraction Button Pressed
        OpenRoof(1,BUTTON);
      }
    }
  }


  //Circular shifting to the left the bits in the LED_Mode, Updatthe LED
  LED_Status = LED_Mode & 0b1;
  digitalWrite(StatusLED, LED_Status);
  LED_Mode = LED_Mode >> 1;
  bitWrite(LED_Mode,15,LED_Status);

  //Tracking if Rain Sensor can be send to sleep 
  if (digitalRead(RoofSensor) == HIGH) {
    if (digitalRead(RainSensorPower) == HIGH){
      RainSensorMemory = digitalRead(RainSensor);
      if (ReinSensorSleepTracker < ReinSensorSleepLoops) {
        ReinSensorSleepTracker = ReinSensorSleepTracker +1;
      } else {
        ReinSensorWakeUpTracker = 0;
        digitalWrite(RainSensorPower,LOW);
        //Logging Event
        echo("Precipitation Sensor sent to sleep.");
      }
    }
  } else {
    ReinSensorSleepTracker = 0;
  }
  
  //Tracking if Rain Sensor must be waked up
  if (digitalRead(RainSensorPower) == LOW){
    if (ReinSensorWakeUpTracker < ReinSensorWakeUpLoops) {
      ReinSensorWakeUpTracker += 1;
    } else {
      Wakeup();
    }
  }

  ReportFrequinceTracker += 1;
  if (ReportFrequinceTracker >= ReportFrequinceLoops) {
    ReportFrequinceTracker = 0;
    int test = 555;
    Report();
  }


  delay(LoopDelay);
}

void Lock() {
  //Lock the Roof
  if (digitalRead(Locker)) {
    digitalWrite(Locker, LOW);
    echo("Roof has been lock");
  }
}

void Unlock() {
  //Unlock the Roof
  if (!digitalRead(Locker)) {
    digitalWrite(Locker, HIGH);
    echo("Roof has been unlock");
  }
}

void Report() {
  unsigned int code = 0; 
  if (digitalRead(RoofSensor) == LOW) {
    code += 128;
  }
  if (!digitalRead(Locker)) {
    code += 64;
  }
  if (!digitalRead(ActuatorRet)) {
    code += 32;
  }
  if (!digitalRead(ActuatorExt)) {
    code += 16;
  }
  if (digitalRead(RainSensorPower) == LOW) {
    code += 8;
    if (RainSensorMemory == LOW) {
      code += 4;
    }
  } else if (digitalRead(RainSensor) == LOW) {
    code += 4;
  }
  if (digitalRead(ControlPower) == HIGH) {
    code += 1;
  }
  #ifdef BT
    BTSerial.print("Status: ");
    BTSerial.print(code);
    BTSerial.print(" ");
    BTSerial.println(Wspeed);
  #else
    Serial.print("Status: ");
    Serial.print(code);
    Serial.print(" ");
    Serial.println(Wspeed);
  #endif
}

void StopRoof(char Type) {

  //Logging Event
  if (Type == BUTTON) {
    echo("Button Released");
  } else if (Type == COMMAND) {
    echo("Roof command completed");
  } else if (Type == INTERRUPT) {
    echo("Roof operation interrupted.");
  } else {
    echo("Roof operation stopped by command");
  }

  unsigned int isRetraction = digitalRead(ActuatorRet);
  digitalWrite(ActuatorExt, HIGH);
  digitalWrite(ActuatorRet, HIGH);
  RemainActuatorLoops = 0;

  //Check Roof Sensor if operation was closing (ActuatorRet == LOW)
  delay(10);
  if (isRetraction == LOW and digitalRead(RoofSensor) == LOW) {
    echo("Roof Senser reports it still be opened!");
    setLED(Led_ON);
  } else {
    Lock();
    setLED(Led_OFF);
  }

  ActivationType = DUMMY;
}

void CloseRoof(int Duration, char Type) {

  //Verify RootSensor one more time; update status
  if (digitalRead(RoofSensor) == HIGH) {
    RoofClosed = true;
  } else {
    RoofClosed = false;
  }
 
  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if closing operation already in progress
    if (digitalRead(ActuatorRet) != LOW and !RoofClosed) {
      echo("Closing the Roof by button.");
    }
  } else {
    echo("Closing the Roof by command.");
  }

  if (RoofClosed) {
    if (Type == COMMAND) {
      echo("Closing the Roof ignored as RoofSensor reports Roof is closed.");
      Lock();
    }
  } else {
    digitalWrite(ActuatorExt, HIGH);
    delay(50);
    digitalWrite(ActuatorRet, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
  
    setLED(Led_1_1);
    ActivationType = Type;
  }
}

void Wakeup() {
  if (digitalRead(RainSensorPower) == LOW) {
    digitalWrite(RainSensorPower, HIGH);
    //Logging Event
    echo("Precipitation Sensor waked up.");
    delay(100);
  }
  ReinSensorSleepTracker = 0;
}

void OpenRoof(int Duration, char Type) {

  //Logging Event
  if (Type == BUTTON) {
    //Not repeat message if openning operation already in progress
    if (digitalRead(ActuatorExt) != LOW) {
      echo("Openning the Roof by button.");
    }
  } else {
    echo("Openning the Roof by command.");
  }

  RoofClosed = false; //Consider Roof not closed

  Wakeup();
  
  //Disable roof opening if Precipitation Sensor triggered
  if (digitalRead(RainSensor) == LOW){
    echo("Roof should not be open when Precipitation Sensor tirggered !");
  } else {
    Unlock();
    digitalWrite(ActuatorRet, HIGH);
    delay(50);
    digitalWrite(ActuatorExt, LOW);
    RemainActuatorLoops = Duration + 1; //Increased to one to execute control of Roof Sensor on n+1 loop
    setLED(Led_8_8);
    ActivationType = Type;
  }
}

void intRoofClosed() {
  if (digitalRead(ActuatorRet) == LOW) {
    echo("Received Roof closed interraption.");
    StopRoof(INTERRUPT);
    RoofClosed = true;
  }
}

void intWindGuage() {
  static unsigned int Wintervals[25];                    //Array to keep intervals (miliseconds) between Wind Guage ticks
  const unsigned int Wsize = sizeof(Wintervals)/2;       //Size of Wintervals[]
  static unsigned int Wcurrent;                          //Carrend element of Wintervals[] array to update
  static unsigned long Wtotal;                           //Total meleseconds for all intervals
  static unsigned long Wlast;                            //Timer of the last Wind Tick
  static unsigned long Wnow;                             //Timer of the last Wind Tick
  unsigned long interval;                                //Temporary variable to keep current interval
  Wnow = millis();
  if (Wactive) {
    interval = Wnow - Wlast;
    if (interval < 0) {
      interval = Wtotal/Wsize;
    }
    Wtotal = Wtotal-Wintervals[Wcurrent]+interval;
  } else {
    interval = 10000;
    for( int i=0; i < Wsize; i++) {
      Wintervals[i] = interval;
      Wtotal += interval;
    }
    Wactive = true;
  }
  Wintervals[Wcurrent] = interval;
  Wlast = Wnow;
  Wspeed = 1000*Wsize/Wtotal;
  Wcurrent = (Wcurrent+1)%Wsize;
}


void setLED(int newLED_Mode) {
  if (oldLED_Mode != newLED_Mode) {
    oldLED_Mode = newLED_Mode;
    LED_Mode = newLED_Mode;
  }
}

void echo(String msg) {
  #ifdef BT
    BTSerial.println(msg);
  #else
    Serial.println(msg);
  #endif
}

Current output (I created artificial wind and one point):

Program started
Control Power has just faled.
Closing the Roof by command.
Closing the Roof ignored as RoofSensor reports Roof is closed.
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 0
Status: 65 1
Precipitation Sensor sent to sleep.
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 1
Status: 73 2
Status: 73 2
Status: 73 2
Status: 73 3
Status: 73 5
Status: 73 7
Status: 73 7
Status: 73 6
Status: 73 5
Status: 73 5
Status: 73 5
Status: 73 4
Status: 73 4

For report - (String) does work now too