ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

emit board name in separate statustext from serial number

Open peterbarker opened this issue 3 years ago • 2 comments

Before: Screenshot from 2022-09-20 13-19-46

After:

Screenshot from 2022-09-20 13-21-34

I tested SkyViper's remote here and it all seemed to work.

peterbarker avatar Sep 20 '22 03:09 peterbarker

And on NavIO2:

AP: ArduCopter V4.3.0-dev (695438be)
AP: NavIO2
AP: 5e3a8d5cbaff427898fd4b9ec446e38e
AP: IMU0: fast sampling enabled 8.0kHz/1.0kHz

peterbarker avatar Sep 20 '22 04:09 peterbarker

I don't see anything wrong with this approach so long as we are willing to spend yet another few bytes of flash on the additional method and calls.

Maybe prefix the board ID string with "ID: "?

yuri-rage avatar Sep 21 '22 14:09 yuri-rage

This PR would break MissionPlanner functionality.

MissionPlanner parses out the board name by assuming it is followed by these three hex strings. What could possibly go wrong there?

https://github.com/ardupilot/MissionPlanner/blob/master/ExtLibs/ArduPilot/Mavlink/MAVLinkInterface.cs#L1725

                    else if (logdata.ToLower().Contains("px4v2") ||
                             Regex.IsMatch(logdata, @"\s[0-9A-F]+\s[0-9A-F]+\s[0-9A-F]+"))
                    {
                        MAVlist[sysid, compid].SerialString = logdata;
                    }

SerialString is actually used a fair bit - special code for scanning for CubeBlack and CubeBlack+.

So basically we're going to be stuck with emitting this crap.

peterbarker avatar Sep 23 '22 01:09 peterbarker

I don't see anything wrong with this approach so long as we are willing to spend yet another few bytes of flash on the additional method and calls.

Size is an absolute wash ATM:

Binary Name      Text [B]     Data [B]     BSS (B)      Total Flash Change [B] (%)      Flash Free After PR (B)
---------------  -----------  -----------  -----------  ----------------------------  -------------------------
blimp            0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                      303520
ardusub          0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                      161720
ardurover        0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                      125788
antennatracker   0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                      322988
arduplane        0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                        5948
arducopter-heli  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                       31156
arducopter       0 (0.0000%)  0 (0.0000%)  0 (0.0000%)  0 (0.0000%)                                       40468

Maybe prefix the board ID string with "ID: "?

I was considering Board: - but given MissionPlanner parsing the statustexts we can't do this ATM....

peterbarker avatar Sep 23 '22 01:09 peterbarker

I don't see anything wrong with this approach so long as we are willing to spend yet another few bytes of flash on the additional method and calls. Maybe prefix the board ID string with "ID: "?

I was considering Board: - but given MissionPlanner parsing the statustexts we can't do this ATM....

How about leave the old format + add the two new lines. Then it won't break MP If the new lines are prefixed with "Board:" and "Serial:" (for example) then MP can be changed to read the new Serial: line. Old versions of MP will still be able to read the old line. Then eventually the old line can be dropped.

timtuxworth avatar Sep 23 '22 03:09 timtuxworth

I don't see anything wrong with this approach so long as we are willing to spend yet another few bytes of flash on the additional method and calls. Maybe prefix the board ID string with "ID: "?

I was considering Board: - but given MissionPlanner parsing the statustexts we can't do this ATM....

How about leave the old format + add the two new lines. Then it won't break MP If the new lines are prefixed with "Board:" and "Serial:" (for example) then MP can be changed to read the new Serial: line. Old versions of MP will still be able to read the old line. Then eventually the old line can be dropped.

There are a few problems. The main one is that we only have a limited amount of buffer space for storing and sening these statustexts, and we are right on that limit for Copter ATM.

The other problem is that would only really encourage people to continue to parse these statustext messages. The same information is availble elsewhere in a machine-readable format.

Additionally, my intent is to reduce the crap we send via statustext, not increase it or provide it in a different form...

peterbarker avatar Sep 23 '22 05:09 peterbarker

I don't see anything wrong with this approach so long as we are willing to spend yet another few bytes of flash on the additional method and calls. Maybe prefix the board ID string with "ID: "?

I was considering Board: - but given MissionPlanner parsing the statustexts we can't do this ATM....

How about leave the old format + add the two new lines. Then it won't break MP If the new lines are prefixed with "Board:" and "Serial:" (for example) then MP can be changed to read the new Serial: line. Old versions of MP will still be able to read the old line. Then eventually the old line can be dropped.

There are a few problems. The main one is that we only have a limited amount of buffer space for storing and sening these statustexts, and we are right on that limit for Copter ATM.

The other problem is that would only really encourage people to continue to parse these statustext messages. The same information is availble elsewhere in a machine-readable format.

Additionally, my intent is to reduce the crap we send via statustext, not increase it or provide it in a different form...

So are we back to just increasing the board name to 23 characters then? This problem still needs to be solved.

timtuxworth avatar Sep 23 '22 14:09 timtuxworth

So are we back to just increasing the board name to 23 characters then? This problem still needs to be solved.

Yes - we've merged that other PR. Without patches against MP this PR here is a no-go.

peterbarker avatar Sep 27 '22 01:09 peterbarker

Closing this as I don't feel like fighting with MissionPlanner :-)

peterbarker avatar Oct 28 '22 05:10 peterbarker