Attiny85 after five wake up halt and corrupt firmware

Hello dear friends I am facing a problem with the deep sleep of attiny85, he falls asleep and wakes up 5 times, after that the attiny85 hangs. The only way to get back to work and reload the firmware.

Did you ever have the same problem?

my code

// ATTINY25/45/85 pinout for ARDUINO
//
//                        +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2) Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//                GND  4|    |5  PB0 (D 0) pwm0
//                         +----+
//
//   Programação dos Fusiveis
//
//
//    EXTENDED    0xFF  
//    HIGH        0xDF
//    LOW         0xC2
//
//
//

#include <avr/sleep.h>                      // sleep library
#include <avr/wdt.h>                        // watchdog library
#define adc_disable() (ADCSRA &= ~(1<<ADEN))// disable ADC (before power-off)
#define adc_enable()  (ADCSRA |=  (1<<ADEN))// re-enable ADC

#include <RCSwitch.h>                       // transmitter/receiver library
RCSwitch mySwitch = RCSwitch();
#define key1  303000          // key for temperature
#define key2  305000          // key for humidity
#define key3  308000          // key for temperature
#define key4  997066          // key for battery voltage

#include <Attinydht.h>
dht DHT;
#define DHT22_PIN 3

double  i = 254;// 2 299;    //byte                     // watchdog counter value
volatile int f_wdt = 1;                      // watchdog state
int vtx = 0;

void setup() {
  MCUSR &= ~(1 << WDRF);                    // reset watchdog status flag
  WDTCR |= (1 << WDCE) | (1 << WDE);
  WDTCR = 1 << WDP0 | 1 << WDP3;            // set watchdog to 8 seconds
  WDTCR |= _BV(WDIE);                       // wnable the WD interrupt (no reset)
  ADMUX = _BV(MUX3) | _BV(MUX2);            // reads internal 1V1 vref against VCC
  pinMode(0, OUTPUT);
  pinMode(1, INPUT);
  digitalWrite(0, HIGH);
  // powering sensor from pin 1
  mySwitch.enableTransmit(4);               // using Pin2 to toggle transmitter
}

void loop() 
{
 
  i++;                                      // just add 1 to i and do nothing
  if (i == 255) { // 3 300                    // until i=4 and do the program
    adc_enable();                           // enable ADC
    digitalWrite(0, HIGH);                  // power up DHT sensor
    delay(300);                            // wait 2 seconds
    
    uint32_t start = micros();
    int chk = DHT.read22(DHT22_PIN);        // read sensor
    uint32_t stop = micros();
    
    while(vtx < 2)
    {
        
        sendRC(DHT.temperature*10+500+key1);    // transmit temperature
        sendRC(DHT.humidity*10+key2);           // transmit humidity
        sendRC(getVCC() + key3);                // transmit battery value
        sendRC(1 + key4);
        vtx++;
    }
    vtx = 0;
    
    digitalWrite(0, LOW);                   // power down DHT sensor*/
    pinMode(0, INPUT);
    i = 0;                                  // i=0 to start all over when wake up
    delay(300);
  }
  system_sleep();                           // go to sleep
}

void sendRC(unsigned long code) 
{           // data send function
  mySwitch.send(code, 20);
}

void system_sleep() {                       // sleep function
  adc_disable();                            // disable ADC
  digitalWrite(0, LOW);                     // pulldown all used pins
  digitalWrite(1, LOW);                     // to save more power
  digitalWrite(2, LOW);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);      // selecting sleep mode
  sleep_enable();                           // allow sleep
  sleep_mode();                             // sleep!
  sleep_disable();                          // wake up here
}
ISR(WDT_vect)                               // reset watchdog state function
{
  if (f_wdt == 0) f_wdt = 1;
}

int getVCC() {                              // Returns ADC value on the power pin
  ADCSRA |= _BV(ADSC); // Convert           // alowes to get the battery voltage
  while (bit_is_set(ADCSRA, ADSC));         //without using any additional pin
  byte low = ADCL;
  unsigned int val = (ADCH << 8) | low;
  //discard previous result
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA, ADSC));
  low = ADCL;
  val = (ADCH << 8) | low;
  return val;
  //return ((long)1024 * 1100) / val;      // return value in mV (don't need this)

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

double  i = 254;/

What's the purpose of making i a double?

 if (i == 255)

float and double don't always store values exactly. Using == is dangerous. Instead you should test whether it is within some delta of a value. But really, i should just be a byte or an int at worst. Having it be a double is just silly.

You also appear to have smiley faces in your code. I don't think the compiler is going to like those. Maybe you should read the "How to use this forum" thread before posting anymore and learn how to prevent that from happening.

@zurczurc, please do not cross-post. Other post removed.

@Delta_G, thank you for cloning your reply here.