128,7 → 128,7 |
{-324000, 324000, 1200, 1600}, |
{-324000, 324000, 1200, 1600}}}; |
|
#define SERVO_TIMEOUT 1000000 |
#define SERVO_TIMEOUT 100000 |
|
#define RXTX_BUFF_MAX 100 |
volatile static BYTE RXTX_buff[4][RXTX_BUFF_MAX]; |
803,17 → 803,23 |
|
} |
|
/* 0100:0aaa */ |
int servo_get_analog(int port, int adport) |
/* 0100:baaa */ |
int servo_get_analog(int port, int adport, int nbit) |
{ |
unsigned char b[1],r[2]; |
int res, RX, t; |
int res, RX, t, nb; |
int servo_port = (unsigned)(port); |
|
if (adport > 7) return -1; |
nb = (nbit==8) ? 0 : 1; |
|
b[0] = 0x40 | (adport & 0x07); |
RX = servo_send_msg(servo_port, b, 1, r, 2); |
if (nb) { |
RX = servo_send_msg(servo_port, b, 1, r, 2); |
} else { |
b[0] |= 0x08; |
RX = servo_send_msg(servo_port, b, 1, r, 1); |
} |
|
if (RX != -1) { |
|
821,8 → 827,12 |
|
if (t == 0) { |
|
res = (int)r[0] << 8; |
res |= r[1]; |
if (nb) { |
res = (int)r[0] << 8; |
res |= r[1]; |
} else { |
res = r[0]; |
} |
|
return res; |
|