Hot answers tagged

5

There is indeed a race condition in your code: if an interrupt fires while you are reading one of the counters, you might read garbage. If it fires between reading and resetting the counter, you loose one count. The way to prevent the race is to block interrupts while the main thread (everything that does not run in interrupt context) accesses the counters. ...


5

ESP32. Dual core 240MHz, plus an extra XLP state machine. Cheap and easily available on eBay/Amazon/Ali Express etc. And with full Arduino support.


1

By best attempt to provide something of an answer. You have said: PT_WAIT_UNTIL(pt, millis() - lastTimeBlink > 1000); That is not literally represented in your code, so I take your question to refer to: int dist2 = dist1.toInt(); ... PT_WAIT_UNTIL(pt, millis() - lastTimeBlink > (dist2 * 1710)); or a similar section. When you execute this ...


1

The problem is that you check inside the two functions Sparkle and GreenYellow for another serial byte. Then when it's unequal, you move back to the while loop where you wait for the next serial byte, but I think you need to use the same one to decide to go to the correct function instead of waiting for a next serial byte. Probably the easiest is to not read ...


1

esp32_technical_reference_manual_en.pdf Page 620 As mentioned before, only an elevated process with PID of 0/1 can initiate a process switch. The new process may have any PID from 0 ~ 7 after the process switch. The key for successful proactive process switching is that Espressif Systems 620 Submit Documentation Feedback ESP32 Technical Reference Manual V4.3 ...


Only top voted, non community-wiki answers of a minimum length are eligible