SENSOR_ID and using two or more oXs on SPort

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Sun Oct 18, 2015 8:11 pm

@mstrens
In file oXs_config_description.h you explain line65 "Valid values are 0x1B, 0xBA, ... (there are 28 values)"

I use two oXs and both connected to serial SPort-pin. First oXs(Variometer and CellVoltages) has SENSOR_ID 0x1B and works very well :-)
Second oXs(Current measurement) has SENSOR_ID 0xBA , for which I use "Curr" and "Fuel" on Taranis, but values are always "0". What is wrong ? What is to do on Taranis ?

What are all possible 28 values for SENSOR_ID ?

mstrens
Posts: 1206
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by mstrens » Sun Oct 18, 2015 8:24 pm

I have no experience having several oXs connected on same Rx but normally it should work (only with SPORT receiver).

Did you already try to connect only oXs with current sensor (with ID àxBA)?
If it works, it means that there are conflict when using several oXs on same Rx.
If it does not works, did you try to connect only oxs with current sensor and changing his ID to 0x1B. This should for sure work (except if there is some issue with oXs , perhaps in the config).

Which software version do you run on Tx
Which software version do you run on oXs (latest version is 5.0 and is available on github)
Which version of arduino IDE do you use to compile and upload.
Please put your config.h file in attachmeent of your reply

mstrens
Posts: 1206
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by mstrens » Sun Oct 18, 2015 8:42 pm

I would have to look in order to find all 28 values.
Here already some of them (hoping it helps)
* Here the default sensor_IDs used by FrSky for their own sensors (Physical IDs + CRC), so it's better not to use those ones.
* #define DATA_ID_VARIO 0x00 0
* #define DATA_ID_FLVSS 0xA1 1
* #define DATA_ID_FAS 0x22 2
* #define DATA_ID_GPS 0x83 3
* #define DATA_ID_RPM 0xE4 4
* #define DATA_ID_SP2UH 0x45 5
* #define DATA_ID_SP2UR 0xC6 6

User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Thu Oct 22, 2015 12:08 pm

Tempo wrote:@mstrens
In file oXs_config_description.h you explain line65 "Valid values are 0x1B, 0xBA, ... (there are 28 values)"

I use two oXs and both connected to serial SPort-pin. First oXs(Variometer and CellVoltages) has SENSOR_ID 0x1B and works very well :-)
Second oXs(Current measurement) has SENSOR_ID 0xBA , for which I use "Curr" and "Fuel" on Taranis, but values are always "0". What is wrong ? What is to do on Taranis ?

What are all possible 28 values for SENSOR_ID ?
Hi mstrens,

my two oXs-sensors work well togehter. :D One with SENSOR_ID 0x1B and another with SENSOR_ID 0xBA are connected with SmartPort in serial mode.
There was nothing "wrong". A discrepancy with current parameters in my oXs_config.h causes display of "always value 0". ;)
Thank you very much for your well commented software-extension of openXvario to openXsensor. It makes great fun to use openXsensor !

In some cases it is better to use more than one oXs, e.g. with different voltage-reference for ADC on Atmega328. In other cases you need large geometrical distances from different sensors.
What are "all possible 28 values for SENSOR_ID" ?

User avatar
MikeB
9x Developer
Posts: 15805
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: SENSOR_ID and using two or more oXs on SPort

Post by MikeB » Thu Oct 22, 2015 12:16 pm

The 28 SENSOR_ID values are 0x00 to 0x1B, but the top 3 bits are used as a sort of checksum of the bottom 5 bits, so you can't use thes values directly. Your 0xBA value is 0x1A with some extra bits set.

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!


User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Thu Oct 22, 2015 12:47 pm

Thank´s Mike for information. ;)

