From: Gerhard Sittig Date: Mon, 20 Feb 2017 19:58:09 +0000 (+0100) Subject: am230x: rename reset() helper method X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=779c540dfa3780f3bb61ad46f28801952d5d190b;p=libsigrokdecode.git am230x: rename reset() helper method The am230x decoder implements a reset() method which clears internal decoder state. Rename the method before all decoders will grow a new reset() method that will be used for a different purpose. --- diff --git a/decoders/am230x/pd.py b/decoders/am230x/pd.py index 3c5003d..0e4eac8 100644 --- a/decoders/am230x/pd.py +++ b/decoders/am230x/pd.py @@ -74,7 +74,7 @@ class Decoder(srd.Decoder): def putv(self, data): self.put(self.bytepos[-2], self.samplenum, self.out_ann, data) - def reset(self): + def reset_variables(self): self.state = 'WAIT FOR START LOW' self.fall = 0 self.rise = 0 @@ -123,7 +123,7 @@ class Decoder(srd.Decoder): def __init__(self): self.samplerate = None - self.reset() + self.reset_variables() def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) @@ -177,7 +177,7 @@ class Decoder(srd.Decoder): self.rise = self.samplenum self.state = 'WAIT FOR RESPONSE LOW' else: - self.reset() + self.reset_variables() elif self.state == 'WAIT FOR RESPONSE LOW': self.wait({0: 'f'}) if self.is_valid('START HIGH'): @@ -185,14 +185,14 @@ class Decoder(srd.Decoder): self.fall = self.samplenum self.state = 'WAIT FOR RESPONSE HIGH' else: - self.reset() + self.reset_variables() elif self.state == 'WAIT FOR RESPONSE HIGH': self.wait({0: 'r'}) if self.is_valid('RESPONSE LOW'): self.rise = self.samplenum self.state = 'WAIT FOR FIRST BIT' else: - self.reset() + self.reset_variables() elif self.state == 'WAIT FOR FIRST BIT': self.wait({0: 'f'}) if self.is_valid('RESPONSE HIGH'): @@ -201,14 +201,14 @@ class Decoder(srd.Decoder): self.bytepos.append(self.samplenum) self.state = 'WAIT FOR BIT HIGH' else: - self.reset() + self.reset_variables() elif self.state == 'WAIT FOR BIT HIGH': self.wait({0: 'r'}) if self.is_valid('BIT LOW'): self.rise = self.samplenum self.state = 'WAIT FOR BIT LOW' else: - self.reset() + self.reset_variables() elif self.state == 'WAIT FOR BIT LOW': self.wait({0: 'f'}) if self.is_valid('BIT 0 HIGH'): @@ -216,10 +216,10 @@ class Decoder(srd.Decoder): elif self.is_valid('BIT 1 HIGH'): bit = 1 else: - self.reset() + self.reset_variables() continue self.handle_byte(bit) elif self.state == 'WAIT FOR END': self.wait({0: 'r'}) self.putfs([3, ['End', 'E']]) - self.reset() + self.reset_variables()