Watchdog Got Triggered

If you are asking a question, please follow this template:

  1. My goal is: Logging IMU data in SD card in csv
  2. My actions are: I am using https://github.com/nliviu/sdlib library
  3. The result I see is: Annotation%202019-12-28%20103247
  4. My expectation & question is: It get This reboot after some no. of files craeted or logged.

code as follows:

for (int i = 1; i <1000; i++) {
  snprintf(filename, sizeof(filename), filename_format, i);
  if (!imu) return;
   FILE* f = fopen(filename, "w"); 
   fprintf(f,"Ax,Ay,Az,Gx,Gy,Gz,Mx,My,Mz\n ");
  for (int x = 0; x <50; x++) {
   mgos_imu_accelerometer_get(imu, &ax, &ay, &az);
   mgos_imu_gyroscope_get(imu, &gx, &gy, &gz);
   mgos_imu_magnetometer_get(imu, &mx, &my, &mz);
      fprintf(f,"X=%.2f, Y=%.2f, Z=%.2f, X=%.2f, Y=%.2f, Z=%.2f, X=%.2f, Y=%.2f, Z=%.2f, \n",
                                                  ax, ay, az, gx, gy, gz, mx, my, mz);
    } fclose(f);
    if (f == NULL)
    {
    LOG(LL_INFO, ("%s","Writing  Failed"));
    return;
    }

   }

You have a 50000 iterations tight loop. The default WDT timeout is 30 seconds. It’s normal to get a WDT exception as long as Mongoose OS is an event driven framework.

What If I Disable WDT or change the Timeout?
What problems may occur afterwards?

I don’t think disabling the WDT is a good ideea, but a Mongoose OS developer could answer this question.