mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 16:05:19 +00:00
74_AutomowerConnect: Common.pm minor internal changes
git-svn-id: https://svn.fhem.de/fhem/trunk@27837 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
99bc5fbebb
commit
7ee56dc10a
@ -207,12 +207,15 @@ my $mapZonesTpl = '{
|
|||||||
newdatasets => 0,
|
newdatasets => 0,
|
||||||
newcollisions => 0,
|
newcollisions => 0,
|
||||||
newzonedatasets => 0,
|
newzonedatasets => 0,
|
||||||
|
cuttingHeightLatency => 100,
|
||||||
|
cuttingHeightLast => 0,
|
||||||
positionsTime => 0,
|
positionsTime => 0,
|
||||||
storesum => 0,
|
storesum => 0,
|
||||||
statusTime => 0,
|
statusTime => 0,
|
||||||
cspos => [],
|
cspos => [],
|
||||||
areapos => [],
|
areapos => [],
|
||||||
errorstack => [],
|
errorstack => [],
|
||||||
|
errorstackmax => 5,
|
||||||
lasterror => {
|
lasterror => {
|
||||||
positions => [],
|
positions => [],
|
||||||
timestamp => 0,
|
timestamp => 0,
|
||||||
@ -1419,9 +1422,10 @@ sub Attr {
|
|||||||
}
|
}
|
||||||
##########
|
##########
|
||||||
} elsif ( $attrName eq 'numberOfWayPointsToDisplay' ) {
|
} elsif ( $attrName eq 'numberOfWayPointsToDisplay' ) {
|
||||||
|
|
||||||
|
return "$iam $attrVal is invalid, min value is 100." if ( $attrVal < 100 );
|
||||||
my $icurr = scalar @{$hash->{helper}{areapos}};
|
my $icurr = scalar @{$hash->{helper}{areapos}};
|
||||||
if( $cmd eq "set" && $attrVal =~ /\d+/ && $attrVal > 100 ) {
|
if( $cmd eq "set" && $attrVal =~ /\d+/ ) {
|
||||||
|
|
||||||
# reduce array
|
# reduce array
|
||||||
$hash->{helper}{MOWING}{maxLength} = $attrVal;
|
$hash->{helper}{MOWING}{maxLength} = $attrVal;
|
||||||
@ -1629,7 +1633,7 @@ sub AlignArray {
|
|||||||
|
|
||||||
} elsif ( $use_position_polling ) {
|
} elsif ( $use_position_polling ) {
|
||||||
|
|
||||||
if ( $reverse_positions_order ) {
|
if ( $reverse_pollpos_order ) {
|
||||||
|
|
||||||
@ar = reverse @ar if ( $cnt > 1 ); # positions seem to be in reversed order
|
@ar = reverse @ar if ( $cnt > 1 ); # positions seem to be in reversed order
|
||||||
|
|
||||||
@ -1676,13 +1680,18 @@ sub AlignArray {
|
|||||||
ZoneHandling ( $hash, $tmp, $cnt );
|
ZoneHandling ( $hash, $tmp, $cnt );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# set cutting height per zone
|
# set cutting height per zone
|
||||||
if ( AttrVal($name, 'mapZones', 0) && $act =~ /^MOWING$/
|
|
||||||
&& defined( $hash->{helper}{currentZone} )
|
if ( AttrVal( $name, 'mapZones', 0 ) && $act =~ /^(MOWING)$/
|
||||||
&& defined( $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} )) {
|
&& defined( $hash->{helper}{currentZone} )
|
||||||
|
&& defined( $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} )
|
||||||
|
&& $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} != $hash->{helper}{mower}{attributes}{settings}{cuttingHeight}
|
||||||
|
&& ( $hash->{helper}{cuttingHeightLast} + $hash->{helper}{cuttingHeightLatency} ) < scalar gettimeofday() ) {
|
||||||
|
|
||||||
RemoveInternalTimer( $hash, \&setCuttingHeight );
|
RemoveInternalTimer( $hash, \&setCuttingHeight );
|
||||||
InternalTimer( gettimeofday() + 11, \&setCuttingHeight, $hash, 0 )
|
InternalTimer( gettimeofday() + 11, \&setCuttingHeight, $hash, 0 )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if ( $act =~ /^(CHARGING|PARKED_IN_CS)$/ && $actold =~ /^(PARKED_IN_CS|CHARGING)$/ ) {
|
# if ( $act =~ /^(CHARGING|PARKED_IN_CS)$/ && $actold =~ /^(PARKED_IN_CS|CHARGING)$/ ) {
|
||||||
@ -1722,7 +1731,7 @@ sub isErrorThanPrepare {
|
|||||||
|
|
||||||
my $tmp = dclone( $hash->{helper}{lasterror} );
|
my $tmp = dclone( $hash->{helper}{lasterror} );
|
||||||
unshift ( @{ $hash->{helper}{errorstack} }, $tmp );
|
unshift ( @{ $hash->{helper}{errorstack} }, $tmp );
|
||||||
pop ( @{ $hash->{helper}{errorstack} } ) if ( @{ $hash->{helper}{errorstack} } > 5 );
|
pop ( @{ $hash->{helper}{errorstack} } ) if ( @{ $hash->{helper}{errorstack} } > $hash->{helper}{errorstackmax} );
|
||||||
::FHEM::Devices::AMConnect::Common::FW_detailFn_Update ($hash);
|
::FHEM::Devices::AMConnect::Common::FW_detailFn_Update ($hash);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2017,9 +2026,14 @@ sub readMap {
|
|||||||
sub setCuttingHeight {
|
sub setCuttingHeight {
|
||||||
my ( $hash ) = @_;
|
my ( $hash ) = @_;
|
||||||
RemoveInternalTimer( $hash, \&setCuttingHeight );
|
RemoveInternalTimer( $hash, \&setCuttingHeight );
|
||||||
CMD( $hash ,'cuttingHeight', $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} )
|
|
||||||
if ( $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} != $hash->{helper}{mower}{attributes}{settings}{cuttingHeight} );
|
if ( $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} != $hash->{helper}{mower}{attributes}{settings}{cuttingHeight} ) {
|
||||||
|
|
||||||
|
CMD( $hash ,'cuttingHeight', $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{cuttingHeight} );
|
||||||
|
$hash->{helper}{cuttingHeightLast} = scalar gettimeofday();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2085,7 +2099,7 @@ sub fillReadings {
|
|||||||
$hash->{MODEL} = $model if ( $model && $hash->{MODEL} ne $model );
|
$hash->{MODEL} = $model if ( $model && $hash->{MODEL} ne $model );
|
||||||
$pref = 'planner';
|
$pref = 'planner';
|
||||||
readingsBulkUpdateIfChanged( $hash, "planner_restrictedReason", $hash->{helper}{mower}{attributes}{$pref}{restrictedReason} );
|
readingsBulkUpdateIfChanged( $hash, "planner_restrictedReason", $hash->{helper}{mower}{attributes}{$pref}{restrictedReason} );
|
||||||
readingsBulkUpdateIfChanged( $hash, "planner_overrideAction", $hash->{helper}{mower}{attributes}{$pref}{override}{action} );
|
readingsBulkUpdateIfChanged( $hash, "planner_overrideAction", $hash->{helper}{mower}{attributes}{$pref}{override}{action} ) if ( $hash->{helper}{mower}{attributes}{$pref}{override}{action} );
|
||||||
|
|
||||||
$tstamp = $hash->{helper}{mower}{attributes}{$pref}{nextStartTimestamp};
|
$tstamp = $hash->{helper}{mower}{attributes}{$pref}{nextStartTimestamp};
|
||||||
$timestamp = FmtDateTimeGMT( $tstamp/1000 );
|
$timestamp = FmtDateTimeGMT( $tstamp/1000 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user