mirror of https://github.com/joan2937/pigpio
V44
This commit is contained in:
parent
2ceab346b9
commit
ab3725839f
2
pigpio.3
2
pigpio.3
|
@ -3658,7 +3658,7 @@ PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
4
pigpio.h
4
pigpio.h
|
@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#define PIGPIO_VERSION 43
|
#define PIGPIO_VERSION 44
|
||||||
|
|
||||||
/*TEXT
|
/*TEXT
|
||||||
|
|
||||||
|
@ -2761,7 +2761,7 @@ Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
|
||||||
PI_SER_OPEN_FAILED.
|
PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
No flags are currently defined. This parameter should be set to zero.
|
No flags are currently defined. This parameter should be set to zero.
|
||||||
|
|
42
pigpio.py
42
pigpio.py
|
@ -123,7 +123,6 @@ Intermediate
|
||||||
gpio_trigger Send a trigger pulse to a gpio
|
gpio_trigger Send a trigger pulse to a gpio
|
||||||
|
|
||||||
set_watchdog Set a watchdog on a gpio
|
set_watchdog Set a watchdog on a gpio
|
||||||
set_filter Set an activity filter on a gpio
|
|
||||||
|
|
||||||
set_PWM_range Configure PWM range of a gpio
|
set_PWM_range Configure PWM range of a gpio
|
||||||
get_PWM_range Get configured PWM range of a gpio
|
get_PWM_range Get configured PWM range of a gpio
|
||||||
|
@ -269,7 +268,7 @@ import threading
|
||||||
import os
|
import os
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
VERSION = "1.25"
|
VERSION = "1.26"
|
||||||
|
|
||||||
exceptions = True
|
exceptions = True
|
||||||
|
|
||||||
|
@ -962,6 +961,7 @@ class _callback:
|
||||||
"""
|
"""
|
||||||
self._notify = notify
|
self._notify = notify
|
||||||
self.count=0
|
self.count=0
|
||||||
|
self._reset = False
|
||||||
if func is None:
|
if func is None:
|
||||||
func=self._tally
|
func=self._tally
|
||||||
self.callb = _callback_ADT(user_gpio, edge, func)
|
self.callb = _callback_ADT(user_gpio, edge, func)
|
||||||
|
@ -973,6 +973,9 @@ class _callback:
|
||||||
|
|
||||||
def _tally(self, user_gpio, level, tick):
|
def _tally(self, user_gpio, level, tick):
|
||||||
"""Increment the callback called count."""
|
"""Increment the callback called count."""
|
||||||
|
if self._reset:
|
||||||
|
self._reset = False
|
||||||
|
self.count = 0
|
||||||
self.count += 1
|
self.count += 1
|
||||||
|
|
||||||
def tally(self):
|
def tally(self):
|
||||||
|
@ -985,6 +988,13 @@ class _callback:
|
||||||
"""
|
"""
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
|
def reset_tally(self):
|
||||||
|
"""
|
||||||
|
Resets the tally count to zero.
|
||||||
|
"""
|
||||||
|
self._reset = True
|
||||||
|
self.count = 0
|
||||||
|
|
||||||
class _wait_for_edge:
|
class _wait_for_edge:
|
||||||
"""Encapsulates waiting for gpio edges."""
|
"""Encapsulates waiting for gpio edges."""
|
||||||
|
|
||||||
|
@ -3103,7 +3113,7 @@ class pi():
|
||||||
module instead.
|
module instead.
|
||||||
|
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -3608,7 +3618,8 @@ class pi():
|
||||||
|
|
||||||
If a user callback is not specified a default tally callback is
|
If a user callback is not specified a default tally callback is
|
||||||
provided which simply counts edges. The count may be retrieved
|
provided which simply counts edges. The count may be retrieved
|
||||||
by calling the tally function.
|
by calling the tally function. The count may be reset to zero
|
||||||
|
by calling the reset_tally function.
|
||||||
|
|
||||||
The callback may be cancelled by calling the cancel function.
|
The callback may be cancelled by calling the cancel function.
|
||||||
|
|
||||||
|
@ -3627,6 +3638,8 @@ class pi():
|
||||||
|
|
||||||
print(cb3.tally())
|
print(cb3.tally())
|
||||||
|
|
||||||
|
cb3.reset_tally()
|
||||||
|
|
||||||
cb1.cancel() # To cancel callback cb1.
|
cb1.cancel() # To cancel callback cb1.
|
||||||
...
|
...
|
||||||
"""
|
"""
|
||||||
|
@ -3696,8 +3709,10 @@ class pi():
|
||||||
self.sl = _socklock()
|
self.sl = _socklock()
|
||||||
self._notify = None
|
self._notify = None
|
||||||
|
|
||||||
|
port = int(port)
|
||||||
|
|
||||||
self._host = host
|
self._host = host
|
||||||
self._port = int(port)
|
self._port = port
|
||||||
|
|
||||||
self.sl.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sl.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.sl.s.settimeout(None)
|
self.sl.s.settimeout(None)
|
||||||
|
@ -3706,23 +3721,22 @@ class pi():
|
||||||
self.sl.s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
self.sl.s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.sl.s.connect((self._host, self._port))
|
self.sl.s.connect((host, port))
|
||||||
self._notify = _callback_thread(self.sl, self._host, self._port)
|
self._notify = _callback_thread(self.sl, host, port)
|
||||||
|
|
||||||
except socket.error:
|
except socket.error:
|
||||||
self.connected = False
|
self.connected = False
|
||||||
if self.sl.s is not None:
|
if self.sl.s is not None:
|
||||||
self.sl.s = None
|
self.sl.s = None
|
||||||
if self._host == '':
|
if host == '':
|
||||||
h = "localhost"
|
h = "localhost"
|
||||||
else:
|
else:
|
||||||
h = self._host
|
h = host
|
||||||
|
|
||||||
errStr = "Can't connect to pigpio on {}({})".format(
|
s = "Can't connect to pigpio at {}({})".format(str(h), str(port))
|
||||||
str(h), str(self._port))
|
|
||||||
|
|
||||||
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
|
print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
|
||||||
print(errStr)
|
print(s)
|
||||||
print("")
|
print("")
|
||||||
print("Did you start the pigpio daemon? E.g. sudo pigpiod")
|
print("Did you start the pigpio daemon? E.g. sudo pigpiod")
|
||||||
print("")
|
print("")
|
||||||
|
@ -3744,6 +3758,8 @@ class pi():
|
||||||
...
|
...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.connected = False
|
||||||
|
|
||||||
if self._notify is not None:
|
if self._notify is not None:
|
||||||
self._notify.stop()
|
self._notify.stop()
|
||||||
self._notify = None
|
self._notify = None
|
||||||
|
@ -4121,7 +4137,7 @@ def xref():
|
||||||
See [*gpio*].
|
See [*gpio*].
|
||||||
|
|
||||||
wait_timeout: 0.0 -
|
wait_timeout: 0.0 -
|
||||||
The number of seconds to wait in wait_for_edge before timing out.
|
The number of seconds to wait in [*wait_for_edge*] before timing out.
|
||||||
|
|
||||||
wave_add_*:
|
wave_add_*:
|
||||||
One of [*wave_add_new*] , [*wave_add_generic*], [*wave_add_serial*].
|
One of [*wave_add_new*] , [*wave_add_generic*], [*wave_add_serial*].
|
||||||
|
|
12
pigpiod.1
12
pigpiod.1
|
@ -60,7 +60,12 @@ disable fifo interface
|
||||||
default enabled
|
default enabled
|
||||||
|
|
||||||
.IP "\fB-k\fP"
|
.IP "\fB-k\fP"
|
||||||
disable socket interface
|
disable local and remote socket interface
|
||||||
|
|
||||||
|
default enabled
|
||||||
|
|
||||||
|
.IP "\fB-l\fP"
|
||||||
|
disable remote socket interface
|
||||||
|
|
||||||
default enabled
|
default enabled
|
||||||
|
|
||||||
|
@ -79,6 +84,11 @@ clock peripheral
|
||||||
0=PWM 1=PCM
|
0=PWM 1=PCM
|
||||||
default PCM
|
default PCM
|
||||||
|
|
||||||
|
.IP "\fB-v -V\fP"
|
||||||
|
display pigpio version and exit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.IP "\fB-x mask\fP"
|
.IP "\fB-x mask\fP"
|
||||||
gpios which may be updated
|
gpios which may be updated
|
||||||
A 54 bit mask with (1<<n) set if the user may update gpio #n.
|
A 54 bit mask with (1<<n) set if the user may update gpio #n.
|
||||||
|
|
|
@ -3504,7 +3504,7 @@ PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
|
@ -2246,7 +2246,7 @@ Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
|
||||||
PI_SER_OPEN_FAILED.
|
PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
No flags are currently defined. This parameter should be set to zero.
|
No flags are currently defined. This parameter should be set to zero.
|
||||||
|
|
|
@ -3902,7 +3902,7 @@ PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
|
@ -2429,7 +2429,7 @@ Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
|
||||||
PI_SER_OPEN_FAILED.
|
PI_SER_OPEN_FAILED.
|
||||||
|
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
No flags are currently defined. This parameter should be set to zero.
|
No flags are currently defined. This parameter should be set to zero.
|
||||||
|
|
2
pigs.1
2
pigs.1
|
@ -2421,7 +2421,7 @@ devices are /dev/ttyUSBx.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The baud rate must be one of 50, 75, 110, 134, 150,
|
The baud rate must be one of 50, 75, 110, 134, 150,
|
||||||
200, 300, 600, 1200, 1800, 2400, 4800, 9500, 19200,
|
200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
|
||||||
38400, 57600, 115200, or 230400.
|
38400, 57600, 115200, or 230400.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
4
pigs.c
4
pigs.c
|
@ -168,7 +168,7 @@ void print_result(int sock, int rv, cmdCmd_t cmd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
printf(cmdUsage);
|
printf("%s", cmdUsage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* BI2CZ CF2 I2CPK I2CRD I2CRI I2CRK I2CZ SERR SLR SPIX SPIR */
|
case 6: /* BI2CZ CF2 I2CPK I2CRD I2CRI I2CRK I2CZ SERR SLR SPIX SPIR */
|
||||||
|
@ -283,7 +283,7 @@ int main(int argc , char *argv[])
|
||||||
{
|
{
|
||||||
if (command == PI_CMD_HELP)
|
if (command == PI_CMD_HELP)
|
||||||
{
|
{
|
||||||
printf(cmdUsage);
|
printf("%s", cmdUsage);
|
||||||
}
|
}
|
||||||
else if (command == PI_CMD_PARSE)
|
else if (command == PI_CMD_PARSE)
|
||||||
{
|
{
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
setup(name='pigpio',
|
setup(name='pigpio',
|
||||||
version='1.25',
|
version='1.26',
|
||||||
author='joan',
|
author='joan',
|
||||||
author_email='joan@abyz.co.uk',
|
author_email='joan@abyz.co.uk',
|
||||||
maintainer='joan',
|
maintainer='joan',
|
||||||
|
|
45
x_pigpio.c
45
x_pigpio.c
|
@ -82,7 +82,7 @@ void t1()
|
||||||
CHECK(1, 6, v, 1, 0, "write, read");
|
CHECK(1, 6, v, 1, 0, "write, read");
|
||||||
}
|
}
|
||||||
|
|
||||||
int t2_count=0;
|
int t2_count;
|
||||||
|
|
||||||
void t2cb(int gpio, int level, uint32_t tick)
|
void t2cb(int gpio, int level, uint32_t tick)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +100,8 @@ void t2()
|
||||||
f = gpioGetPWMfrequency(GPIO);
|
f = gpioGetPWMfrequency(GPIO);
|
||||||
CHECK(2, 1, f, 10, 0, "set PWM range, set/get PWM frequency");
|
CHECK(2, 1, f, 10, 0, "set PWM range, set/get PWM frequency");
|
||||||
|
|
||||||
|
t2_count=0;
|
||||||
|
|
||||||
gpioSetAlertFunc(GPIO, t2cb);
|
gpioSetAlertFunc(GPIO, t2cb);
|
||||||
|
|
||||||
gpioPWM(GPIO, 0);
|
gpioPWM(GPIO, 0);
|
||||||
|
@ -155,12 +157,12 @@ void t2()
|
||||||
gpioPWM(GPIO, 0);
|
gpioPWM(GPIO, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int t3_val = USERDATA;
|
int t3_val;
|
||||||
int t3_reset=1;
|
int t3_reset;
|
||||||
int t3_count=0;
|
int t3_count;
|
||||||
uint32_t t3_tick=0;
|
uint32_t t3_tick;
|
||||||
float t3_on=0.0;
|
float t3_on;
|
||||||
float t3_off=0.0;
|
float t3_off;
|
||||||
|
|
||||||
void t3cbf(int gpio, int level, uint32_t tick, void *userdata)
|
void t3cbf(int gpio, int level, uint32_t tick, void *userdata)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +219,13 @@ void t3()
|
||||||
|
|
||||||
printf("PWM/Servo pulse accuracy tests.\n");
|
printf("PWM/Servo pulse accuracy tests.\n");
|
||||||
|
|
||||||
|
t3_val = USERDATA;
|
||||||
|
t3_reset=1;
|
||||||
|
t3_count=0;
|
||||||
|
t3_tick=0;
|
||||||
|
t3_on=0.0;
|
||||||
|
t3_off=0.0;
|
||||||
|
|
||||||
gpioSetAlertFuncEx(GPIO, t3cbf, &t3_val); /* test extended alert */
|
gpioSetAlertFuncEx(GPIO, t3cbf, &t3_val); /* test extended alert */
|
||||||
|
|
||||||
for (t=0; t<3; t++)
|
for (t=0; t<3; t++)
|
||||||
|
@ -327,7 +336,7 @@ void t4()
|
||||||
CHECK(4, 6, n, 80, 10, "number of notifications");
|
CHECK(4, 6, n, 80, 10, "number of notifications");
|
||||||
}
|
}
|
||||||
|
|
||||||
int t5_count = 0;
|
int t5_count;
|
||||||
|
|
||||||
void t5cbf(int gpio, int level, uint32_t tick)
|
void t5cbf(int gpio, int level, uint32_t tick)
|
||||||
{
|
{
|
||||||
|
@ -369,6 +378,8 @@ To the lascivious pleasing of a lute.\n\
|
||||||
|
|
||||||
printf("Waveforms & serial read/write tests.\n");
|
printf("Waveforms & serial read/write tests.\n");
|
||||||
|
|
||||||
|
t5_count = 0;
|
||||||
|
|
||||||
gpioSetAlertFunc(GPIO, t5cbf);
|
gpioSetAlertFunc(GPIO, t5cbf);
|
||||||
|
|
||||||
gpioSetMode(GPIO, PI_OUTPUT);
|
gpioSetMode(GPIO, PI_OUTPUT);
|
||||||
|
@ -445,9 +456,9 @@ To the lascivious pleasing of a lute.\n\
|
||||||
CHECK(5, 21, c, 25016, 0, "wave get max cbs");
|
CHECK(5, 21, c, 25016, 0, "wave get max cbs");
|
||||||
}
|
}
|
||||||
|
|
||||||
int t6_count=0;
|
int t6_count;
|
||||||
int t6_on=0;
|
int t6_on;
|
||||||
uint32_t t6_on_tick=0;
|
uint32_t t6_on_tick;
|
||||||
|
|
||||||
void t6cbf(int gpio, int level, uint32_t tick)
|
void t6cbf(int gpio, int level, uint32_t tick)
|
||||||
{
|
{
|
||||||
|
@ -472,6 +483,10 @@ void t6()
|
||||||
|
|
||||||
tp = 0;
|
tp = 0;
|
||||||
|
|
||||||
|
t6_count=0;
|
||||||
|
t6_on=0;
|
||||||
|
t6_on_tick=0;
|
||||||
|
|
||||||
gpioSetAlertFunc(GPIO, t6cbf);
|
gpioSetAlertFunc(GPIO, t6cbf);
|
||||||
|
|
||||||
for (t=0; t<5; t++)
|
for (t=0; t<5; t++)
|
||||||
|
@ -489,7 +504,7 @@ void t6()
|
||||||
CHECK(6, 2, t6_on, tp, 25, "gpio trigger pulse length");
|
CHECK(6, 2, t6_on, tp, 25, "gpio trigger pulse length");
|
||||||
}
|
}
|
||||||
|
|
||||||
int t7_count=0;
|
int t7_count;
|
||||||
|
|
||||||
void t7cbf(int gpio, int level, uint32_t tick)
|
void t7cbf(int gpio, int level, uint32_t tick)
|
||||||
{
|
{
|
||||||
|
@ -502,6 +517,8 @@ void t7()
|
||||||
|
|
||||||
printf("Watchdog tests.\n");
|
printf("Watchdog tests.\n");
|
||||||
|
|
||||||
|
t7_count=0;
|
||||||
|
|
||||||
/* type of edge shouldn't matter for watchdogs */
|
/* type of edge shouldn't matter for watchdogs */
|
||||||
gpioSetAlertFunc(GPIO, t7cbf);
|
gpioSetAlertFunc(GPIO, t7cbf);
|
||||||
|
|
||||||
|
@ -559,7 +576,7 @@ void t8()
|
||||||
CHECK(8, 9, 0, 0, 0, "NOT APPLICABLE");
|
CHECK(8, 9, 0, 0, 0, "NOT APPLICABLE");
|
||||||
}
|
}
|
||||||
|
|
||||||
int t9_count = 0;
|
int t9_count;
|
||||||
|
|
||||||
void t9cbf(int gpio, int level, uint32_t tick)
|
void t9cbf(int gpio, int level, uint32_t tick)
|
||||||
{
|
{
|
||||||
|
@ -590,6 +607,8 @@ void t9()
|
||||||
|
|
||||||
gpioWrite(GPIO, 0); /* need known state */
|
gpioWrite(GPIO, 0); /* need known state */
|
||||||
|
|
||||||
|
t9_count = 0;
|
||||||
|
|
||||||
gpioSetAlertFunc(GPIO, t9cbf);
|
gpioSetAlertFunc(GPIO, t9cbf);
|
||||||
|
|
||||||
s = gpioStoreScript(script);
|
s = gpioStoreScript(script);
|
||||||
|
|
22
x_pigpio.py
22
x_pigpio.py
|
@ -574,6 +574,13 @@ def t8():
|
||||||
pigpio.exceptions = True
|
pigpio.exceptions = True
|
||||||
CHECK(8, 9, v, pigpio.PI_SOME_PERMITTED, 0, "set bank 2")
|
CHECK(8, 9, v, pigpio.PI_SOME_PERMITTED, 0, "set bank 2")
|
||||||
|
|
||||||
|
def t9waitNotHalted(s):
|
||||||
|
for check in range(10):
|
||||||
|
time.sleep(0.1)
|
||||||
|
e, p = pi.script_status(s)
|
||||||
|
if e != pigpio.PI_SCRIPT_HALTED:
|
||||||
|
return
|
||||||
|
|
||||||
def t9():
|
def t9():
|
||||||
print("Script store/run/status/stop/delete tests.")
|
print("Script store/run/status/stop/delete tests.")
|
||||||
|
|
||||||
|
@ -609,28 +616,37 @@ def t9():
|
||||||
|
|
||||||
oc = t9cb.tally()
|
oc = t9cb.tally()
|
||||||
pi.run_script(s, [99, GPIO])
|
pi.run_script(s, [99, GPIO])
|
||||||
|
|
||||||
|
t9waitNotHalted(s)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
e, p = pi.script_status(s)
|
e, p = pi.script_status(s)
|
||||||
if e != pigpio.PI_SCRIPT_RUNNING:
|
if e != pigpio.PI_SCRIPT_RUNNING:
|
||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
time.sleep(0.3)
|
time.sleep(0.2)
|
||||||
c = t9cb.tally() - oc
|
c = t9cb.tally() - oc
|
||||||
CHECK(9, 1, c, 100, 0, "store/run script")
|
CHECK(9, 1, c, 100, 0, "store/run script")
|
||||||
|
|
||||||
oc = t9cb.tally()
|
oc = t9cb.tally()
|
||||||
pi.run_script(s, [200, GPIO])
|
pi.run_script(s, [200, GPIO])
|
||||||
|
|
||||||
|
t9waitNotHalted(s)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
e, p = pi.script_status(s)
|
e, p = pi.script_status(s)
|
||||||
if e != pigpio.PI_SCRIPT_RUNNING:
|
if e != pigpio.PI_SCRIPT_RUNNING:
|
||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
time.sleep(0.3)
|
time.sleep(0.2)
|
||||||
c = t9cb.tally() - oc
|
c = t9cb.tally() - oc
|
||||||
CHECK(9, 2, c, 201, 0, "run script/script status")
|
CHECK(9, 2, c, 201, 0, "run script/script status")
|
||||||
|
|
||||||
oc = t9cb.tally()
|
oc = t9cb.tally()
|
||||||
pi.run_script(s, [2000, GPIO])
|
pi.run_script(s, [2000, GPIO])
|
||||||
|
|
||||||
|
t9waitNotHalted(s)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
e, p = pi.script_status(s)
|
e, p = pi.script_status(s)
|
||||||
if e != pigpio.PI_SCRIPT_RUNNING:
|
if e != pigpio.PI_SCRIPT_RUNNING:
|
||||||
|
@ -638,7 +654,7 @@ def t9():
|
||||||
if p[9] < 1900:
|
if p[9] < 1900:
|
||||||
pi.stop_script(s)
|
pi.stop_script(s)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
time.sleep(0.3)
|
time.sleep(0.2)
|
||||||
c = t9cb.tally() - oc
|
c = t9cb.tally() - oc
|
||||||
CHECK(9, 3, c, 110, 20, "run/stop script/script status")
|
CHECK(9, 3, c, 110, 20, "run/stop script/script status")
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ void t2()
|
||||||
dc = get_PWM_dutycycle(GPIO);
|
dc = get_PWM_dutycycle(GPIO);
|
||||||
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
|
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
@ -122,6 +123,7 @@ void t2()
|
||||||
f = get_PWM_frequency(GPIO);
|
f = get_PWM_frequency(GPIO);
|
||||||
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
|
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
@ -131,6 +133,7 @@ void t2()
|
||||||
f = get_PWM_frequency(GPIO);
|
f = get_PWM_frequency(GPIO);
|
||||||
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
|
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
|
|
@ -113,6 +113,7 @@ void t2(int pi)
|
||||||
dc = get_PWM_dutycycle(pi, GPIO);
|
dc = get_PWM_dutycycle(pi, GPIO);
|
||||||
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
|
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
@ -122,6 +123,7 @@ void t2(int pi)
|
||||||
f = get_PWM_frequency(pi, GPIO);
|
f = get_PWM_frequency(pi, GPIO);
|
||||||
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
|
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
@ -131,6 +133,7 @@ void t2(int pi)
|
||||||
f = get_PWM_frequency(pi, GPIO);
|
f = get_PWM_frequency(pi, GPIO);
|
||||||
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
|
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
|
||||||
|
|
||||||
|
time_sleep(0.2);
|
||||||
oc = t2_count;
|
oc = t2_count;
|
||||||
time_sleep(2);
|
time_sleep(2);
|
||||||
f = t2_count - oc;
|
f = t2_count - oc;
|
||||||
|
|
6
x_pigs
6
x_pigs
|
@ -189,9 +189,9 @@ if [[ $s = "" ]]; then echo "SERVO-d ok"; else echo "SERVO-d fail ($s)"; fi
|
||||||
|
|
||||||
s=$(pigs wvclr)
|
s=$(pigs wvclr)
|
||||||
if [[ $s = "" ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
|
if [[ $s = "" ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
|
||||||
s=$(pigs slro $GPIO 1200 8)
|
s=$(pigs slro $GPIO 4800 8)
|
||||||
if [[ $s = "" ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
|
if [[ $s = "" ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
|
||||||
s=$(pigs wvas $GPIO 1200 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e)
|
s=$(pigs wvas $GPIO 4800 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e)
|
||||||
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
|
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
|
||||||
s=$(pigs m $GPIO w)
|
s=$(pigs m $GPIO w)
|
||||||
if [[ $s = "" ]]; then echo "SLR-d ok"; else echo "SLR-d fail ($s)"; fi
|
if [[ $s = "" ]]; then echo "SLR-d ok"; else echo "SLR-d fail ($s)"; fi
|
||||||
|
@ -199,7 +199,7 @@ w=$(pigs wvcre)
|
||||||
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($s)"; fi
|
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($s)"; fi
|
||||||
s=$(pigs wvtx $w)
|
s=$(pigs wvtx $w)
|
||||||
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
|
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
|
||||||
sleep 0.2
|
sleep 0.4
|
||||||
s=$(pigs slr $GPIO 100)
|
s=$(pigs slr $GPIO 100)
|
||||||
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
|
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
|
||||||
if [[ $s = $e ]]
|
if [[ $s = $e ]]
|
||||||
|
|
6
x_pipe
6
x_pipe
|
@ -261,10 +261,10 @@ if [[ $s = 0 ]]; then echo "SERVO-d ok"; else echo "SERVO-d fail ($s)"; fi
|
||||||
echo "wvclr" >/dev/pigpio
|
echo "wvclr" >/dev/pigpio
|
||||||
read -t 1 s </dev/pigout
|
read -t 1 s </dev/pigout
|
||||||
if [[ $s = 0 ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
|
if [[ $s = 0 ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
|
||||||
echo "slro $GPIO 1200 8" >/dev/pigpio
|
echo "slro $GPIO 4800 8" >/dev/pigpio
|
||||||
read -t 1 s </dev/pigout
|
read -t 1 s </dev/pigout
|
||||||
if [[ $s = 0 ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
|
if [[ $s = 0 ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
|
||||||
echo "wvas $GPIO 1200 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e" >/dev/pigpio
|
echo "wvas $GPIO 4800 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e" >/dev/pigpio
|
||||||
read -t 1 s </dev/pigout
|
read -t 1 s </dev/pigout
|
||||||
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
|
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
|
||||||
echo "m $GPIO w" >/dev/pigpio
|
echo "m $GPIO w" >/dev/pigpio
|
||||||
|
@ -276,7 +276,7 @@ if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($w)"; fi
|
||||||
echo "wvtx $w" >/dev/pigpio
|
echo "wvtx $w" >/dev/pigpio
|
||||||
read -t 1 s </dev/pigout
|
read -t 1 s </dev/pigout
|
||||||
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
|
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
|
||||||
sleep 0.2
|
sleep 0.4
|
||||||
echo "slr $GPIO 100" >/dev/pigpio
|
echo "slr $GPIO 100" >/dev/pigpio
|
||||||
read -t 1 s </dev/pigout
|
read -t 1 s </dev/pigout
|
||||||
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
|
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
|
||||||
|
|
Loading…
Reference in New Issue