comparison eprodbus.py @ 17:3067bb98b482

Fix signal handling by using the correct function signature.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 06 Dec 2021 11:27:37 +1030
parents 3338e666256b
children 9c2e08444598
comparison
equal deleted inserted replaced
16:3338e666256b 17:3067bb98b482
143 cur = self.dbh.cursor() 143 cur = self.dbh.cursor()
144 row['tstamp'] = int(datetime.datetime.now().strftime('%s')) 144 row['tstamp'] = int(datetime.datetime.now().strftime('%s'))
145 cur.execute('INSERT INTO eprolog VALUES (:tstamp, :main_voltage, :aux_voltage, :battery_curr, :amp_hours, :state_of_charge, :time_remaining, :battery_temp, :auto_sync_volts, :auto_sync_curr, :e501, :alarm_test, :light, :display_test, :temp_sensor, :aux_hv, :aux_lv, :installer_lock, :main_hv, :main_lv, :low_battery, :battery_flat, :battery_full, :battery_charged, :no_sync, :monitor_reset)', row) 145 cur.execute('INSERT INTO eprolog VALUES (:tstamp, :main_voltage, :aux_voltage, :battery_curr, :amp_hours, :state_of_charge, :time_remaining, :battery_temp, :auto_sync_volts, :auto_sync_curr, :e501, :alarm_test, :light, :display_test, :temp_sensor, :aux_hv, :aux_lv, :installer_lock, :main_hv, :main_lv, :low_battery, :battery_flat, :battery_full, :battery_charged, :no_sync, :monitor_reset)', row)
146 self.dbh.commit() 146 self.dbh.commit()
147 147
148 def doexit(): 148 def doexit(signum, frame):
149 sys.exit(1) 149 sys.exit(1)
150 150
151 def main(): 151 def main():
152 # Add signal handler to exit, otherwise we have to press ctrl-c twice to quit 152 # Add signal handler to exit, otherwise we have to press ctrl-c twice to quit
153 signal.signal(signal.SIGINT, doexit) 153 signal.signal(signal.SIGINT, doexit)