New Multiwii Serial Protocol

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
LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: New Multiwii Serial Protocol

Post by LenzGr »

Subscribing. As I'm about to implement a minimalistic configuration tool using Python on Symbian, this is going to be useful.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Alex, what are the implications of sending this information over the I2C bus?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

LenzGr wrote:Subscribing. As I'm about to implement a minimalistic configuration tool using Python on Symbian, this is going to be useful.

Hi LenzGr,
I do not know about your motivation for implementing a 'minimalistic configuration tool' for sybian. But wanted to let you know you could probably circumvent the effort by using the existing LCD_CONF and LCD_VT100 implementation. That way you would only need to find a vt100 aware terminal program and connect your symbinan phone via BT. As a side effect you'd get live telemetry for free as well. I started a thread over at RCG with some photos of various smartphones doing this.

Magnetron
Posts: 124
Joined: Tue Jul 05, 2011 4:32 pm

Re: New Multiwii Serial Protocol

Post by Magnetron »

I thinks it's a good idea.
A new high efficency serial protocol is a must!
Good work Alex!
I think it is time to introduce a new GUI also... do you think?

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: New Multiwii Serial Protocol

Post by nhadrian »

Dear Alex,

did you spoken about this with EOSBandi? That would be great if this new serial protocol would be supported by WinGUI!!!

BR
Adrian

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

nicodh wrote:Hi Alex, I like this, It's going to be easy to transmit data (it's hard to dissassemble the char string with the current protocol)
When it will be release? I mean, I will need to modify my new android configurator (witch is for naze32 at the base) to keep the compatibility with multiwwi original.

Hi,
My plan is to finalize it rapidly in order to have a good common and independent basis for OSD/GUI/phone apps/...

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

copterrichie wrote:I strongly believe this is a major step in the right direction and opens the door to a wide variety of Wii Telemetry options.

Thanks Alex,

Question, is this new protocol presently implemented in the MultiConf?


It's currently implemented in the last dev release.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

copterrichie wrote:Just one more thing Alex, when I tried compiling the code with "#define I2C_GPS" enabled, I receive the following error message.

MultiWii:451: error: 'GPS_reset_home_position' was not declared in this scope

it was a typo error, it's solved now

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

nhadrian wrote:Dear Alex,

did you spoken about this with EOSBandi? That would be great if this new serial protocol would be supported by WinGUI!!!

BR
Adrian


I tried to document well the code about the protocol implementation.
It should be quite easy to implement and replace in WinGUI.

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: New Multiwii Serial Protocol

Post by LenzGr »

Hamburger wrote:I do not know about your motivation for implementing a 'minimalistic configuration tool' for sybian. But wanted to let you know you could probably circumvent the effort by using the existing LCD_CONF and LCD_VT100 implementation. That way you would only need to find a vt100 aware terminal program and connect your symbinan phone via BT. As a side effect you'd get live telemetry for free as well. I started a thread over at RCG with some photos of various smartphones doing this.

Yes, I'm familiar with your work - I did read about it when I tried to figure out how I could use my Nokia mobile phone (an N71) as a configuration utility (I don't want to lug a Laptop into the field just for tweaking PID parameters). Unfortunately I could not find any terminal application for Symbian that supports establishing serial communications over Bluetooth. And before I start implementing a vt100 terminal emulation in Python, I'd rather try to use the native serial protocol to update the few widgets I'm interested in :)

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: New Multiwii Serial Protocol

Post by LuFa »

Hi

At the moment i try to read the data from multiwii with the new Multiwii Protocoll .

