Commit 37ebe67a by Hideaki Tai

fix ID bug

parent a460f700
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#define WHILL_SERIAL_R Serial3 #define WHILL_SERIAL_R Serial3
#define XBEE_SERIAL Serial1 #define XBEE_SERIAL Serial1
static constexpr uint8_t MY_ID = 0;
static constexpr uint32_t WHILL_SERIAL_BAUD = 38400; static constexpr uint32_t WHILL_SERIAL_BAUD = 38400;
static constexpr uint32_t XBEE_SERIAL_BAUD = 38400; static constexpr uint32_t XBEE_SERIAL_BAUD = 38400;
static constexpr uint16_t WHILL_INFO_INTERVAL_MS = 1000; static constexpr uint16_t WHILL_INFO_INTERVAL_MS = 1000;
......
...@@ -236,7 +236,7 @@ void setVelocity() ...@@ -236,7 +236,7 @@ void setVelocity()
unpacker.parse(); unpacker.parse();
while (unpacker.available()) while (unpacker.available())
{ {
if (unpacker.id() == MY_ID) if (unpacker.id() == HARDWARE_ID)
{ {
whill.move(unpacker.velocityX(), unpacker.velocityY(), unpacker.velocityW()); whill.move(unpacker.velocityX(), unpacker.velocityY(), unpacker.velocityW());
} }
...@@ -263,7 +263,7 @@ void setVelocity() ...@@ -263,7 +263,7 @@ void setVelocity()
while (unpacker.available()) while (unpacker.available())
{ {
if (unpacker.id() == MY_ID) if (unpacker.id() == HARDWARE_ID)
{ {
vel[0] = unpacker.velocityX(); vel[0] = unpacker.velocityX();
vel[1] = unpacker.velocityY(); vel[1] = unpacker.velocityY();
...@@ -287,7 +287,7 @@ void sendStatus(WhillOmni::LR lr) ...@@ -287,7 +287,7 @@ void sendStatus(WhillOmni::LR lr)
{ {
while (whill.available(lr)) while (whill.available(lr))
{ {
packer.pack(MY_ID, (uint8_t)lr, whill.battery(lr), whill.errorCode(lr)); packer.pack(HARDWARE_ID, (uint8_t)lr, whill.battery(lr), whill.errorCode(lr));
XBEE_SERIAL.write(packer.data(), packer.size()); XBEE_SERIAL.write(packer.data(), packer.size());
#ifdef DEBUG_INFO #ifdef DEBUG_INFO
......
  • Markdown is supported
    0% or
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or sign in to comment