Skip to content

Instantly share code, notes, and snippets.

@HamishB
Created April 24, 2014 08:39
Show Gist options
  • Save HamishB/11246772 to your computer and use it in GitHub Desktop.
Save HamishB/11246772 to your computer and use it in GitHub Desktop.
patch for adafruit/Adafruit-Raspberry-Pi-Python-Code/ADS1x15/Adafruit_ADS1x15.py
--- Adafruit_ADS1x15.py.ORIG 2014-04-24 20:20:39.652528689 +1200
+++ Adafruit_ADS1x15.py 2014-04-24 20:26:33.162423221 +1200
@@ -180,12 +180,12 @@
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
@@ -263,12 +263,12 @@
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
@@ -366,12 +366,12 @@
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
@@ -439,12 +439,12 @@
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
@@ -573,16 +573,16 @@
# othewise it returns the value for 250sps. This saves a lot of if/elif/else code!
if (self.ic == self.__IC_ADS1015):
if ( (sps not in self.spsADS1015) & self.debug):
- print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
@@ -668,16 +668,16 @@
# othewise it returns the value for 250sps. This saves a lot of if/elif/else code!
if (self.ic == self.__IC_ADS1015):
if ( (sps not in self.spsADS1015) & self.debug):
- print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
else:
if ( (sps not in self.spsADS1115) & self.debug):
- print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
+ print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
# Set PGA/voltage range, defaults to +-6.144V
if ( (pga not in self.pgaADS1x15) & self.debug):
- print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
+ print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
self.pga = pga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment