Timer and delay application in mongoose os

I am trying to use Timer as delay function. as I tried to delete the previous set time with Timer.del() but still somehow it trigger something and i got the error below the code.

CallibratedRo: function(){
        let i = 0;
        let sensorData = 0;
        while(i<100){
            let Tid=Timer.set(500,0,function(){
                sensorData = sensorData + this.CalculateResistance();
            },null);
            Timer.del(Tid);
            sensorData = sensorData/100;
            sensorData = sensorData/MQ_GasSensor.SensorParameters.ClearAirRatio;
        }
        return sensorData;     
    },
[Jul 19 01:44:42.683] E (30764) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[Jul 19 01:44:42.694]  - mgos (CPU 0/1), backtrace: 0x4000c3f8 0x400f7f35 0x400f7ff4 0x400fb73a 0x400fca1b 0x400fca73 0x400f31e3 0x400f3214 0x400e28a5 0x400e2c08 0x400e67eb 0x40083b04
[Jul 19 01:44:42.708] 
[Jul 19 01:44:42.708] E (30764) task_wdt: Tasks currently running:
[Jul 19 01:44:42.713] E (30764) task_wdt: CPU 0: mgos
[Jul 19 01:44:42.717] E (30764) task_wdt: Aborting.
[Jul 19 01:44:42.720] abort() was called at PC 0x400d1350 on core 0
[Jul 19 01:44:42.724] 
[Jul 19 01:44:42.725] Backtrace: 0x4008f0db 0x4008f25d 0x400d1350 0x40081686 0x4000c3f5 0x400f7f35 0x400f7ff4 0x400fb73a 0x400fca1b 0x400fca73 0x400f31e3 0x400f3214 0x400e28a5 0x400e2c08 0x400e67eb 0x40083b04
[Jul 19 01:44:42.741] 
[Jul 19 01:44:42.741] --- BEGIN CORE DUMP ---
[Jul 19 01:44:42.743] mos: catching core dump
[Jul 19 01:44:45.599] .............[Jul 19 01:45:22.289] mos: core dump aborted
[Jul 19 01:45:22.289] 
[Jul 19 01:45:22.289] rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[Jul 19 01:45:22.294] configsip: 0, SPIWP:0xee
[Jul 19 01:45:22.296] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[Jul 19 01:45:22.302] mode:DIO, clock div:1
[Jul 19 01:45:22.304] load:0x3fff0018,len:4
[Jul 19 01:45:22.306] load:0x3fff001c,len:6188
[Jul 19 01:45:22.309] load:0x40078000,len:9588
[Jul 19 01:45:22.311] load:0x40080400,len:6968
[Jul 19 01:45:22.313] entry 0x40080740

how to achieve the delay functionality in while loop.

Update: I made a mistake. I forgot to increase the counter which leads to an never ending loop. Now problem is solved.

I have one question, is anything wrong use delay as below, instead of mgos_usleep() ?

void DelayMicroseconds(uint64_t micros){
uint64_t actTime;
actTime=mgos_uptime_micros();
while ((actTime+micros)>mgos_uptime_micros()) {};
}

I guess that this code will not sleep all controller and wifi and other functions on second core will continue? Or is some reason for use mgos_usleep?