Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Error in vdr output format of scan



Holger Waechtler wrote:
Florian Steinel wrote:

Klaus Schmidinger wrote:

Florian Steinel wrote:

But how avoid the use of locale eg. "S99.9E" becomes "S99,9E"?

Take a look at VDR's cSource::ToString() in VDR/sources.c.

Thank, Klaus.

So i should use this:
fprintf (f, "S%u.%u%s:", orbital_pos/10, orbital_pos % 10, west_east_flag_name[we_flag]); // can't simply use "%g" here since the silly 'locale' messes up the decimal point (from vdr/sources.c)

ok, preparing patch.
(is "& ~0x0800" some special mask for vdr or should i use that one too?)

I suppose this expression is wiping out the sign bit and makes the number always a positive one: (1 << 12)/10 == 409, the next power of 2 above 360 degree.
after a short look in Klaus' source I think I should be a little more exact:

The angle (Code) is specific to VDR's encoding as 12bit signed fixed point number:

(Code & 0x3ff) / 10 == angle, integer part
(Code & 0x3ff) % 10 == angle, fractional part
Code & 0x800 == sign of angle, if this bit is set then use 'E'

Since orbital_pos in scan is always positive and the sign is encoded in we_flag you can safely use the construct you mentioned:

printf("%u.%u%s", orbital_pos / 10, orbital_pos % 10,
west_east_flag_name[we_flag]);

Holger



--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index