* #define DATA_ID_VARIO 0x00 bin 000 0_0000 for sensor number 1
* #define DATA_ID_FLVSS 0xA1 bin 101 0_0001 for sensor number 2
* #define DATA_ID_FAS 0x22 bin 001 0_0010 for sensor number 3
* #define DATA_ID_GPS 0x83 bin 100 0_0011 for sensor number 4
* #define DATA_ID_RPM 0xE4 bin 010 0_0100 for sensor number 5
* #define DATA_ID_SP2UH 0x45 bin 010 0_0101 for sensor number 6
* #define DATA_ID_SP2UR 0xC6 bin 110 0_0110 for sensor number 7
* #define SENSOR_ID 0x? ? bin ? ? ? 0_1000 for sensor number 8 e.g. oXs

...

* #define SENSOR_ID 0x? ? bin ? ? ? 1_1001 for sensor number 25 e.g. third oXs
* #define SENSOR_ID 0xBA bin 101 1_1010 for sensor number 26 e.g. second oXs
* #define SENSOR_ID 0x1B bin 000 1_1011 for sensor number 27 e.g. first oXs


Scheme above shows how sensor-ID is pieced together.
Last 5 bits enumerate all 28 sensors from 0 to 27.
But how to set initial 3bits ? Could you combine them in free way ?
Last edited by Tempo on Thu Oct 22, 2015 1:25 pm, edited 2 times in total.

User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Thu Oct 22, 2015 1:14 pm

@mstrens
What about SENSOR_ID substitude with DATA_ID_OXS1 in future oXs-software ?
And it´s perhaps helpful to add rules for valid SENSOR_ID in your very good oXs_config_description.h ?
Last edited by Tempo on Thu Oct 22, 2015 2:02 pm, edited 1 time in total.

User avatar
MikeB
9x Developer
Posts: 15805
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: SENSOR_ID and using two or more oXs on SPort

Post by MikeB » Thu Oct 22, 2015 1:48 pm

Bit5=Bit0^Bit1^Bit2
Bit6=Bit2^Bit3^Bit4
Bit7=Bit0^Bit2^Bit4

(^ is XOR)

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Thu Oct 22, 2015 1:58 pm

Thank you Mike for rules how to piece together Bit5, Bit6 and Bit7.

User avatar
MikeB
9x Developer
Posts: 15805
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: SENSOR_ID and using two or more oXs on SPort

Post by MikeB » Thu Oct 22, 2015 2:03 pm

From one of my source files:

0x00, 0xA1, 0x22, 0x83, 0xE4, 0x45,
0xC6, 0x67, 0x48, 0xE9, 0x6A, 0xCB,
0xAC, 0x0D, 0x8E, 0x2F, 0xD0, 0x71,
0xF2, 0x53, 0x34, 0x95, 0x16, 0xB7,
0x98, 0x39, 0xBA, 0x1B

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
Tempo
Posts: 70
Joined: Tue Feb 04, 2014 4:04 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by Tempo » Thu Oct 22, 2015 2:07 pm

Thank you ! This is complete answer to "SENSOR_ID and using two or more oXs on SPort" . :D

mstrens
Posts: 1206
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by mstrens » Thu Oct 22, 2015 4:13 pm

Tempo wrote:@mstrens
What about SENSOR_ID substitude with DATA_ID_OXS1 in future oXs-software ?
And it´s perhaps helpful to add rules for valid SENSOR_ID in your very good oXs_config_description.h ?
I will add the 28 values in next version.

User avatar
Kilrah
Posts: 9666
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: SENSOR_ID and using two or more oXs on SPort

Post by Kilrah » Thu Oct 22, 2015 6:12 pm

The best would be to have the #define be the "logical" ID itself (1-28) and have the software calculate the actual ID byte on startup (ID-1, and the 3 MSBs as described by Mike).
That way there's commonality between IDs described in FrSky manuals, the ID you might set on an FrSky sensor with the channel changer, what's displayed on the radio and what you set in oxs.

mstrens
Posts: 1206
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: SENSOR_ID and using two or more oXs on SPort

Post by mstrens » Fri Oct 23, 2015 9:13 am

Ok, I wil change in oXs to allow a value from 1 to 28 and I will calculate the actual ID byte (substracting 1 and filling the 2MSBs)

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”