I’ll update when a bunch of code from 3 people gets integrated. This will work fine for non-blocking delays also. *-–( Declare User-written Functions )-–*/ MsChokewasClosed = choke_millis.elapsed() // Record this start attempt GeneratorState = RUNNING_NORMAL_STATE // Will open choke, stop starter If (AC_powerDetected) // The generator engine has started No entanto, certas coisas continuam a acontecer enquanto a funo delay () est controlando o microcontrolador, porque a funo delay no desativa. Serial.println(“STARTER ran too long, failure”) Programadores mais habilidosos usualmente evitam o uso da funo delay () para timing de eventos mais longos que dezenas de milissegundos, a menos que o sketch Arduino seja muito simples. If (starter_millis.elapsed() >= MAX_STARTER_MS) Serial.println(starter_millis.elapsed()) If (choke_millis.elapsed() >= MAX_CHOKE_MS) // Long enough time Serial.println(“ATTEMPTING TO START ENGINE”) Serial.println(“TEST OF Stopwatch for engine controls”) Int msChokewasClosed // Record the history of this startup event *-–( Declare Constants and Pin Numbers )-–*/Įnum generatorState = INIT_STATE // Set first state at code start PURPOSE: Test timing for engine starting (Fragment) See: Īfter funny compile stuff, I have this example running on ESP32: OK, after some discussions I have used Rob Tillart’s “stopwatch_RT” library successfully for doing timing and timeouts for my GeneratorSet engine starting code. The one who dies with the most Parts LOSES! WHAT DO YOU NEED? Regards, Terry King…In The Woods In Vermont THANKS! Any comments or suggestions or critique welcome! Can you give us any guidance on the response time needed for the WiFi/Server code running in an ESP32 VS other user code? So, my RealTime Worry is: ESP32 co-hosting Wifi, Server, engine/generator controller state machine, with needed delays and timeout checks. We plan to put out a WiFi server that is the user interface: THANKS for your guidance on that stuff! So, engine starting, stopping, power monitoring etc. The project is remote control of generator sets used in many home and RV environments. I was trying to avoid the complexity of FreeRTOS. I love RealTime stuff and wrote a lot in EDL/EDX at IBM 30 years ago, and wrote a working 6502 RTOS. I have also messaged Rob Tillart who wrote stopwatch_RT and has written many arduino libraries, to ask similar questions. I will come back here with my results and experiences. you don't need to be more precise than a millisecond).First MANY Thanks to you and to Rui for the incredible effort you have put into making Arduino and ESP32 understandable and fun for so many people! I write which took a different approach and has nowhere near the quantity and detail of information that you guys have done. Since your delays are quite long I imagine that you don't need much precision (i.e. In general it is better not to use delays, except for very simple programs or in initialisation routines (i.e. you can't use delay() in this case (and in most other cases) because it completely blocks the program for a given time (1) (except for interrupts, but i won't treat interrupts here). I imagine that you tried to figure out how to do it whit the delay() function (if it's not your case, it is for most Arduino beginners).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |