Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lcdproc update #271

Merged
merged 3 commits into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sysutils/pfSense-pkg-LCDproc/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-LCDproc
PORTVERSION= 0.10.3
PORTVERSION= 0.10.4
CATEGORIES= sysutils
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
4 changes: 2 additions & 2 deletions sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ function sync_package_lcdproc() {
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
$config_text .= "Type=lcd\n";
$config_text .= "hasAdjustableBacklight=yes\n";
$config_text .= "Type={$lcdproc_config['mtxorb_type']}\n";
$config_text .= "hasAdjustableBacklight=" . ($lcdproc_config['mtxorb_adjustable_backlight'] ? "yes" : "no") . "\n";
$config_text .= "Reboot=no\n";
$config_text .= set_lcd_value("contrast", 1000, 480);
$config_text .= set_lcd_value("brightness", 1000, 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,10 @@ function get_uptime_stats() {

function get_loadavg_stats() {
exec("/usr/bin/uptime", $output, $ret);
if (stristr($output[0], "day")) {
$temp = explode(" ", $output[0]);
$status = "$temp[11] $temp[12] $temp[13]";
} else {
$temp = explode(" ", $output[0]);
$status = "$temp[10] $temp[11] $temp[12]";
}
return($status);

+ $temp = preg_split("/ /", $output[0], -1, PREG_SPLIT_NO_EMPTY);
+ $count = count($temp);
+ return ($count >= 3) ? "{$temp[$count - 3]} {$temp[$count - 2]} {$temp[$count - 1]}" : "Not available";
}

function get_mbuf_stats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,45 @@

// Set default values for anything not in the $config
$pconfig = $lcdproc_config;
if (!isset($pconfig['enable'])) $pconfig['enable'] = '';
if (!isset($pconfig['comport'])) $pconfig['enabled'] = 'ucom1';
if (!isset($pconfig['size'])) $pconfig['size'] = '16x2';
if (!isset($pconfig['driver'])) $pconfig['driver'] = 'pyramid';
if (!isset($pconfig['connection_type'])) $pconfig['connection_type'] = 'lcd2usb';
if (!isset($pconfig['refresh_frequency'])) $pconfig['refresh_frequency'] = '5';
if (!isset($pconfig['port_speed'])) $pconfig['port_speed'] = '0';
if (!isset($pconfig['brightness'])) $pconfig['brightness'] = '-1';
if (!isset($pconfig['offbrightness'])) $pconfig['offbrightness'] = '-1';
if (!isset($pconfig['contrast'])) $pconfig['contrast'] = '-1';
if (!isset($pconfig['backlight'])) $pconfig['backlight'] = 'default';
if (!isset($pconfig['outputleds'])) $pconfig['outputleds'] = 'no';
if (!isset($pconfig['enable'])) $pconfig['enable'] = '';
if (!isset($pconfig['comport'])) $pconfig['enabled'] = 'ucom1';
if (!isset($pconfig['size'])) $pconfig['size'] = '16x2';
if (!isset($pconfig['driver'])) $pconfig['driver'] = 'pyramid';
if (!isset($pconfig['connection_type'])) $pconfig['connection_type'] = 'lcd2usb'; // specific to hd44780 driver
if (!isset($pconfig['refresh_frequency'])) $pconfig['refresh_frequency'] = '5';
if (!isset($pconfig['port_speed'])) $pconfig['port_speed'] = '0';
if (!isset($pconfig['brightness'])) $pconfig['brightness'] = '-1';
if (!isset($pconfig['offbrightness'])) $pconfig['offbrightness'] = '-1';
if (!isset($pconfig['contrast'])) $pconfig['contrast'] = '-1';
if (!isset($pconfig['backlight'])) $pconfig['backlight'] = 'default';
if (!isset($pconfig['outputleds'])) $pconfig['outputleds'] = 'no';
if (!isset($pconfig['mtxorb_type'])) $pconfig['mtxorb_type'] = 'lcd'; // specific to Matrix Orbital driver
if (!isset($pconfig['mtxorb_adjustable_backlight'])) $pconfig['mtxorb_adjustable_backlight'] = true; // specific to Matrix Orbital driver


if ($_POST) {
unset($input_errors);
$pconfig = $_POST;

// Input validation would go here, with any invalid values found
// in $_POST being added to $input_errors, e.g:
// $input_errors[] = "Descriptive error message for the user.";

if (!$input_errors) {
$lcdproc_config['enable'] = $pconfig['enable'];
$lcdproc_config['comport'] = $pconfig['comport'];
$lcdproc_config['size'] = $pconfig['size'];
$lcdproc_config['driver'] = $pconfig['driver'];
$lcdproc_config['connection_type'] = $pconfig['connection_type'];
$lcdproc_config['refresh_frequency'] = $pconfig['refresh_frequency'];
$lcdproc_config['port_speed'] = $pconfig['port_speed'];
$lcdproc_config['brightness'] = $pconfig['brightness'];
$lcdproc_config['offbrightness'] = $pconfig['offbrightness'];
$lcdproc_config['contrast'] = $pconfig['contrast'];
$lcdproc_config['backlight'] = $pconfig['backlight'];
$lcdproc_config['outputleds'] = $pconfig['outputleds'];
$lcdproc_config['enable'] = $pconfig['enable'];
$lcdproc_config['comport'] = $pconfig['comport'];
$lcdproc_config['size'] = $pconfig['size'];
$lcdproc_config['driver'] = $pconfig['driver'];
$lcdproc_config['connection_type'] = $pconfig['connection_type'];
$lcdproc_config['refresh_frequency'] = $pconfig['refresh_frequency'];
$lcdproc_config['port_speed'] = $pconfig['port_speed'];
$lcdproc_config['brightness'] = $pconfig['brightness'];
$lcdproc_config['offbrightness'] = $pconfig['offbrightness'];
$lcdproc_config['contrast'] = $pconfig['contrast'];
$lcdproc_config['backlight'] = $pconfig['backlight'];
$lcdproc_config['outputleds'] = $pconfig['outputleds'];
$lcdproc_config['mtxorb_type'] = $pconfig['mtxorb_type'];
$lcdproc_config['mtxorb_adjustable_backlight'] = $pconfig['mtxorb_adjustable_backlight'];

write_config();
sync_package_lcdproc();
Expand Down Expand Up @@ -136,8 +144,7 @@
)
)->setHelp('Set the display size lcdproc should use.');

$driverGroup = new Form_Group('Driver');
$driverGroup->add(
$section->addInput(
new Form_Select(
'driver',
'Driver',
Expand All @@ -161,7 +168,7 @@
'MD8800' => 'MD8800',
'ms6931' => 'ms6931',
'mtc_s16209x' => 'mtc_s16209x',
'MtxOrb' => 'MtxOrb',
'MtxOrb' => 'Matrix Orbital',
'nexcom' => 'nexcom (x86 only)',
'NoritakeVFD' => 'NoritakeVFD',
'picolcd' => 'picolcd',
Expand All @@ -180,11 +187,11 @@
'tyan' => 'tyan'
]
)
);
)->setHelp('Select the LCD driver LCDproc should use. Some drivers will show additional settings.');

// The connection type is HD44780-specific, so is hidden by javascript (below)
// if the HD44780 driver is not being used.
$driverGroup->add(
$section->addInput(
new Form_Select(
'connection_type',
'Connection type',
Expand All @@ -210,9 +217,34 @@
'i2c' => 'LCD driven by PCF8574/PCA9554 connected via i2c'
]
)
)->setHelp('Select the HD44780 connection type');

// The mtxorb_type and mtxorb_adjustable_backlight are Matrix-Orbital-specific, so are
// hidden by javascript (below) if the MtxOrb driver is not being used.
$subsection = new Form_Group('Display type');
$subsection->add(
new Form_Select(
'mtxorb_type',
'Display type',
$pconfig['mtxorb_type'], // Initial value.
[
'lcd' => 'LCD (default)',
'lkd' => 'LKD',
'vfd' => 'VFD',
'vkd' => 'VKD'
]
)
);
$subsection->add(
new Form_Checkbox(
'mtxorb_adjustable_backlight', // checkbox name (id)
'Has adjustable backlight', // label
'Has adjustable backlight', // text
$pconfig['mtxorb_adjustable_backlight'] // initial value
)
);
$driverGroup->setHelp('Set the LCD driver LCDproc should use.<br />If using a HD44780 driver, set the connection type using the second selection box, which will appear.');
$section->add($driverGroup);
$subsection->setHelp('Select the Matrix Orbital display type.<br />Some old firmware versions of Matrix Orbital modules do not support an adjustable backlight but only can switch the backlight on/off. If you own such a module and experience randomly appearing block characters and backlight cannot be switched on or off, uncheck the adjustable backlight option.');
$section->add($subsection);
?>

<script type="text/javascript">
Expand All @@ -230,7 +262,11 @@ function updateInputVisibility() {
// Hide the connection type selection field when not using the HD44780 driver
var using_HD44780_driver = driverName_lowercase.indexOf("hd44780") >= 0;
using_HD44780_driver |= jQuery("#driver option:selected").text().toLowerCase().indexOf("hd44780") >= 0;
hideGroupInput('connection_type', !using_HD44780_driver);
hideInput('connection_type', !using_HD44780_driver); // Hides the entire section

// Hide the Matrix Orbital specific fields when not using the MtxOrb driver
var using_MtxOrb_driver = driverName_lowercase.indexOf("mtxorb") >= 0;
hideInput('mtxorb_type', !using_MtxOrb_driver); // Hides the entire section, including the mtxorb_adjustable_backlight checkbox

// Hide the Output-LEDs checkbox when not using the CFontz633 or CFontzPacket driver
var driverSupportsLEDs = driverName_lowercase.indexOf("cfontz633") >= 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
unset($input_errors);
$pconfig = $_POST;

// Input validation would go here, with any invalid values found
// in $_POST being added to $input_errors, e.g:
// $input_errors[] = "Descriptive error message for the user.";

if (!$input_errors) {
$lcdproc_screens_config['scr_version'] = $pconfig['scr_version'];
$lcdproc_screens_config['scr_time'] = $pconfig['scr_time'];
Expand Down Expand Up @@ -160,7 +164,7 @@
new Form_Checkbox(
'scr_load', // checkbox name (id)
'Load', // checkbox label
'Display the load averages', // checkbox text
'Display the load average of the system over the last 1, 5, and 15 minutes', // checkbox text
$pconfig['scr_load'] // checkbox initial value
)
);
Expand Down