message: bytes to bits
diff: @@ -215,11 +215,11 @@ void Ganglion::read_thread ()
  float package[8] = {0};
  // delta holds 8 nums because (4 by each package)
  float delta[8] = {0};
  - int bytes_per_num = 0;
  - unsigned char package_bytes[160]; // 20 * 8
  + int bits_per_num = 0;
  + unsigned char package_bits[160] = {'0'}; // 20 * 8
  for (int i = 0; i < 20; i++)
  {
  - uchar_to_bits (data.data[i], package_bytes + i * 8);
  + uchar_to_bits (data.data[i], package_bits + i * 8);
  }
  // no compression, used to init variable
  if (data.data[0] == 0)
  @@ -253,24 +253,24 @@ void Ganglion::read_thread ()
  // 18 bit compression, sends delta from previous value instead of real value!
  else if ((data.data[0] >= 1) && (data.data[0] <= 100))
  {
  - bytes_per_num = 18;
  + bits_per_num = 18;
  }
  else if ((data.data[0] >= 101) && (data.data[0] <= 200))
  {
  - bytes_per_num = 19;
  + bits_per_num = 19;
  }
  else if (data.data[0] > 200)
  {
  - Board::board_logger->warn ("unxpected value {} in first byte", data.data[0]);
  + Board::board_logger->warn ("unexpected value {} in first byte", data.data[0]);
  continue;
  }
  // handle compressed data for 18 or 19 bits
  - for (int i = 8, counter = 0; i < bytes_per_num * 8; i += bytes_per_num, counter++)
  + for (int i = 8, counter = 0; i < bits_per_num * 8; i += bits_per_num, counter++)
  {
  - if (bytes_per_num == 18)
  - delta[counter] = cast_18bit_to_int32 (package_bytes + i);
  + if (bits_per_num == 18)
  + delta[counter] = cast_18bit_to_int32 (package_bits + i);
  else
  - delta[counter] = cast_19bit_to_int32 (package_bytes + i);
  + delta[counter] = cast_19bit_to_int32 (package_bits + i);
  }
  // apply the first delta to the last data we got in the previous iteration
  