DSM Telemetry support

More
15 Apr 2015 15:13 - 15 Apr 2015 15:14 #31206 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
Nothing changed with GPS data, except speed is as km/h. Time run as mad, I think instead seconds it use 1/100 sec, whole time has not sense, e.g. 31:04:42. Altitude 88760.500m, speed 129.639km/h and so on.
Last edit: 15 Apr 2015 15:14 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
15 Apr 2015 16:58 #31207 by Indigo
Replied by Indigo on topic DSM Telemetry support
Possible error in my byte swap function,

Should have been this:
static void swap_LSB_MSB(u16 *ptr)
{
    for(int i = 1; i <= 7; i++) {
        ptr[i] = ((ptr[i] >> 8) & 0xff) | (ptr[i] << 8);
    }
}

I have recompiled and uploaded to Test Builds.

Please Log in or Create an account to join the conversation.

More
16 Apr 2015 02:29 #31228 by wing927
Replied by wing927 on topic DSM Telemetry support
Hello All,
I am new to this forum and to Deviation, My question is, will my Devo-10 work with DSM Telemetry. I wanted to get a TM-1000 module and use it with a AR10000 10Ch Rx. I had hopes that I could use the STiā„¢ app with the TR-1000 Made for my, iPhone. This would be a home run for me but, I do not want to spend the $ if the system will not support it. So if anybody knows the answer please give me a hand thanks. By the way this is a great thing, I love my Devo 10 but until I found out about the Deviation upgrade I thought that the system was outdated, Again thanks.

Please Log in or Create an account to join the conversation.

More
17 Apr 2015 01:11 #31270 by mwm
Replied by mwm on topic DSM Telemetry support
I have tried both my own builds of the dsm-telemetry branch on the team repository, and a download of your test build, even though both are 84cc0db.

I don't get a reliable telemetry connection with a LemonRX Rx. I can get it to bind and display data, but it won't reconnect after power cycling everything, and I have to hit bind again. Even then, it won't stay connected, but will drop the connection in a minute or two.

I was getting similar behavior from an OrangeRx Rx, but it's been installed in the Orion, so I haven't tested it on the new versions.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
17 Apr 2015 11:19 #31288 by Indigo
Replied by Indigo on topic DSM Telemetry support

vlad_vy wrote: Nothing changed with GPS data, except speed is as km/h. Time run as mad, I think instead seconds it use 1/100 sec, whole time has not sense, e.g. 31:04:42. Altitude 88760.500m, speed 129.639km/h and so on.


I updated (about 40 hours ago) 84cc0db, Did you try downloading again and re-testing GPS data?

Please Log in or Create an account to join the conversation.

More
17 Apr 2015 11:25 - 17 Apr 2015 11:27 #31289 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
Yes, but nothing changed. Changed code for byte swap function look right and it should work. Do you really change code?
Last edit: 17 Apr 2015 11:27 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
18 Apr 2015 02:47 #31318 by Indigo
Replied by Indigo on topic DSM Telemetry support
Ok, problem is elsewhere.
I suspect problem is hr & min are swapped, and sec & 1/100 sec are swapped.

I have updated (just now) 84cc0db, Could you please try downloading again and re-testing GPS data?

Also, can you make sense of altitude or speed? I think altitude out by a factor of 100.

Please Log in or Create an account to join the conversation.

More
18 Apr 2015 06:26 #31321 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
I don't know what is wrong with your builds, but nothing changed at all. Do you "make distclean" before rebuild?

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 00:56 #31344 by Indigo
Replied by Indigo on topic DSM Telemetry support
I have found the problem. Some calls to function bcd_to_int() were applying a bitmask to the returned value instead of the parameter value. eg. calls to bcd_to_int() from within function pkt32_to_coord() used to decode Latitude and Longitude.

I have uploaded a new version 9834633 to Test Builds.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 08:11 - 19 Apr 2015 10:34 #31348 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
Code corrections:
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(ptr[1] >> 8) * 3600000
         + bcd_to_int(ptr[1] & 0x00ff) * 60000
         + bcd_to_int(ptr[0]) * 6;
}
    if ((data_type >= 0x15 && data_type <= 0x18) || (data_type == 0x34)) {
        swap_LSB_MSB(pktTelem);
    }
            Telemetry.gps.satcount = bcd_to_int(pktTelem[4] & 0x00ff);
            altitude = bcd_to_int(pktTelem[4] >> 8) * 1000000; //In 1000 meters * 1000 (8Bit decimal, 1 unit is 1000m)
