Resolved: BOXNAMES in GUI not working?

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
Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Resolved: BOXNAMES in GUI not working?

Post by Danal »

I do not get checkboxes in the GUI. This seems to work for other people, at least Alex said it works for him.

When this happens, a message appears at push of "Start" button similar to:

Code: Select all

invalid checksum for command 116: 32 expected, got 0
<116 99> {656767596665827959776571596765778384656686697659123677627111906500050065367762301124030234030238545016157110020845142080701010040000001263677622811300000000001000000000} [0]
ACC;BARO;MAG;CAMSTABVEL; $M>oZA


Environment:

  • Arduino 1.0.1
  • Processing 1.5.1
  • Fresh download of Multiwii 2.1 zip file and/or fresh pull of tip of shared (both fail)
  • Fails on Genuine Arduino Mega 2560
  • Fails on Sparkfun Arduino Pro Mini

Increasing serial.ino "#define TX_BUFFER_SIZE 128" to 256 fixes this. Obviously, not a suitable fix (because of RAM constraints).

Changing the lines

Code: Select all

    uint8_t bytesTXBuff = ((uint8_t)(headTX-tailTX))%TX_BUFFER_SIZE; // indicates the number of occupied bytes in TX buffer
    if (bytesTXBuff > TX_BUFFER_SIZE - 40 ) return; // ensure there is enough free TX buffer to go further (40 bytes margin)
to check for 50 bytes remaining also fixes this.


Why does this fail for me and not others?

Is it OK to change the free space to 50? This seems to fix it and doesn't break anything else.

Danal
Last edited by Danal on Thu Aug 02, 2012 10:27 pm, edited 1 time in total.

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

Re: BOXNAMES in GUI not working?

Post by Tommie »

This happens if the UI requests data faster than the copter can transmit the answers back. Increasing the TX buffer should work, and so should increasing the threshold in the other code block you mentioned. Increasing the required free space makes sure that the transmit buffer has drained enough before putting new data in.

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: BOXNAMES in GUI not working?

Post by Danal »

Oh, and just because I'm the Spektrum guy, and that could certainly affect serial... the test cases above are with a clean copy of 2.1 (or tip of shared) and config.h has only #define quadx and the proper sensor board uncommented. No other options or features, and specifically NOT spektrum.

Still fails.

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: BOXNAMES in GUI not working?

Post by Danal »

Tommie wrote:This happens if the UI requests data faster than the copter can transmit the answers back. Increasing the TX buffer should work, and so should increasing the threshold in the other code block you mentioned. Increasing the required free space makes sure that the transmit buffer has drained enough before putting new data in.


Yeah, makes perfect sense... I'm just a little stumped as to why it works for others and not for me. Baud rate is the same... clock speed is the same... ???

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

Re: BOXNAMES in GUI not working?

Post by Tommie »

It might also depend on your hardware (Bluetooth, USB2serial, operating system etc.); I actually planned to limit UI transmissions so that only one request is "up in the air" at any given time, so that the next request is only issued once the former one has been answered, but somehow that got overturned. In the error message you can actually see how the transmission of the BOXNAMES (the longest possible reply) is partially overwritten by another request.

chris ables
Posts: 317
Joined: Wed Feb 08, 2012 8:42 pm
Location: United states

Re: BOXNAMES in GUI not working?

Post by chris ables »

Gimbal wrote:
Hi, Arduino 1.0.1will not work with Multiwii (if you don't no allredy) must use 1.0 or erlier. I wold try to reload the bootloader with fresh fuses

Well, this is not true... MultiWii 2.1 works just fine with arduino 1.0.1.
There must be a jumper on your usbasp prgrammer for slow programming. Change it and try flashing..... ( i seen this in another post but i dont know about this jumper ! Seems you have to use it if using arduino 1.0.1 ! I use arduino 1.0 and everything turns out fine when finished ! Just thought i'd share this info ! :D

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

Re: BOXNAMES in GUI not working?

Post by Alexinparis »

Danal wrote:Changing the lines

Code: Select all

    uint8_t bytesTXBuff = ((uint8_t)(headTX-tailTX))%TX_BUFFER_SIZE; // indicates the number of occupied bytes in TX buffer
    if (bytesTXBuff > TX_BUFFER_SIZE - 40 ) return; // ensure there is enough free TX buffer to go further (40 bytes margin)
to check for 50 bytes remaining also fixes this.


Hi,
I think it's the only thing to do.

40 was chosen empirically to cover the longest frame. But it's not the case.
In fact, the longest frame is the BOXNAME which length is something like 101 bytes.
This should be the theoric margin.
Due to the frequency of serialCom() call regarding the GUI requestcall, I think it's maybe possible to go further only if the buffer is empty (I will check this tonight)

It's also possible to delay BOXNAME call in the GUI because it should be called only once.

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: BOXNAMES in GUI not working?

Post by Danal »

Yeah, I counted bytes and BOXNAMES are 97 bytes, plus a 5 byte header.

50 seems to work, and if everybody is OK, we can just go with that.

User avatar
treym
Posts: 258
Joined: Sat Jul 21, 2012 12:28 am

Re: BOXNAMES in GUI not working?

Post by treym »

It's also possible to delay BOXNAME call in the GUI because it should be called only once.

+1
the gui must be fixed

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: BOXNAMES in GUI not working?

Post by captaingeek »

ive had trouble with the GUI too.

on my one system with ATI graphics, it will crash after about 1 - 20 seconds.

my laptop it runs fun.

the current gui will allow you to save configuration right? maybe you can save the config, then edit it txt editor to enable to settings?

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: BOXNAMES in GUI not working?

Post by Danal »

Danal wrote:Yeah, I counted bytes and BOXNAMES are 97 bytes, plus a 5 byte header.

50 seems to work, and if everybody is OK, we can just go with that.


50 uploaded to shared at R1035

Post Reply