2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-08 05:15:10 +00:00

display string registers as text

git-svn-id: https://svn.fhem.de/fhem/trunk@3984 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-09-30 21:56:00 +00:00
parent 9b5e333e22
commit af216a79b1
2 changed files with 59 additions and 3 deletions

View File

@ -37,7 +37,7 @@ use constant { STATUS => '00',
COMMAND => '02',
BIN => 1,
NUM => 2,
STRING => 3,
STR => 3,
STREAM => 4,
IN => 1,
OUT => 2, };
@ -134,7 +134,7 @@ readDeviceXML($$)
my ($product, $file_name) = @_;
my $map = { bin => BIN,
num => NUM,
string => STRING,
str => STR,
stream => STREAM,
inp => IN,
out => OUT, };
@ -583,7 +583,7 @@ SWAP_Get($@)
return $ret;
}
}
foreach my $cmd ( sort keys ( %{$gl} ) ) {
$list .= " ";
$list .= $cmd;
@ -741,6 +741,14 @@ SWAP_updateReadings($$$)
} else {
$value = substr($data, $position*2, $endpoint->{size}*2);
}
if( $endpoint->{type} == STR ) {
my $v = "";
for( my $i = 0; $i < length($value)-6; $i+=2 ) {
$v .= sprintf( "%c", hex(substr($value, $i, 2)) );
}
#$value = $v;
readingsBulkUpdate($hash, lc($endpoint->{name}), $v);
}
readingsBulkUpdate($hash, SWAP_regName($rid,$i,$endpoint), $value);
++$i;
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<device>
<developer>justMe</developer>
<product>ePaper Display</product>
<pwrdownmode>false</pwrdownmode>
<regular>
<reg name="Text" id="11">
<endpoint name="Text" type="str" dir="out">
<size>18</size>
</endpoint>
</reg>
<reg name="Cmd" id="12">
<endpoint name="Command" type="num" dir="out">
<size>3</size>
</endpoint>
<endpoint name="Cmd" type="num" dir="out">
<position>0</position>
<size>1</size>
</endpoint>
<endpoint name="Args" type="num" dir="out">
<position>1</position>
<size>2</size>
</endpoint>
</reg>
<reg name="Size" id="13">
<endpoint name="Size" type="num" dir="in">
<size>6</size>
</endpoint>
<endpoint name="width" type="num" dir="in">
<position>0</position>
<size>2</size>
</endpoint>
<endpoint name="height" type="num" dir="in">
<position>2</position>
<size>2</size>
</endpoint>
<endpoint name="segmentHeight" type="num" dir="in">
<position>4</position>
<size>1</size>
</endpoint>
<endpoint name="numSegments" type="num" dir="in">
<position>5</position>
<size>1</size>
</endpoint>
</reg>
</regular>
</device>