waterpi to getopt(), encode limit using MAXGRP

The waterpi now takes command line arguments in a
sane way using getopt().  Now the device can be specified
as well.  /dev/null is the default and works fine for
testing.

A check was added to encode_cmd() to limit the number of
control groups according to MAXGRP.