Changeset - ce32edfd2399
[Not reviewed]
refactor
0 1 0
matthewreed - 8 years ago 2017-04-04 20:52:57

Refactoring code to make it more object oriented, modular, and usable
1 file changed with 19 insertions and 4 deletions:
0 comments (0 inline, 0 general)
hydrobot.py
Show inline comments
 
@@ -19,9 +19,15 @@ from pytz import timezone
 
import logging
 
import signal
 

	
 
import network
 
import network_interface
 
from message import HydroBotMessage
 
import module
 

	
 
#TODO
 
#fix temperature offsets
 
#add periodic output refresh
 
#add output cleanup on shutdown
 

	
 
# load config file
 
config = configparser.ConfigParser(allow_no_value = True)
 
@@ -280,11 +286,20 @@ def main(argv):
 

	
 
    database = Database()
 
    
 
    canbus = CanBus(database, argv[0])
 
    canbus.start()
 
    
 
    module_network = network.Network(logger)
 
    module_network.add_interface(network_interface.CanBusNetworkInterface(module_network, argv[0], logger))
 
    module_network.start_all_interfaces()
 
    
 
    scheduler = Scheduler(canbus)
 
    scheduler.start()
 
    message = HydroBotMessage(0x0001, 0x81, 0x0007, 0x0001, 0x0111)
 
    module_network.send_message(message)
 
    
 
    
 
    #canbus = CanBus(database, argv[0])
 
    #canbus.start()
 
    
 
    #scheduler = Scheduler(canbus)
 
    #scheduler.start()
 

	
 
    while True:
 
        time.sleep(0.001)
0 comments (0 inline, 0 general)