- mystring = 'Pulses(us)='
- mystring += ','.join(str(int(int(x) * 1000000 / self.samplerate))
- for x in self.pulse_lengths)
- mystring += '\n'
+ s = 'Pulses(us)='
+ s += ','.join(str(int(int(x) * 1000000 / self.samplerate))
+ for x in self.pulse_lengths)
+ s += '\n'
self.put(self.samplenum - 10, self.samplenum, self.out_binary,
self.put(self.samplenum - 10, self.samplenum, self.out_binary,
def decode_nrz(self, start, samples, state):
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
def decode_nrz(self, start, samples, state):
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
- if state == '1':
- dsamples = self.sample_high
- else:
- dsamples = self.sample_low
- self.ss = start
- self.es = start + samples
+ dsamples = self.sample_high if state == '1' else self.sample_low
+ self.ss, self.es = start, start + samples
while samples > dsamples * 0.5:
if samples >= dsamples * 1.5: # More than one bit.
self.es = self.ss + dsamples
while samples > dsamples * 0.5:
if samples >= dsamples * 1.5: # More than one bit.
self.es = self.ss + dsamples
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
self.pulse_lengths.append(samples)
# Use different high and low widths to compensate skewed waveforms.
if self.preamble_val != '1010': # 1111 preamble is half clock T.
(self.half_time, self.lstate, self.ss_1111, ook_bit, errors) = (
if self.preamble_val != '1010': # 1111 preamble is half clock T.
(self.half_time, self.lstate, self.ss_1111, ook_bit, errors) = (
if self.preamble_val == '1111':
self.putx([2, [ook_bit[2]]])
if self.preamble_val == '1010':
if self.preamble_val == '1111':
self.putx([2, [ook_bit[2]]])
if self.preamble_val == '1010':
self.putx([d_row, [decoded[i][2]]])
if (man_errors < self.max_errors and len(decoded) > 0):
self.putx([d_row, [decoded[i][2]]])
if (man_errors < self.max_errors and len(decoded) > 0):
pinstate = int(not pinstate)
if self.invert == 'yes': # Invert signal.
pinstate = int(not pinstate)
pinstate = int(not pinstate)
if self.invert == 'yes': # Invert signal.
pinstate = int(not pinstate)