mirror of https://github.com/joan2937/pigpio
Merge branch 'dbbnrl-master'
This commit is contained in:
commit
1df9fb3c0e
|
@ -890,11 +890,11 @@ int cmdParse(
|
||||||
*/
|
*/
|
||||||
ctl->eaten += getNum(buf+ctl->eaten, &p[1], &ctl->opt[1]);
|
ctl->eaten += getNum(buf+ctl->eaten, &p[1], &ctl->opt[1]);
|
||||||
ctl->eaten += getNum(buf+ctl->eaten, &p[2], &ctl->opt[2]);
|
ctl->eaten += getNum(buf+ctl->eaten, &p[2], &ctl->opt[2]);
|
||||||
ctl->eaten += getNum(buf+ctl->eaten, &tp1, &to1);
|
ctl->eaten += getNum(buf+ctl->eaten, &tp1, &ctl->opt[3]);
|
||||||
|
|
||||||
if ((ctl->opt[1] > 0) && ((int)p[1] >= 0) &&
|
if ((ctl->opt[1] > 0) && ((int)p[1] >= 0) &&
|
||||||
(ctl->opt[2] > 0) && ((int)p[2] >= 0) &&
|
(ctl->opt[2] > 0) && ((int)p[2] >= 0) &&
|
||||||
(to1 == CMD_NUMERIC) && ((int)tp1 >= 0))
|
(ctl->opt[3] > 0) && ((int)tp1 >= 0))
|
||||||
{
|
{
|
||||||
p[3] = 4;
|
p[3] = 4;
|
||||||
memcpy(ext, &tp1, 4);
|
memcpy(ext, &tp1, 4);
|
||||||
|
|
12
pigpio.c
12
pigpio.c
|
@ -6508,7 +6508,7 @@ static void *pthScript(void *x)
|
||||||
{
|
{
|
||||||
gpioScript_t *s;
|
gpioScript_t *s;
|
||||||
cmdInstr_t instr;
|
cmdInstr_t instr;
|
||||||
int p1, p2, p1o, p2o, *t1, *t2;
|
int p1, p2, p1o, p2o, p3o, *t1, *t2;
|
||||||
int PC, A, F, SP;
|
int PC, A, F, SP;
|
||||||
int S[PI_SCRIPT_STACK_SIZE];
|
int S[PI_SCRIPT_STACK_SIZE];
|
||||||
char buf[CMD_MAX_EXTENSION];
|
char buf[CMD_MAX_EXTENSION];
|
||||||
|
@ -6553,9 +6553,19 @@ static void *pthScript(void *x)
|
||||||
if (instr.p[0] < 100)
|
if (instr.p[0] < 100)
|
||||||
{
|
{
|
||||||
if (instr.p[3])
|
if (instr.p[3])
|
||||||
|
{
|
||||||
|
if ((instr.p[3] == sizeof(int)) && ((instr.opt[3] == CMD_VAR) || (instr.opt[3] == CMD_PAR)))
|
||||||
|
{
|
||||||
|
/* Hack to allow register use in 3rd parameter */
|
||||||
|
memcpy((char*)&p3o, (char *)instr.p[4], sizeof(int));
|
||||||
|
if (instr.opt[3] == CMD_VAR) memcpy(buf, (char *)&(s->script.var[p3o]), sizeof(int));
|
||||||
|
else memcpy(buf, (char *)&(s->script.par[p3o]), sizeof(int));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
memcpy(buf, (char *)instr.p[4], instr.p[3]);
|
memcpy(buf, (char *)instr.p[4], instr.p[3]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
A = myDoCommand(instr.p, sizeof(buf)-1, buf);
|
A = myDoCommand(instr.p, sizeof(buf)-1, buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue