I know that there is a github for the FW GitHub - FrameworkComputer/inputmodule-rs: Framework Laptop 16 Input Module SW/FW but is there anywhere to share cool code that people have written to control the module / show weather/ email notification / anything else?
I will share the code I write for it. I intend to write a system usage monitor for it.
I’d say just create individual repositories and share them here on the forum or create some kind of “awesome-framework-tools” wiki repository, like awesome-selfhosted.
But to answer your question: No I do not know a specific place where you could share stuff like that other than github (or git hoster of your choice).
Well, here is as good as any, if we get lots of submissions I will create a github. Hit me up, I’m batch 8 and waiting to play with the LED’s.
I created a system monitor application for my FW 16 LED Matrix Modules. The left module shows the load on the 8 CPU cores, the system memory consumption, and the battery charging status / battery level. The right module shows disk and network usage.
Source code is here for anyone that wants to use it, or just see how I used serial to send updates to the modules:
And here is a bad picture. The difference in brightness between the background and foreground elements in the display is better in person, and also configurable.
This thing bombs out when the LED matrix modules are removed and never recovers when they are re-installed. Have you experienced this as well?
It also seems to randomly bomb out at other times of usage as well, requiring a manual restart of the python application, not sure why.
Would be nice if it just closed the serial device, and went into a loop waiting for the devices to return instead.
The dimming with screen brightness is a cool idea. It didn’t work at first as the default location it is pointing to doesn’t exist, but a simple edit to the correct location got it working nicely (linux).
I haven’t had any problems with disconnecting or reconnecting modules, or restoring from sleep, etc. If you look at the code in drawing.py you can see that if there is a serial error, the thread just sleeps and then tries to reinitialize the port a second later. In theory this should make it robust to any kinds of communication issues.
About brightness: It is possible that the endpoint I was using to read brightness only works on certain versions of linux. If you have a working alternative, I can add it to the code so it supports more platforms.
If you have any suggested improvements, I would be happy to add them to the repo.
Here are the errors it throws when the devices are removed:
$ python led_system_monitor.py
Error in DrawingThread: write failed: [Errno 5] Input/output error
Error in DrawingThread: write failed: [Errno 5] Input/output error
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 208, in run
draw_to_LEDs(self.serial_port, grid)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 180, in draw_to_LEDs
send_command(s, Commands.StageCol, parameters=params)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/commands.py", line 34, in send_command
s.write(message)
~~~~~~~^^^^^^^^^
File "/usr/lib/python3.13/site-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 213, in run
self.serial_port = init_device(self.serial_port)
^^^^^^^^^^^^^^^^
AttributeError: 'DrawingThread' object has no attribute 'serial_port'
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 208, in run
draw_to_LEDs(self.serial_port, grid)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 180, in draw_to_LEDs
send_command(s, Commands.StageCol, parameters=params)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/commands.py", line 34, in send_command
s.write(message)
~~~~~~~^^^^^^^^^
File "/usr/lib/python3.13/site-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/home/xamindar/development/ledmatrix/FW_LED_System_Monitor/drawing.py", line 213, in run
self.serial_port = init_device(self.serial_port)
^^^^^^^^^^^^^^^^
AttributeError: 'DrawingThread' object has no attribute 'serial_port'
^CExiting
I am on Arch Linux and this is the location for the brightness:
/sys/class/backlight/amdgpu_bl2/brightness
I think I just changed the 1 to a 2. Not sure if this is different without a dGPU or anything like that.
EDIT: haha, looks like you already fixed the brightness thing. I must have downloaded your code over 4 months ago. I’ll get a fresh set and check it out.
Sorry for the delayed reply. It has been a very busy week for me.
I looked through the relevant sections of the code and I think maybe both problems you had were just on an old version. The brightness thing you mentioned changes based on whether you use a DGPU or not, but I have cases in the code for both now.
The other issue might also be something that I changed months ago to improve error handling. I briefly tried and failed to reproduce the problem. If it is still happening for you on the latest (oct 9) commit, let me know and I can look it over.
So sorry I wasted your time. I did, in fact, re-download your current code and the above issues are resolved. Thank you, and comparing the old code with the new is helping me to learn how this all works.