2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-05 23:58:44 +00:00

FRM_LCD: restore further readings on startup/reconnect

git-svn-id: https://svn.fhem.de/fhem/trunk@5248 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-03-17 21:02:14 +00:00
parent 5b889eb21c
commit faacb5ec52

View File

@ -82,9 +82,12 @@ FRM_LCD_Init($)
if (! (defined AttrVal($name,"stateFormat",undef))) {
$main::attr{$name}{"stateFormat"} = "text";
}
my $value = ReadingsVal($name,"text",undef);
if (defined $value and AttrVal($hash->{NAME},"restoreOnReconnect","on") eq "on") {
FRM_LCD_Set($hash,$name,"text",$value);
if (AttrVal($hash->{NAME},"restoreOnReconnect","on") eq "on") {
foreach my $reading (("display","scroll","backlight","text","writeXY")) {
if (defined (my $value = ReadingsVal($name,$reading,undef))) {
FRM_LCD_Set($hash,$name,$reading,$value);
}
}
}
return undef;
}
@ -219,6 +222,7 @@ sub FRM_LCD_Set(@) {
} else {
$lcd->noDisplay();
}
main::readingsSingleUpdate($hash,"display",$value,1);
last;
};
$command eq "cursor" and do {
@ -232,6 +236,7 @@ sub FRM_LCD_Set(@) {
} else {
$lcd->scrollDisplayRight();
}
main::readingsSingleUpdate($hash,"scroll",$value,1);
last;
};
$command eq "backlight" and do {
@ -240,6 +245,7 @@ sub FRM_LCD_Set(@) {
} else {
$lcd->noBacklight();
}
main::readingsSingleUpdate($hash,"backlight",$value,1);
last;
};
$command eq "writeXY" and do {
@ -262,6 +268,7 @@ sub FRM_LCD_Set(@) {
$t = ($al eq "l") ? $t.$dif : $dif.$t;
}
$lcd->print($t);
main::readingsSingleUpdate($hash,"writeXY",$value,1);
readingsSingleUpdate($hash,"state",$t,1);
last; #"X=$x|Y=$y|L=$l|Text=$t";
};