Skip to main content

utils.main_loop

get_node_id

def get_node_id()

Returns the value from the node_id.txt file in root of CIRCUITPY drive, if exists Else returns an arbitrary default node id.

MainLoop Objects

class MainLoop()

Main driver for all farm-ng apps run on microcontrollers.

io_debug_str

def io_debug_str()

Returns debug string for serial console.

can_debug_str

def can_debug_str()

Returns string with details on CAN bus status.

update_mem

def update_mem()

Check RAM stats on mcu.

init_app

def init_app()

Initialize the app loaded on the mcu.

handle_message

def handle_message(message)

Process each received CAN message.

can_dummy

def can_dummy(message)

Dummy function that is called when message does not meet filter.

poll_can

def poll_can()

Checks for can messages to parse.

update_can_stats

def update_can_stats()

Query CAN bus status.

update_display

def update_display(display: Display)

Called by init delta tracker object.

draw_debug

def draw_debug(display: Display)

Show debug stats on the dashboard display.

iter

def iter()

Method called every loop of the main while loop driving the app on the microcontroller.

loop

def loop()

Initializes the main while loop, with an exception handler for dashboard that displays exceptions on the screen.