Multiwii EZGUI + Flexbot using BLE(Bluetooth4.0)

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
hansl2004
Posts: 4
Joined: Mon Aug 04, 2014 9:18 am

Multiwii EZGUI + Flexbot using BLE(Bluetooth4.0)

Post by hansl2004 »

Hello Multiwii software developers!

I'm developing an Multiwii drone control application with Android.

I'm using HM-10 which is BLE module(Bluetooth 4.0) and Arduino Mega2560, and Multiwii version 2.3

I am now using EZGUI app source and Flexbot app source. In fact, I am combining two apps in one.

Flexbot application uses BLE module, so it was not hard to integrate, but EZGUI uses Bluetooth 2.0, so two apps have different methods and functions for bluetooth.

The problem is, sending MSP protocols from Android to Multiwii seems ok, but getting MSP about Multiwii status from Multiwii to android is not working well.

MSP byte values between -127 ~ 127 from Multiwii are well sended to Android, but if the value is over 127, strange byte values are received.

I think this is because java byte range is between -127 ~127, but C++ is 0~ 255.

if values that are larger than 128 from Multiwii have specific values that has information about real values, It can be fixed by using & or ^ things, but

if values are larger than 128, whatever the real byte value is, it always has same values.

If there are someone who fixed this problem or has idea for this problem, please give some advice. If my source code is needed, I can upload my source.

anyway, I going to share my code when I finish my work.
Attachments
KakaoTalk_20150402_232729220.jpg

zed_thirteen
Posts: 3
Joined: Sun Nov 02, 2014 2:32 pm

Re: Multiwii EZGUI + Flexbot using BLE(Bluetooth4.0)

Post by zed_thirteen »

you could try casting each byte to int through a function:

public static int unsignedToBytes(byte b) {
return b & 0xFF;
}

public static void main(String[] args) {
System.out.println(unsignedToBytes((byte) -12));
}


I'm a C/C++/C# programmer though. I can't vouch for this code but googling shows there is no unsigned byte in Java. This looks like it should work for you though.

hansl2004
Posts: 4
Joined: Mon Aug 04, 2014 9:18 am

Re: Multiwii EZGUI + Flexbot using BLE(Bluetooth4.0)

Post by hansl2004 »

Thanks for reply, but well..

As I wrote, values larger than 127 from Multiwii to Android has always same value,

for example, Multiwii version is '230' but Android gets this value like this : -17 -65 -64

If I change Multiwii version to '250' in Multiwii.h, Android gets same value as -17 -65 -64

I mean, any value that is larger than 127 goes to same value (-17 -65 -64)

So using 0xff is not useful... I've already tried. I think I should add or fix some codes in Multiwii C++ code, but I don know how..

And, EZGUI gets bluetooth broadcast byte values in a byte, but because I'm using BLE module, it only supports byte array for sending and receiving broadcast.

hansl2004
Posts: 4
Joined: Mon Aug 04, 2014 9:18 am

Re: Multiwii EZGUI + Flexbot using BLE(Bluetooth4.0)

Post by hansl2004 »

36 77 62 7 100 -17 -65 -67 3 10 0 0 0 0 -17 -65 -67
When Android send request MSP_IDENT, Multiwii send this byte array to Android.
always -17 -65 -67 for values that is larger than 127.
Furthermore, -17 -65 -17 should be in one byte array index

Post Reply