HI, All
Regular programming for "big brothers" with enough resources to have async multitask app structure - i have troubles to plan B4R sketch (mostly for ESP8266) for correct structure:
I see that one thread is for all, but no single loop sub here to make synchronously all these tasks.
Say, when i test with 2 sensors by simple timer sketch - both sensors are 99% correctly recognized, just very rare CRC-error. But when all this is inside big complex multitask sketch (with HTTP-requests and other timers) - 95% of CRC-errors from sensors, and only sometimes each sensor is read correctly.
What can be coding strategy in B4R ?
Regular programming for "big brothers" with enough resources to have async multitask app structure - i have troubles to plan B4R sketch (mostly for ESP8266) for correct structure:
- each interface\function to be in a separate module (for cross-project usage)
- independent timers to have several autonomous functions (several interfaced sensors read\write and several different HTTP-requests...)
- and all these are sensitive to the timing, have time to execute, non-guaranty result (Internet connection, speed), and placed in several subs
- but here there is not event-driven coding
- make 2 periodical HTTP requests
- read 2-5 sensors with fixed timings
- each sensor reading is to be also uploaded by HTTP-request
- external commands for MCU from server (got via one periodical HTTP request) are to be executed also immediately after receiving
I see that one thread is for all, but no single loop sub here to make synchronously all these tasks.
Say, when i test with 2 sensors by simple timer sketch - both sensors are 99% correctly recognized, just very rare CRC-error. But when all this is inside big complex multitask sketch (with HTTP-requests and other timers) - 95% of CRC-errors from sensors, and only sometimes each sensor is read correctly.
What can be coding strategy in B4R ?
Last edited: