Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove this #81

Open
github-actions bot opened this issue Jul 21, 2021 · 0 comments
Open

remove this #81

github-actions bot opened this issue Jul 21, 2021 · 0 comments
Labels

Comments

@github-actions
Copy link

remove this

except Exception:

reset()

Set debug level - has to be set after logger was initialised and device was configured

print("HERE")

Initialise file system

# new_config(status_logger, arg=0) #TODO remove this

    # User button will enter configurations page from this point on
  

    # # If initialise time failed to acquire exact time, halt initialisation
    # if no_time:
    #     raise Exception("Could not acquire UTC timestamp")

    # # Check if updating was triggered over LoRa
    # if config.get_config("update"):
    #     software_update(status_logger)

except Exception as e:
    status_logger.exception(str(e))
    # reboot_counter = 0
    # try:
    #     while user_button.get_reboot():
    #         blink_led((0x555500, 0.5, True))  # blink yellow LED
    #         time.sleep(0.5)
    #         reboot_counter += 1
    #         if reboot_counter >= 180:
    #             status_logger.info("rebooting...")
    #             reset()
    #     new_config(status_logger, arg=0) #TODO remove this
    # except Exception:
    #     reset()

pycom.rgbled(0x552000)  # flash orange until its loaded

# If sd, time, logger and configurations were set, continue with initialisation
try:

    status_logger.info("Filesystem.......")
    # Configurations are entered parallel to main execution upon button press for 2.5 secs
    user_button.set_config_blocking(False)
    #status_logger.debug(DEFAULT_LOG_NAME + "  :LOG_LEVEL_KEY" + config.get_config(LOG_LEVEL_KEY))
    # Set debug level - has to be set after logger was initialised and device was configured
    #status_logger = logger_factory.set_level(DEFAULT_LOG_NAME, config.get_config(LOG_LEVEL_KEY) ) # Cannot change mid way?
    #print("HERE")
    status_logger.info("Filesystem init start")
    #print("HERE2")
    # Initialise file system
    init.initialise_file_system()

    # Remove residual files from the previous run (removes all files in the current and processing dir)
    init.remove_residual_files()
    status_logger.info("Filesystem init completed")
    # Get a dictionary of sensors and their status
    sensors = get_sensors(config, status_logger)

    # Join the LoRa network
    #lora = False
    #if (True in sensors.values() or gps_on) and config.get_config("LORA") == "ON":  #TODO: lorawan disabled here
    #    lora = LoRaWAN(status_logger)


    ## Ring buffer
    message_limit_count = 5 # buffer size?
    cell_size_bytes = 100 #all buffer slots are a fixed size ! so waste space, but dont make this smaller that a max message!
    msgBuffer = RingBuffer(RING_BUFFER_DIR, RING_BUFFER_FILE, message_limit_count, cell_size_bytes,  config, status_logger)  # s.processing_path, s.lora_file_name, 31 * self.message_limit, 100)
    
    ## Pybytes
    try:
        # Start PM sensor thread        
        pyBytesThreadId = _thread.start_new_thread(PybytesTransmit.pybytes_thread, (msgBuffer, config,  status_logger)) 
        status_logger.info("THREAD - Pybytes  initialised")
    except Exception as e:
        status_logger.info("Failed to initialise Pybytes thread ")
        #raise e

    # Initialise temperature and humidity sensor thread with id: TEMP
    status_logger.info("Starting Temp logger...")
    if sensors[s.TEMP]:
        TEMP_logger = SensorLogger(sensor_name=s.TEMP, terminal_out=True)
        if config.get_config(s.TEMP) == "SHT35":
            temp_sensor = TempSHT35(config, TEMP_logger, status_logger)
    status_logger.info("Temperature and humidity sensor initialised")

    # Initialise PM power circuitry

d3894c79dbd60e5ba09143a0be85b87420802f21

@github-actions github-actions bot added the todo label Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants