console: Use reactor register_callback() mechanism

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-09-02 12:31:36 -04:00
parent 165317e33f
commit ab4060e145
1 changed files with 1 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class KeyboardReader:
self.pins = None self.pins = None
self.data = "" self.data = ""
reactor.register_fd(self.fd, self.process_kbd) reactor.register_fd(self.fd, self.process_kbd)
self.connect_timer = reactor.register_timer(self.connect, reactor.NOW) reactor.register_callback(self.connect)
self.local_commands = { self.local_commands = {
"PINS": self.command_PINS, "SET": self.command_SET, "PINS": self.command_PINS, "SET": self.command_SET,
"DELAY": self.command_DELAY, "FLOOD": self.command_FLOOD, "DELAY": self.command_DELAY, "FLOOD": self.command_FLOOD,
@ -65,7 +65,6 @@ class KeyboardReader:
self.mcu_freq = msgparser.get_constant_float('CLOCK_FREQ') self.mcu_freq = msgparser.get_constant_float('CLOCK_FREQ')
mcu_type = msgparser.get_constant('MCU') mcu_type = msgparser.get_constant('MCU')
self.pins = pins.PinResolver(mcu_type, validate_aliases=False) self.pins = pins.PinResolver(mcu_type, validate_aliases=False)
self.reactor.unregister_timer(self.connect_timer)
self.output("="*20 + " connected " + "="*20) self.output("="*20 + " connected " + "="*20)
return self.reactor.NEVER return self.reactor.NEVER
def output(self, msg): def output(self, msg):