Changelog¶
Version 0.1.0a0¶
September 15, 2020
The default LED symbols are now big non-ASCII signs:
🛑 : LED turned ON ⚪ : LED turned OFF
NOTE: the default symbols used by all GPIO channels can be modified with
SimulRPi.GPIO.setdefaultsymbols()
LED symbols for each channel can be modified with
SimulRPi.GPIO.setsymbols()
Channel names can now be displayed instead of channel numbers in the terminal:
🛑 [LED 1] 🛑 [LED 2] 🛑 [LED 3] ⬤ [lightsaber]
New modules:
SimulRPi.manager
andSimulRPi.pindb
Manager
is now in its own module:SimulRPi.manager
Pin
andPinDB
are now in their own module:SimulRPi.pindb
NOTE: these classes used to be in
SimulRPi.GPIO
New attributes in
SimulRPi.pindb.Pin
andSimulRPi.manager.Manager
:Pin.channel_id
: unique identifierPin.channel_name
: displayed in the terminal along each LED symbolPin.channel_number
: used to be calledchannel
Pin.channel_type
: used to be calledgpio_function
and refers to the type of GPIO channel, e.g. 1 (GPIO.IN) or 0 (GPIO.OUT).Pin.led_symbols
: each pin (aka channel) is represented by LED symbols if it is an output channelManager.default_led_symbols
: defines the default LED symbols used to represent each GPIO channel in the terminal
New functions in
SimulRPi.GPIO
:setchannelnames()
: sets channels names for multiple channelssetchannels()
: sets the attributes (e.g.channel_name
andled_symbols
) for multiple channelssetdefaultsymbols()
: changes the default LED symbols used by all output channelssetsymbols()
: sets the LED symbols for multiple channelswait()
: waits for the threads to do their tasks and raises an exception if there was an error in a thread’s target function. Hence, the main program can catch these thread exceptions.
SimulRPi.GPIO.output()
accepts channel and state asint
,list
ortuple
SimulRPi.GPIO.setup()
accepts channel asint
,list
ortuple
The displaying thread in
SimulRPi.manager
is now an instance ofDisplayExceptionThread
. Thus, if there is an exception raised indisplay_leds()
, it is now possible to catch it in the main programThe keyboard listener thread in
SimulRPi.manager
is now an instance ofKeyboardExceptionThread
(a subclass ofpynput.keyboard.Listener
). Thus, if there is an exception raised inon_press()
oron_release()
, it is now possible to catch it in the main programSimulRPi.GPIO.input()
andSimulRPi.GPIO.output()
now raise an exception caught by the listening and displaying threads, respectively.If two channels use the same channel numbers, an exception is now raised.
-
accepts the new option
-a
which will make use of ASCII-based LED symbols in case that you are having problems displaying the default LED symbols which use special characters (based on the UTF-8 encoding). See Display problems.all simulation-based examples involving “LEDs” and pressing keyboard keys worked on the RPi OS (Debian-based)
See also
Version 0.0.1a0¶
August 14, 2020
In
SimulRPi.GPIO
, the packagepynput
is not required anymore. If it is not found, all keyboard-related functionalities from theSimulRPi
library will be skipped. Thus, no keyboard keys will be detected if pressed or released whenpynput
is not installed.This was necessary because Travis was raising an exception when I was running a unit test: Xlib.error.DisplayNameError. It was due to
pynput
not working well in a headless setup. Thus,pynput
is now removed from requirements_travis.txt.Eventually, I will mock
pynput
when doing unit tests on parts of the library that make use ofpynput
.Started writing unit tests
Version 0.0.0a0¶
August 9, 2020
First version
Tested code examples on different platforms and here are the results
On an RPi with
RPi.GPIO
: all examples involving LEDs and pressing buttons workedOn a computer with
SimulRPi.GPIO
macOS: all examples involving “LEDs” and keyboard keys worked
RPi OS [Debian-based]: all examples involving “LEDs” only worked
NOTE: I was running the script
run_examples
withssh
butpynput
doesn’t detect any pressed keyboard key even though I set my environment variableDisplay
, addedPYTHONPATH
to etc/sudoers and ran the script withsudo
. To be further investigated.
[EDIT: tested the code examples with run_examples
]