Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Подвисания бибилиотеки и срабатывание WDT #23

Open
Basoil opened this issue Nov 27, 2023 · 0 comments

Comments

@Basoil
Copy link

Basoil commented Nov 27, 2023

В int Oregon_NR::collect(byte* cdptr)
есть несколько мест, где есть циклы, ждущие нужное количество микросекунд:

 *cdp = 0;
    for (byte ckl = 0; ckl < 8; ckl++) 
    {            // Читаем 8 раз за полутакт
      pre_marker += quant;
      **while (micros() < pre_marker);**
      if (digitalRead(RECEIVER_PIN)) *cdp += 0x10;  // Измерения запиываем в старший полубайт
    }

регулярно сталкиваюсь, что pre_marker уже у границы uint32_t (примерно 4.3 млрд), а micros() уже переполнился, и этот while тормозит на 4000 секунд, вызывая срабатывание сторожевого таймера.

для ESP32 можно заменить на ets_delay_us()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant