PDA

View Full Version : RE: X10 Plugin



Chris Hemmerly
2003-12-19, 07:57
I, too, have had the "repeating command" problem with the plugin I wrote.
Inside my plugin, up and down increment a number that I keep track of, which
is used to display a certain file, based upon what the current number is.

When I press "up" or "down" on the remote, it often increments the number
more than once, as if I'd held down the button to be repeated.

I haven't yet found a solution to this, unfortunately, and have just had to
be very careful about pressing up/down very quickly. :P

/Chris

--- Eric Gauthier <EGauthier (AT) comcast (DOT) net> wrote:
> >> OK, I have tackled my first plugin, and started an X10 plugin. I am
> >> using the up/down commands in the plug in to cycle through house
> >> codes. However, I seem to be receiving each command more than once,
> >> as if it is a repeat key. If I am careful, I can get just
> >once, but I
> >> have to be very careful.
> >>
> >> Can someone point me at an example of filtering out this noise?
> >
> >in the %function UP subroutine, try caling $client->update()
> >as the last command. also, update any variable you are using
> >to keep track of the current position.
> >
>
> Kevin,
>
> I am already calling $client->update() from my up function. Here it is:
>
> 'up' => sub {
> my $client = shift;
> x10_change_housecode($client, '+');
> $client->update();
> },
>
> The x10_change_housecode() routine just updates some client specific
> variables, it isn't making any Slim calls at all.
>
> >you can also look into using INPUT.list for navigation and
> >have that take care of it for you. Look at
> >Slim/Buttons/Settings.pm or Plugins/Snow.pm for examples on
> >how it is used. The help section of the server also has a
> >very complete and up-to-date document on it.
>
> I looked at INPUT.list, and it looks like it is really overkill. Also, I
> don't want to scroll to a new screen for input. I am changing 2 different
> sets of data, one is scrolled through, and the other is a directly entered
> number. I am updating the screen in place, like an overlay. It my quick
> perusal of INPUT.List, it didn't appear to do this, it is basically just one
> data entry from a list. My approach is working fine, except for this one
> little glitch with the up/down buttons.
>
> I am going to try a custom map with arrow_down.repeat and arrow_up.repeat
> mapped to dead to see how that goes.
>
> -Eric
>
>
>

kdf
2003-12-19, 10:30
Quoting Chris Hemmerly <chrishemmerly (AT) yahoo (DOT) com>:

>
> I, too, have had the "repeating command" problem with the plugin I wrote.
> Inside my plugin, up and down increment a number that I keep track of, which
> is used to display a certain file, based upon what the current number is.
>
> When I press "up" or "down" on the remote, it often increments the number
> more than once, as if I'd held down the button to be repeated.
>
> I haven't yet found a solution to this, unfortunately, and have just had to
> be very careful about pressing up/down very quickly. :P

You need to use the scroll command as Robert suggested. This not only takes
care up updating position, but also takes care of timing so that you dont repeat
too fast, and also so you can scroll through long lists with an increasing speed
as you go.

my $newposition = Slim::Buttons::Common::scroll($client, -1,
$client->numberOfDirItems(), $client->currentDirItem());
$client->currentDirItem($newposition);

-kdf


> --- Eric Gauthier <EGauthier (AT) comcast (DOT) net> wrote:
> > >> OK, I have tackled my first plugin, and started an X10 plugin. I am
> > >> using the up/down commands in the plug in to cycle through house
> > >> codes. However, I seem to be receiving each command more than once,
> > >> as if it is a repeat key. If I am careful, I can get just
> > >once, but I
> > >> have to be very careful.
> > >>
> > >> Can someone point me at an example of filtering out this noise?
> > >
> > >in the %function UP subroutine, try caling $client->update()
> > >as the last command. also, update any variable you are using
> > >to keep track of the current position.
> > >
> >
> > Kevin,
> >
> > I am already calling $client->update() from my up function. Here it is:
> >
> > 'up' => sub {
> > my $client = shift;
> > x10_change_housecode($client, '+');
> > $client->update();
> > },
> >
> > The x10_change_housecode() routine just updates some client specific
> > variables, it isn't making any Slim calls at all.
> >
> > >you can also look into using INPUT.list for navigation and
> > >have that take care of it for you. Look at
> > >Slim/Buttons/Settings.pm or Plugins/Snow.pm for examples on
> > >how it is used. The help section of the server also has a
> > >very complete and up-to-date document on it.
> >
> > I looked at INPUT.list, and it looks like it is really overkill. Also, I
> > don't want to scroll to a new screen for input. I am changing 2 different
> > sets of data, one is scrolled through, and the other is a directly entered
> > number. I am updating the screen in place, like an overlay. It my quick
> > perusal of INPUT.List, it didn't appear to do this, it is basically just
> one
> > data entry from a list. My approach is working fine, except for this one
> > little glitch with the up/down buttons.
> >
> > I am going to try a custom map with arrow_down.repeat and arrow_up.repeat
> > mapped to dead to see how that goes.
> >
> > -Eric
> >
> >
> >