Re: [concordance-devel] [PATCH] congruity : error in Pronto code conversion

2009-05-07 Thread Stephen Warren
Andreas Schulz wrote:
> Stephen,
> 
> After some time, I now had reason to check the Pronto code
> conversion of congruity, just to discover an error in the code:

Thanks for the patch. I guess I missed that bit when I was reading the
spec! I've checked in the fix to congruity SVN.

> You just copy the burst/space times entered as Pronto hex code
> to the IR signal that is passed to libconcord.
> 
> However, in Pronto codes burst/space times are given in units of
> the IR carrier cycle (which is provided by the second hex word,
> in units of Pronto clock cycles), whereas libconcord expects 
> burst/space times in microseconds.
> 
> So, what is missing is to multiply the Pronto duration values
> by the IR carrier cycle (in microseconds).
> 
> See attached patch for the correction, where I also introduced
> the value PRONTO_CLOCK=4145146 (Hz) to replace the 'magic'
> value of (100 / .241246).
> 
> Andreas

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel


[concordance-devel] [PATCH] congruity : error in Pronto code conversion

2009-05-07 Thread Andreas Schulz
Stephen,

After some time, I now had reason to check the Pronto code
conversion of congruity, just to discover an error in the code:

You just copy the burst/space times entered as Pronto hex code
to the IR signal that is passed to libconcord.

However, in Pronto codes burst/space times are given in units of
the IR carrier cycle (which is provided by the second hex word,
in units of Pronto clock cycles), whereas libconcord expects 
burst/space times in microseconds.

So, what is missing is to multiply the Pronto duration values
by the IR carrier cycle (in microseconds).

See attached patch for the correction, where I also introduced
the value PRONTO_CLOCK=4145146 (Hz) to replace the 'magic'
value of (100 / .241246).

Andreas

diff -rpc -C1 congruity-10/congruity congruity-10+/congruity
*** congruity-10/congruity	2009-03-10 02:16:46.0 +0100
--- congruity-10+/congruity	2009-05-08 00:07:36.0 +0200
*** class LearnIrEnterProntoHexPanel(WizardP
*** 1341,1346 
--- 1341,1347 
  
  def _OnValidate(self, event):
  try:
+ 	PRONTO_CLOCK = 4145146
  bin = []
  str = ""
  str_idx = 0
*** class LearnIrEnterProntoHexPanel(WizardP
*** 1364,1370 
  if bin[0] != 0:
  raise Exception('Not RAW')
  
! frequency = int(100 / (bin[1] * 0.241246))
  
  count_1 = 2 * bin[2]
  count_2 = 2 * bin[3]
--- 1365,1375 
  if bin[0] != 0:
  raise Exception('Not RAW')
  
! 	# IR Carrier frequency is given as number of Pronto clock cycles:
! frequency = int(PRONTO_CLOCK / bin[1])
! 	# pulse/space durations are given in IR carrier cycles,
! 	# but we need them in microseconds:
! 	ir_cycle = int(100 / frequency)
  
  count_1 = 2 * bin[2]
  count_2 = 2 * bin[3]
*** class LearnIrEnterProntoHexPanel(WizardP
*** 1387,1398 
  idx = 0
  
  for i in range(count_1):
! self.resources.cur_ir_signal[idx] = bin[start_1 + i]
  idx += 1
  
  for j in range(repeats):
  for i in range(count_2):
! self.resources.cur_ir_signal[idx] = bin[start_2 + i]
  idx += 1
  
  self._OnStatusOk()
--- 1392,1403 
  idx = 0
  
  for i in range(count_1):
! self.resources.cur_ir_signal[idx] = bin[start_1 + i] * ir_cycle
  idx += 1
  
  for j in range(repeats):
  for i in range(count_2):
! self.resources.cur_ir_signal[idx] = bin[start_2 + i] * ir_cycle
  idx += 1
  
  self._OnStatusOk()
Nur in congruity-10+: congruity~.
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel