51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
## Only start grow system
|
|
from time import sleep
|
|
import helper.file_helper as fh
|
|
|
|
if False:
|
|
if not self._is_initial_config_existing():
|
|
print("No config existing. Start setup ...")
|
|
self._setup()
|
|
return
|
|
|
|
from gs.sensor_data_manager import SensorDataManager
|
|
self.sensor_data_manager = SensorDataManager(self.device_info.get_device_id())
|
|
from gs.grow_system_api import GrowSystemApi as GSA
|
|
self.gsapi = GSA()
|
|
|
|
if self._is_config_existing():
|
|
print("Skip Setup. Config existing.")
|
|
self._initialize_sensors()
|
|
elif self._is_initial_config_existing():
|
|
print("Initial config only existing (no base config). Start activation ...")
|
|
self._activate()
|
|
|
|
|
|
def setup():
|
|
from setup.setup import Setup
|
|
setup = Setup()
|
|
setup.setup_pico()
|
|
machine.reset
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# 1) Check and in case of update Growsystem
|
|
# 2) Check if initial_config is existing -> Setup if not
|
|
|
|
if not fh.is_initial_config_existing():
|
|
setup()
|
|
else:
|
|
from gs.growsystem import GrowSystem
|
|
gs = GrowSystem()
|
|
# 3) if device info exists update Device Info else activate
|
|
if fh.is_config_existing():
|
|
gs.update_device_info()
|
|
else:
|
|
gs.activate()
|
|
# 4) Start growsystem
|
|
gs.start()
|
|
|
|
while True:
|
|
print("Keep running in main.py")
|
|
sleep(5)
|
|
|