Code Monkey home page Code Monkey logo

libb6's Introduction

libb6

This is a library for interfacing with SkyRC B6xx series chargers. It was tested on B6AC v2, but should work fine on other chargers from this series. Some of the packets are based on lachs0r's incredible work on https://github.com/lachs0r/b6mon and the rest were sniffed and analyzed with Wireshark.

Installation

Dependencies:

libusb-1.0

Run these commands to install the library and it's headers on your system:

$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
$ make
$ sudo make install

Either run the programs that use it as root (not recommended) or create an udev rule similar to this one:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0001", MODE:="666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev"

Example

Here is an example that reads the number of cells the charger supports:

#include <iostream>
#include <b6/Device.hh>

int main() {
  auto dev = new b6::Device(); // the constructor handles libusb init, claiming the device interface etc.
  
  std::cout << "Number of cells: " << dev->getCellCount() << std::endl;
  
  delete dev; // this releases the device, reattaches the kernel driver and frees libusb
  return 0;
}

libb6's People

Contributors

maciek134 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libb6's Issues

error causes core dump

Amazing work on this - you're the best, thank you!

Currently, any error causes a core dump and abort of the program. The problem is, some errors, like incorrect cell count, persist on the charger, and I can't restart the program automatically without physically pressing the 'stop' button on the b6.

terminate called after throwing an instance of 'b6::ErrorCellNumberIncorrect' what(): std::exception Aborted (core dumped)
Is there a way to capture the error but keep the code running and, ideally, return to the main menu and try again?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.