Programming paradigm
When executing code on the DL-7450, the application runs using a single thread of execution. Whilst this thread (henceforth called the Python thread) executes, there are a number of actions that cannot be performed:
The execution of any callbacks, whether they are timers set via
wakeup()
, responses from asynchttp
requests or responses to changes in the state of DL-7450 hardware (e.g.gpio
pins).The rendering of elements added, removed or modified on the
splashscreen
.
The use of time.sleep
therefore is highly discouraged, as it
will prevent any of these core SDK functionalities from occuring.
Instead, application developers are encouraged to write applications
that react to events, using the main component of the app mostly to
set up wakeup.Timer
s and other callbacks.
Once the Python thread finishes processing the Python code, it is now able to go idle and allow timers, callbacks and rendering to occur.
The use of dedicated callbacks where available is also highly
encouraged over proactively polling state using a
wakeup.Timer
; this will result in much more responsive
applications.