Last edit: 19 Apr 2015 10:34 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 08:59 - 19 Apr 2015 10:18 #31349 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
PB, can you correct DSM2 code in main trunk?

        case 0x16: //GPS sensor (always second GPS packet)
            update = update16;
            Telemetry.gps.altitude = altitude + (bcd_to_u8(packet[3]) * 100 
                                               + bcd_to_u8(packet[2])) * 100; //In meters * 1000 (16Bit decimal, 1 unit is 0.1m)
Last edit: 19 Apr 2015 10:18 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 12:21 #31350 by Indigo
Replied by Indigo on topic DSM Telemetry support

vlad_vy wrote: Code corrections:
...


Thanks, new version ab4e18d uploaded to Test Builds.

source

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 12:45 - 19 Apr 2015 13:00 #31353 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
At least the time is good. Speed also is good. Altitude a little high, but it can depend from number of sats.

But, Latitude and Longitude have zero values. Something is wrong.

With first code correction it should work. I only changed bitwise "!" to "&".
Last edit: 19 Apr 2015 13:00 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 13:40 - 19 Apr 2015 13:48 #31357 by Indigo
Replied by Indigo on topic DSM Telemetry support
Ok, I have restored code for pkt32_to_coord() so atleast the uploaded Test Build is working.
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(ptr[1] >> 8) * 3600000
         + bcd_to_int(ptr[1] & 0x00ff) * 60000
         + bcd_to_int(ptr[0]) * 6;
}

Could you please test these alternatives which reduce code size:
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(ptr[1] >> 8) * 3600000
         + bcd_to_int(((u32)(ptr[1] & 0x00ff) << 16) | ptr[0]) * 6;
}
OR
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(((u32)ptr[1] << 16) | ptr[0]) * 6
         - bcd_to_int(ptr[1] & 0xff00) * 24000;
}
Last edit: 19 Apr 2015 13:48 by Indigo.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 13:51 #31358 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
By sorry it doesn't help, Latitude and Longitude have zero values.

I can test any you want, if I will have your source code. Where I can download your code?

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 13:59 - 19 Apr 2015 14:40 #31359 by Indigo
Replied by Indigo on topic DSM Telemetry support
The source I had would probably work with (ptr[1] << 16) changed to ((u32)ptr[1] << 16)

hg pull -r dsm-telemetry https://bitbucket.org/Indigo1/deviationtx [<destinationPath>]
or
bitbucket.org/Indigo1/deviationtx/src
Last edit: 19 Apr 2015 14:40 by Indigo.

Please Log in or Create an account to join the conversation.

More
19 Apr 2015 15:35 #31363 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
First code correction surely should work. There is something else.
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(ptr[1] >> 8) * 3600000
         + bcd_to_int(ptr[1] & 0x00ff) * 60000
         + bcd_to_int(ptr[0]) * 6;
}

But, it seems I've found next bug, control bits are in 16 byte:
            Telemetry.gps.latitude  =  pkt32_to_coord(&pktTelem[2]) * (pktTelem[7] & 0x0100)? 1: -1; //1=N(+), 0=S(-)
            Telemetry.gps.longitude = (pkt32_to_coord(&pktTelem[4]) + (pktTelem[7] & 0x0400)? 360000000: 0) //1=+100 degrees
                                                                  * (pktTelem[7] & 0x0200)? 1: -1; //1=E(+), 0=W(-)

I'm not sure it will help. It can't change latitude value, sign only.

Please Log in or Create an account to join the conversation.

More
20 Apr 2015 05:48 #31399 by Indigo
Replied by Indigo on topic DSM Telemetry support
Thanks, I've updated the test build with those changes.

Latitude value too small? Try adding another zero to 3600000.
Would the latitude value be correct if you divide value by 36 and multiply by 60?

Please Log in or Create an account to join the conversation.

More
20 Apr 2015 06:03 #31400 by vlad_vy
Replied by vlad_vy on topic DSM Telemetry support
No, both Latitude and Longitude values are zero. Sometimes I can see "1" at least significant digit.

Please Log in or Create an account to join the conversation.

More
20 Apr 2015 09:08 #31406 by Indigo
Replied by Indigo on topic DSM Telemetry support

vlad_vy wrote: First code correction surely should work. There is something else.
...


Yes, I think it should be this (byte order ptr[0], ptr[1] swapped):
static u32 pkt32_to_coord(u16 *ptr)
{
    // (decimal, format DD MM.MMMM)
    return bcd_to_int(ptr[0] >> 8) * 3600000
         + bcd_to_int(ptr[0] & 0x00ff) * 60000
         + bcd_to_int(ptr[1]) * 6;
}

I have made this change and replaced the test build with new version.

Please Log in or Create an account to join the conversation.

Time to create page: 0.119 seconds
Powered by Kunena Forum