diff options
Diffstat (limited to 'serial/wheel.c')
-rw-r--r-- | serial/wheel.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/serial/wheel.c b/serial/wheel.c index 8155734..c470234 100644 --- a/serial/wheel.c +++ b/serial/wheel.c | |||
@@ -5,7 +5,8 @@ char *portname; // 串口设备名 | |||
5 | struct termios tty; | 5 | struct termios tty; |
6 | 6 | ||
7 | bool whellInit() { | 7 | bool whellInit() { |
8 | portname = findUSBDev("wheel"); | 8 | // portname = findUSBDev("wheel"); |
9 | portname = "/dev/ttyUSB1"; // "/dev/ttyUSB1 | ||
9 | if (portname == NULL) { | 10 | if (portname == NULL) { |
10 | fprintf(stderr, "Error: Failed to find wheel serial port\n"); | 11 | fprintf(stderr, "Error: Failed to find wheel serial port\n"); |
11 | return false; | 12 | return false; |
@@ -55,6 +56,10 @@ bool wheelSend(byte a, byte a_v, byte b, byte b_v) { | |||
55 | unsigned char data[7] = {0x53, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}; | 56 | unsigned char data[7] = {0x53, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}; |
56 | byte checksum = 0; | 57 | byte checksum = 0; |
57 | data[2] = a; | 58 | data[2] = a; |
59 | // TODO: 速度转换 | ||
60 | int temp = ((int)a_v + 2); | ||
61 | a_v = (byte)temp; | ||
62 | //////////////////////// | ||
58 | data[3] = a_v; | 63 | data[3] = a_v; |
59 | data[4] = b; | 64 | data[4] = b; |
60 | data[5] = b_v; | 65 | data[5] = b_v; |