Page 1 of 2

NXC SetSensorHTEOPD issue

Posted: 26 Dec 2012, 16:47
by HaWe
hey,
I get compile error for SetSensorHTEOPD:

SetSensorHTEOPD(2) => error: "," expected
SetSensorHTEOPD(2, bStandard) => error: undefined identifier bStandard

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 06:44
by mightor
Did you declare bStandard or is it some kind of unknown variable? Should probably be set to true or false or whatever NXC uses for boolean symbols. It has to do with the short and long range setting for the EOPD.

= Xander

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 10:49
by HaWe
bStandard is a parameter which is named and chosen in the integrated help and it appeared to me if it was sort of a predefined system variable - what it actually isn't.
I already supposed that it was meant for long or short range but there is no information about what this value is likeor of what amount, concerning also the alternative value.
Unfortunately the explanation and the programming example are not correct in either way.

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 12:09
by mightor
The b in bStandard indicates a boolean, so it can only be one of two values. s means string, i means int, l means long, d means double, f means float, c is char, etc :)

= Xander

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 13:37
by HaWe
aah, alright, so bStandard is supposed to be "true" for "short range"...
(maybe the NXC documentation team finds sometimes time to update this help file issue...^^)

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 15:07
by mightor
A more intuitive name would maybe be bShortRange :)

= Xander

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 18:26
by HaWe
bShortRangeTrue
^^

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 20:31
by mightor
No, putting an actual value in your name is bad practice; bShortRangeTrue = false ? That just look awful.

= Xander

Re: NXC SetSensorHTEOPD issue

Posted: 27 Dec 2012, 21:27
by HaWe
as it's a constant it might be acceptable.

Code: Select all

#define bShortRangeTrue true
#define bShortRangeFalse  false
#define bLongRangeTrue false
#define bLongRangeFalse true 
:mrgreen: :ugeek: :mrgreen:

bShortRangeTrue <=> ShortRange
bLongRangeTrue <=> LongRange

bShortRangeFalse == ! bShortRangeTrue
bLongRangeFalse == ! bLongRangeTrue
bShortRangeTrue == true == bLongRangeFalse
bShortRangeTrue == ! bShortRangeFalse == ! (! bLongRangeFalse) == bLongRangeFalse :P

:mrgreen: :ugeek: :mrgreen:

anyway, anything is better than an undocumented bStandard :D

Re: NXC SetSensorHTEOPD issue

Posted: 29 Dec 2012, 17:07
by afanofosc
HiTechnic refers to "standard range" and "long range" modes of operation. There is no such thing as a "short range" mode. The only defect here is that the sample program was not updated when the ability to set the mode was added as a required parameter to the API function that configures the sensor.

As with any third party device you should consult the documentation provided by the manufacture for information about how it operates.

John Hansen