But for the moment my programm doesnt work :(

I try it with this code :

Code: Select all

int Byte; 

void setup() {
 
  Serial.begin(115200); // Serial Monitor
  Serial1.begin(115200); // Mwii

}

void loop() {

  /* Data request */
  Serial1.write('$');
  Serial1.write('M');
  Serial1.write('>');
  Serial1.write(102); // 9 DOF IMU Data Massage request
 
  /* Read Data from Mwii */
  while (Serial1.available() > 0) {
   
    Byte = Serial1.read(); 
    Serial.println(Byte); // Print data from Multiwii
 
  }
 
}
   





can anyone help me ?

Thanks !

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

maybe your code is too fast? If the other side does not respond quickly enough, your while loop has nothing to execute. You may have to insert something like 'while (!Serial1.available() ) /*do nothing*/;'

dynai
Posts: 32
Joined: Tue Mar 01, 2011 10:01 pm

Re: New Multiwii Serial Protocol

Post by dynai »

Hi,

would it be possible to have the communication on MEGA on Serial3 as well? or as an Option?
this would allow to permanently wire a zig-bee, bluetooth or APC 220 to that port

kind regards Christoph

JohnyGab
Posts: 144
Joined: Sat Oct 29, 2011 4:41 am

Re: New Multiwii Serial Protocol

Post by JohnyGab »

i'm going to try to integrate that into Rushduino OSD ;)

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

LuFa wrote:Hi

At the moment i try to read the data from multiwii with the new Multiwii Protocoll .

But for the moment my programm doesnt work :(

I try it with this code :

Code: Select all

int Byte; 

void setup() {
 
  Serial.begin(115200); // Serial Monitor
  Serial1.begin(115200); // Mwii

}

void loop() {

  /* Data request */
  Serial1.write('$');
  Serial1.write('M');
  Serial1.write('>');
  Serial1.write(102); // 9 DOF IMU Data Massage request
 
  /* Read Data from Mwii */
  while (Serial1.available() > 0) {
   
    Byte = Serial1.read(); 
    Serial.println(Byte); // Print data from Multiwii
 
  }
 
}
   





can anyone help me ?

Thanks !

Serial1.write('<');

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

dynai wrote:Hi,

would it be possible to have the communication on MEGA on Serial3 as well? or as an Option?
this would allow to permanently wire a zig-bee, bluetooth or APC 220 to that port

kind regards Christoph


It would be possible, but currently the code can handle only one port via TX interrupt (needed for communication)
The mod should not be complicated

Synthex
Posts: 7
Joined: Wed Dec 14, 2011 11:09 am
Location: Lille France

Re: New Multiwii Serial Protocol

Post by Synthex »

Very good work Alex !!

By cons, when the link is bad, I receive incorrect values​​.
Do you use the checksum to validate incoming messages ?

just for information, there must be a display issue on GPS.
Attachments
multiwii003.png

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

Synthex wrote:Very good work Alex !!

By cons, when the link is bad, I receive incorrect values​​.
Do you use the checksum to validate incoming messages ?

just for information, there must be a display issue on GPS.


Hi,
Thank you for pointing me the GUI lat/long bug.
It was a typo in the GUI.

Every message with a data payload are checksummed, and the GUI should keep the old values until a good is received.
I don't have explanations for the moment about your "spike"

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

Would that typo also explain why reset and calib.acc do not work in gui?

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: New Multiwii Serial Protocol

Post by nhadrian »

Hi, also there is possibly a BUG in debug values either on MW or GUI side because al the debug parameters are constantly zero and doesn't matter what I define in sketch for debug...
BR
Adrian

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: New Multiwii Serial Protocol

Post by PatrikE »

I dont have a baro but tested a walue on debug2 and it works

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: New Multiwii Serial Protocol

Post by kos »

i am unable to connect to mwc using the new serial protocol from MultiWii_dev_20120414.zip, witjout any modification .. i try with the gui , with the arduino ide console , with some python code , i try with 8mhz , 16mhz 328p with a usb ftdi and with a direct omap uart , i even boot in a real windows32 .. no luck .. the old serial work without a flaw , when i send back the char parsed in the code i can reach oldSerialCom, but it do not go in the header detection loop .. :'(

does anyone have the same issue ?

User avatar
Bledi
Posts: 187
Joined: Sat Sep 10, 2011 6:36 pm

Re: New Multiwii Serial Protocol

Post by Bledi »

Can you add "armed" to the datas

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

Hi,
in fact it is.
It's in the MSP-STATUS message:
serialize16(accMode<<BOXACC|baroMode<<BOXBARO|magMode<<BOXMAG|armed<<BOXARM|
GPSModeHome<<BOXGPSHOME|GPSModeHold<<BOXGPSHOLD|headFreeMode<<BOXHEADFREE);
The ARM status will be activated even if you don't have any ARM box checked.

User avatar
Bledi
Posts: 187
Joined: Sat Sep 10, 2011 6:36 pm

Re: New Multiwii Serial Protocol

Post by Bledi »

Thanks :) I miss that

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

any update on the non-functioning 'Calib ACC' and 'Reset' buttons in GUI?
For whatever reason pressing any of these does not have any effect. Cannot currently test the 'Calib MAG' button. Triggering the ACC calibration via TX sticks combo still works, so that code in MWii on the arduino side is still working as expected. Just never gets triggered from GUI via Serial Protocol.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: New Multiwii Serial Protocol

Post by Alexinparis »

Everything is working fine on my side.
But I don't use extra features like telemetry, it's maybe the problem.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: New Multiwii Serial Protocol

Post by Tommie »

Any idea why the debug values are not working? I'm currently tinkering with a new I²C sonar and it'd be nice to see which values are generated by it.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: New Multiwii Serial Protocol

Post by kos »

when running at 8mhz the new serial protocol only seems to work at 57600bds :roll:

when running @112500 it never get after stateMSP==1 ..

Code: Select all

switch(c) {                                // header detection $MW<
          case '$':
            if (stateMSP == 0) stateMSP++; break;  // first octet ok, no need to go further
          case 'M':
            if (stateMSP == 1) stateMSP++; break;  // second octet ok, no need to go further
          case '<':
// we never get here ..
            if (stateMSP == 2) stateMSP++; break;  // third octet ok, no need to go further
        }
Attachments
mwi-newSerial.png

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

The status display for the checkboxitems via highlighting the label to the left does not work for passThrough and Beeper. The data are not sent on the MWC side?

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: New Multiwii Serial Protocol

Post by kos »

kos wrote:when running at 8mhz the new serial protocol only seems to work at 57600bds :roll:


ok , this is caused by either the serial interupt library not handling long serial burst correctly or having the serialCom not fast enough .

solved by changing multiwiiconf to write char one by one

the new serial work on 328p 8Mhz 115200 with this modification

edit : not a good solution

Code: Select all

serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_IDENT);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_STATUS);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RAW_IMU);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_SERVO);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_MOTOR);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RC);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RAW_GPS);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_COMP_GPS);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_ALTITUDE);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_BAT);
 serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_DEBUG);
