r4621 - developers/werner/ahrt/host/tmc/lib
werner at docs.openmoko.org
werner at docs.openmoko.org
Wed Sep 3 16:09:45 CEST 2008
Author: werner
Date: 2008-09-03 16:09:44 +0200 (Wed, 03 Sep 2008)
New Revision: 4621
Modified:
developers/werner/ahrt/host/tmc/lib/scope.py
developers/werner/ahrt/host/tmc/lib/wave.py
Log:
Some minor cleanup. The screenshots now use the full color range.
- lib/scope.py (rigol_channel_data): verified the offsets
- lib/scope.py (rigol_to_ppm): the MSB of the blue channel got chopped off
- lib/scope.py (rigol_to_ppm): made colors use the full dynamic range
- lib/wave.py (get_one): it's self.data, not self.wave.data
- lib/wave.py (__len__): it's self.data, not self.data.wave
Modified: developers/werner/ahrt/host/tmc/lib/scope.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/scope.py 2008-09-03 09:14:52 UTC (rev 4620)
+++ developers/werner/ahrt/host/tmc/lib/scope.py 2008-09-03 14:09:44 UTC (rev 4621)
@@ -213,6 +213,17 @@
# === Rigol DS1000C scope =====================================================
+#
+# Experiments confirm that the verical center is really at 125, not 127 or 128
+# as one might expect. The horizontal offsets have also been confirmed by
+# experiment.
+#
+# The correct position of the horizontal center is more difficult to determine
+# because what appears on the scope's screen as one vertical line are in fact
+# two samples. With a vertical line at hor = 0, the transition occurs between
+# offsets 512 and 513, making 512 a plausible choice.
+#
+
def rigol_channel_data(s, t0, td, v0, vd):
res = analog_wave()
i = 212
@@ -277,11 +288,21 @@
i += 1
+#
+# Encoding is rrgggbbb, so we spread this into
+#
+# rr * 0b01010101
+# ggg * 0b01001001 >> 1
+# bbb * 0b01001001 >> 1
+#
+
def rigol_to_ppm(s):
lut = []
i = 0
while i != 256:
- lut.append(chr(i & 0xc0)+chr((i & 0x38) << 2)+chr((i & 3) << 5))
+ lut.append(chr((i >> 6)*0x55)+
+ chr((((i >> 3) & 7)*0x49) >> 1)+
+ chr(((i & 7)*0x49) >> 1))
i += 1
res = "P6 320 234 255\n"
i = 0
Modified: developers/werner/ahrt/host/tmc/lib/wave.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/wave.py 2008-09-03 09:14:52 UTC (rev 4620)
+++ developers/werner/ahrt/host/tmc/lib/wave.py 2008-09-03 14:09:44 UTC (rev 4621)
@@ -120,13 +120,13 @@
def get_one(self, t):
if len(self.data) == 0 or t < self.data[0][0] or t > self.data[-1][0]:
raise hell
- return self.wave.data[binary(self.wave.data, lambda x: x[0], t)]
+ return self.data[binary(self.data, lambda x: x[0], t)]
def __iter__(self):
return analog_wave_iter(self)
def __len__(self):
- return len(self.data.wave)
+ return len(self.data)
# === Digital waves ===========================================================
More information about the commitlog
mailing list