LCDproc with Matrix Orbital LCD



  • I just soldered together this kit https://www.adafruit.com/products/784 for use with lcdproc in pfsense 2.4 beta. The display works using the Matrix Orbital (MtxOrb) driver. However, the first and sometimes the last character is replaced with the letter "K" and occasionally there are some filled in block. The Matrix Orbital forum shows that this can be resolved chosing "Typce=lkd" and "hasAdjustableBacklight=no" in LCDd.conf. Problem is that after making the changes, the config gets overwritten with the previous data, which cause the problem. I tried to set LCDd.conf to read only but this did not help. Can anyone tell me how to prevent the pfsense package from overwriting the config?

    Thanks for the help in advance.


  • Banned

    @revengineer:

    Can anyone tell me how to prevent the pfsense package from overwriting the config?

    You don't. Fix the package properly - https://github.com/pfsense/FreeBSD-ports/tree/devel/sysutils/pfSense-pkg-LCDproc



  • Ok, thanks for the pointer. I searched the files in found the relevant section in lcdproc.inc. The changes below indeed fix the problem in my case. Caveats: 1. I have no clue if these settings should be generally applied to Matrix Orbital displays, and 2. I do not know how to check this change into github. So I am hoping a more knowledgeable person reads this and does something smart with this information.

    
    			case "MtxOrb":
    				$config_text .= "[{$lcdproc_config['driver']}]\n";
    				$config_text .= "Device={$realport}\n";
    				$config_text .= "Size={$lcdproc_config['size']}\n";
    				$config_text .= "Type=lkd\n";
    				$config_text .= "hasAdjustableBacklight=no\n";
    				$config_text .= "Reboot=no\n";
    				$config_text .= set_lcd_value("contrast", 1000, 480);
    				$config_text .= set_lcd_value("brightness", 1000, 1000);
    				$config_text .= set_lcd_value("offbrightness", 1000, 0);
    				break;
    
    


  • Installing LCDproc on pfsense 2.3.2 as linked in this thread https://forum.pfsense.org/index.php?topic=110177.msg647262#msg647262, I found that the same problem exists in this version. I have named the thread with a more accurate title and have cross-linked from the above thread to this one.



  • @revengineer:

    I have no clue if these settings should be generally applied to Matrix Orbital displays

    From looking at your links, I don't think these settings should be generally applied.

    The pfsense package is using lcdproc's default settings for Matrix Orbital, but if some popular LCDs require different settings then perhaps the config screen could allow Matrix Orbital users to specify a type and whether there's no backlight, like how selecting HD44780 brings up additional settings. I'd like to say I'll help - perhaps this weekend, but I'm a bit short of time so can't make a promise.



  • @treer:

    From looking at your links, I don't think these settings should be generally applied.

    The pfsense package is using lcdproc's default settings for Matrix Orbital, but if some popular LCDs require different settings then perhaps the config screen could allow Matrix Orbital users to specify a type and whether there's no backlight, like how selecting HD44780 brings up additional settings. I'd like to say I'll help - perhaps this weekend, but I'm a bit short of time so can't make a promise.

    After googling some more, I think you are right. Per the LCDproc documentation, the Matrix Orbital driver has two additional settings, which could be implemented as pull-down menus:

    
    Type = { lcd | lkd | vfd | vkd }
    hasAdjustableBacklight = { yes | no }
    
    

    The valid options are listed in the {}. It would be great if this can be added. There is no rush, so take your time. Everything is working on my end.

    BTW, I did find out that my display requires hasAdjustableBacklight=yes afterall. The only necessary change was type=lkd.

    Thanks in advance for taking this on!



  • I've made a version with your load averages fix as well as the Matrix Orbital options needed for Adafruit LCDs. If you can confirm it works and I don't find any problems with it on my firewall then I can submit a pull-request to the pfSense repository, though it may take some time before they merge it.

    You can either update the following files on your firewall directly (e.g. Diagnostics -> Edit File -> cut/paste)

    Or you could try the 0.10.4 packages.

    Update:
    That load averages bug you spotted has been in there since at least 2008, and even the fix to handle padding-spaces isn't enough because I've just encountered an uptime string that doesn't contain enough elements, e.g: ```
    12:19AM  up  2:38, 1 user, load averages: 0.25, 0.19, 0.11

    
    So I've changed get_loadavg_stats()  to take the last 3 pieces of text instead of trying to figure out how many pieces of text are in front of them. Files in the links above have been updated with this.


  • Nicely done treer! I confirm that the new selection options for the Matrix Orbital LCDs work great. I can reproduce the incorrect and correct display switching between LCD and LKD options.

    I also looked at your code for the load averages and your fix is more elegant than mine since it takes the last three elements of the uptime output and eliminates the need for if statements. There was at least one condition that was not covered by my solution. I have to wait until tomorrow night to verify that the load averages display correctly after the one-day uptime boundary, but from looking at the code I don't expect any issues.

    Thank you so much.



  • ok, I crossed the 24 hour uptime boundary and the load averages display correctly and have done so for the past day. I would say submit the pull-request.

    I wish they would include this package as a standard package for 2.3.2. I see no remaining issue and certainly none that affect stability of the system.



  • I have this Adafruit display now running for a week and find this to be a great addon (no, I do NOT work for them). It's $25 and comes with the satisfaction of a little DIY project. It took less than 30 min to put together.

    The display is based on the Matrix Orbital command set but has some additional commands, most notably one to change the displays background color. Finding the right way to send the command, took a little while, so I thought I save you the guess work. Here are the commands lines for some colors:

    
    color white:  printf "%b" '\0376\0320\0377\0377\0377' > /dev/cuaU0 
    color grey:   printf "%b" '\0376\0320\0200\0200\0200' > /dev/cuaU0 
    color red:    printf "%b" '\0376\0320\0377\0001\0001' > /dev/cuaU0 
    color green:  printf "%b" '\0376\0320\0001\0377\0001' > /dev/cuaU0 
    color blue:   printf "%b" '\0376\0320\0001\0001\0377' > /dev/cuaU0 
    color yellow: printf "%b" '\0376\0320\0377\0377\0001' > /dev/cuaU0 
    color purple: printf "%b" '\0376\0320\0377\0001\0177' > /dev/cuaU0 
    
    

    You may need to change the device port to match your setup.



  • Hello Everyone,
    I just got an LCD 16x2 Display (MATRIX compatible)… (It´s working fine on Windows using MATRIX Drive with LCD Smartie)

    The problem is that the LCDPROC service doesn't start when using MATRIX driver option. (see image) - Also doesn't start with some of the available options.  Am I missing something? Any tip to resolve the problem?

    Thanks Much
    Fabricio.





Log in to reply