for(i=0;i<indTX;i++) {g_serial.write(char(outBuf_[i]));}


based on my experiment , this bug can lead to this beahaviour -> viewtopic.php?f=16&t=1666

one should monitor how many MSP_PACKET are never answerd

edit : still not happy with the way it work at 8mhz
Last edited by kos on Sat May 12, 2012 3:22 am, edited 1 time in total.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

I am trying to figure out when and how this following subroutine is called and used. Any ideas? Seems to be useful but I see no evidence it is presently being used.

Thank you.

Code: Select all

void SerialWrite(uint8_t port,uint8_t c){
 switch (port) {
    case 0: serialize8(c);UartSendData(); break;                 // Serial0 TX is driven via a buffer and a background intterupt
    #if defined(MEGA) || defined(PROMICRO)
    case 1: while (!(UCSR1A & (1 << UDRE1))) ; UDR1 = c; break;  // Serial1 Serial2 and Serial3 TX are not driven via interrupts
    #endif
    #if defined(MEGA)
    case 2: while (!(UCSR2A & (1 << UDRE2))) ; UDR2 = c; break;
    case 3: while (!(UCSR3A & (1 << UDRE3))) ; UDR3 = c; break;
    #endif
  }

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: New Multiwii Serial Protocol

Post by kos »

in LCD .. deprecated spoted

#elif defined(LCD_TEXTSTAR) || defined(LCD_VT100)
SerialWrite(0, i );

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Thank you, I looked every where but the LCD file.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: New Multiwii Serial Protocol

Post by msev »

Sorry for the slight off-topic question, but on a MEGA board which has I think 3 serial ports, is it possible for using multiple at once,..

For example one for connecting an osd to the board, another for connecting and using a bluetooth board and the third for connecting the GPS for rth and position hold (gps would be shared between osd and multiwii).

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: New Multiwii Serial Protocol

Post by Hamburger »

kos wrote:in LCD .. deprecated spoted

#elif defined(LCD_TEXTSTAR) || defined(LCD_VT100)
SerialWrite(0, i );


what makes you call that deprecated? Is it not the standard way to output serial data anymore? By which strategy/implementation is it superseeded now?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

I am looking at ways of sending the telemetry data to a different serial port on the mega

Serial0 - normal USB
Serial1 - PPM
Serial2 - GPS
Serial3 - ODS/Telemetry

Any help is greatly appreciated.

Thank you.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Seems to me, I should be able to test for which port the require for data is coming from, then send the reply for that port.

Code: Select all

 while (SerialAvailable(0)) { <- Change to  (SerialAvailable(port)
    c = SerialRead(0); <- Change to SerialRead(port)
.
.
.
tailSerialReply(); <- Change to tailSerialReply(port)
.
.
.


Correct?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

I made all of the required changes in the serial handler and it is working great. What I need now is a smart way to automatically switch the port number based upon which port requires servicing.

Code: Select all

void serialCom() {
  uint8_t i, c, port = 0; <- Need a smart way to change this number.
  static uint8_t offset,dataSize;
 
  while (SerialAvailable(port)) {
    c = SerialRead(port);


I need to be able to switch between port 0 and port 3, at present, I can manually change these numbers, compile and load the code.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: New Multiwii Serial Protocol

Post by PatrikE »

Code: Select all

if(rcData[AUX4]< 1500){port=0;}else{port=1;}

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Interesting, thank you.

However, I was thinking more along the likes of checking a flag or an Interrupt.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Question, using this example "UCSR0B |= (1<<UDRIE0);", how would I send data to Serial Port 3?

Thank you.

Edited: I got it now. :D

I need to add something similar to this to handle the port.

This is for Serial0, so I need to duplicate it for Serial3

Code: Select all

ISR_UART {
    if (headTX != tailTX) UDR0 = bufTX[tailTX++];  // Transmit next byte in the ring
    if (tailTX == headTX) UCSR0B &= ~(1<<UDRIE0); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
  }


Code: Select all

#if !defined(PROMICRO)
  ISR_UART {
    if (headTX != tailTX) UDR0 = bufTX[tailTX++];  // Transmit next byte in the ring
    if (tailTX == headTX) UCSR0B &= ~(1<<UDRIE0); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
  }
#if defined(MEGA)
  ISR_UART3 {
    if (headTX != tailTX) UDR3 = bufTX[tailTX++];  // Transmit next byte in the ring
    if (tailTX == headTX) UCSR3B &= ~(1<<UDRIE3); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
  }
#endif

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

Here is a copy of the draft Serial.ino, bench testing on Serial0 and Serial3. In theory, it can be configured to work on all of the four serials but there is only coded for Serial0 and Serial3.

Config.h File:

Code: Select all

// Serial Telemery Information Sent to another serial port (Mega)
#define TELEMERY_SERIAL 3
#define TELEMERY_BAUD 115200


Main File under Setup:

Code: Select all

#if defined(TELEMERY_SERIAL)
   SerialOpen(TELEMERY_SERIAL,TELEMERY_BAUD);
  #endif


And the attached Serial.ino file.
Attachments
MegaSerial.zip
Telemetry on Serial3
(4.69 KiB) Downloaded 582 times

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: New Multiwii Serial Protocol

Post by msev »

So this mod enables telemetry on serial 3 right? Are you going to send that data to yourself with bluetooth or what are you going to use it for?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: New Multiwii Serial Protocol

Post by copterrichie »

msev wrote:So this mod enables telemetry on serial 3 right? Are you going to send that data to yourself with bluetooth or what are you going to use it for?


No, it is going to the onboard Arduino nano for ODS and for Antenna tracking.

viewtopic.php?f=6&t=1611

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: New Multiwii Serial Protocol

Post by Katch »

msev wrote:Sorry for the slight off-topic question, but on a MEGA board which has I think 3 serial ports, is it possible for using multiple at once,..

For example one for connecting an osd to the board, another for connecting and using a bluetooth board and the third for connecting the GPS for rth and position hold (gps would be shared between osd and multiwii).


This seems to have been overlooked. I'm also interested as I've started flying MEGAs and would like to make better use of its serial channels. Is this re-write going to enable xbee telemetry or at least the ability to pass serial communications off to a BT module on serial 2 or 3 (0 is standard and 1 is tied up with PPM SUM).

If this is not the intended functionality then I may start tinkering myself but I don't want to work something that is already being attended to.

With the now very functional and maturing GPS code I think telemetry is going to become more and more important as waypoint navigation becomes possible.

PS - very exciting time for MultiWii - my favourite and first choice for flying robots.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: New Multiwii Serial Protocol

Post by LuFa »

Hi , :)

i try to Controll the Mwii via the new Protocol .
i can read datas from multiwii without any proplems :) but i cant send anythink to Mwii .
Can anyone tell me how i have to calculate the Checksum for send datas to Mwii ?
i use a second arduino to do this , a example code will be also very nice :mrgreen:
Thanks !

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: New Multiwii Serial Protocol

Post by kos »

you can grab the code from multiwii , look at serializeN() function


$M<[payloadlenght][mspId][payload][cheksum]

payloadlenght = payload / 8
cheksum = for (char c :payload){ checksum ^= int(c); }

ex : with mspId = MSP_SET_RC_TUNING the payload lenght is 7

here is java implementation that i use in myMultiWiiConf.pde, a liitle readable than the previous checksum calculation

Code: Select all

 // MSP_SET_RC_TUNING
      payload = new ArrayList<Character>();
      payload.add(char( round(confRC_RATE.value()*100)) );
      payload.add(char( round(confRC_EXPO.value()*100)) );
      payload.add(char( round(rollPitchRate.value()*100)) );
      payload.add(char( round(yawRate.value()*100)) );
      payload.add(char( round(dynamic_THR_PID.value()*100)) );
      payload.add(char( round(throttle_MID.value()*100)) );
      payload.add(char( round(throttle_EXPO.value()*100)) );
      requestMSP(MSP_SET_RC_TUNING,payload.toArray( new Character[payload.size()]) );


Code: Select all

//send with/without payload
void requestMSP(int msp, Character[] payload) {
  if(msp < 0) {
    return;
  }
  StringBuffer bf = new StringBuffer().append(MSP_HEADER);
 
  if (payload != null){
    bf.append(char(payload.length)).append(char(msp));
    byte checksum=0;
    for (char c :payload){
      bf.append(c);
      checksum ^= int(c);
    }
    bf.append(char(int(checksum)));
  }else{
    bf.append(char(msp));
  }

nicodh
Posts: 44
Joined: Sun Apr 08, 2012 1:42 pm

Re: New Multiwii Serial Protocol

Post by nicodh »

Hello,
May I make a request for adding MSP_INFO to the protocol?

What I need, is to be able to diferentiate the type of board (8bits or 32bits) and maybe the firmware release (at least the date of compilation for example).

For example create a variable like boardtype that would be 8 or 32 depending on the type of processor.
I know that change the revision number would be a pain, so instead you could add the compilation date, which is included by the compiler at build time.

This way it would be possible to show or hide features (like the command line interpreter for 32bits version) in my android development and my all in one windows configurator.

I would really appreciate this. Thanks.

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: New Multiwii Serial Protocol

Post by EOSBandi »

HI,
I commited a small change in the serial.ino, now it is able to process single commands. Perviously to finish a command processing it needed the first byte of the next command to come in.
EOSBandi

Post Reply