# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


from time import sleep
from config import config
import Adafruit_ADS1x15 as AtoD
import logger
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#import smbus
#from Adafruit_I2C import Adafruit_I2C
for i in config['AtoDs']:
  exec(i + '=' + config['AtoDs'][i])

log = logger.logging.getLogger(__name__)
log.setLevel(logger.logging.DEBUG)
log.addHandler(logger.errfile)


class Rawdat:
  # compile analog capture code to save CPU time
  vin = []
  for i in sorted(config['VChannels']):
    vin = vin + [compile(config['VChannels'][i], '<string>', 'eval')]
  #  vin = vin + [config['VChannels'][i]]
  #for i in config['IChannels']:
  #  config['IChannels'][i] = compile(config['IChannels'][i], '<string>', 'eval')
  iin = []
  for i in sorted(config['IChannels']):
    iin = iin + [compile(config['IChannels'][i], '<string>', 'eval')]

  rawi = [0.0 for i in iin]

# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


# Path: ads1115.py
from time import sleep
from config import config
import Adafruit_ADS1x15 as AtoD
import logger

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#import smbus
#from Adafruit_I2C import Adafruit_I2C
for i in config['AtoDs']:
  exec(i + '=' + config['AtoDs'][i])

log = logger.logging.getLogger(__name__)
log.setLevel(logger.logging.DEBUG)
log.addHandler(logger.errfile)


class Rawdat:
  # compile analog capture code to save CPU time
  vin = []
  for i in sorted(config['VChannels']):
    vin = vin + [compile(config['VChannels'][i], '<string>', 'eval')]
  #  vin = vin + [config['VChannels'][i]]
  #for i in config['IChannels']:
  #  config['IChannels'][i] = compile(config['IChannels'][i], '<string>', 'eval')
  iin = []
  for i in sorted(config['IChannels']):
    iin = iin + [compile(config['IChannels'][i], '<string>', 'eval')]

  rawi = [0.0 for i in iin]

  rawv = [ 0.0 for i in range(len(vin)+1)]