Marlin firmware. The task is to organize a timer for heating the table

Specifically, it is necessary to constantly turn on and off the heating of the table with some period. So I found this part when.

#else // !PIDTEMPBED && !BED_LIMIT_SWITCHING

After it, I made a check

  const millis_t counter_ms= millis();
  if (ELAPSED(counter_ms,LimitT)){

    if (Turn==1){
      Turn=0;
      temp_bed.soft_pwm_amount = temp_bed.celsius < temp_bed.target ? MAX_BED_POWER >> 1 : 0;
      LimitT=counter_ms+3000UL;
    }else{
      Turn=1;
      temp_bed.soft_pwm_amount = 0;
      WRITE_HEATER_BED(LOW);
      LimitT=counter_ms+1000UL;
    }
  }

I turn on and off the heating of the bed after the time has elapsed. However, the period between switching on and off is always 5 seconds, regardless of which timer I set. The same timer is used in the marlin itself. Maybe I didn't implement it correctly?

Author: MIHAnik22, 2020-06-01