ME 305 Group 6 Documentation
Functions | Variables
taskUser_03.py File Reference

Manages the states for the User Interface task. More...

Functions

def taskUser_03.printLegend ()
 Prints the available user key commands to the console. More...
 
def taskUser_03.printTestLegend ()
 Prints the available user key commands in test interface to the console. More...
 
def taskUser_03.taskUserFcn (str task_name, int period, shares_03.Share_03 zFlag, shares_03.Share_03 pFlag, shares_03.Share_03 dFlag, shares_03.Share_03 vFlag, shares_03.Share_03 duty1, shares_03.Share_03 duty2, shares_03.Share_03 cFlag, shares_03.Share_03 gFlag, shares_03.Share_03 tFlag, shares_03.Share_03 sFlag, shares_03.Share_03 dataPrint, shares_03.Share_03 testData)
 Main task function to control UI states. More...
 

Variables

 taskUser_03.S0_INIT = micropython.const(0)
 
 taskUser_03.S1_CMD = micropython.const(1)
 
 taskUser_03.S2_ZERO = micropython.const(2)
 
 taskUser_03.S3_PRINT = micropython.const(3)
 
 taskUser_03.S4_INPUT = micropython.const(4)
 
 taskUser_03.S5_TEST = micropython.const(5)
 

Detailed Description

Manages the states for the User Interface task.

Manages the current state and executes state-related logic for all User Interface functionality. Cycles through states for processing input, zeroing encoder position, and printing output.

Author
Caleb Savard
Chris Linthacum
Date
February 2, 2022

Function Documentation

◆ printLegend()

def taskUser_03.printLegend ( )

Prints the available user key commands to the console.

Prints a table of available user input commands to the console to preview the available user key commands.

◆ printTestLegend()

def taskUser_03.printTestLegend ( )

Prints the available user key commands in test interface to the console.

Prints a table of available user input commands to the console to preview the available user key commands in the testing interface.

◆ taskUserFcn()

def taskUser_03.taskUserFcn ( str  task_name,
int  period,
shares_03.Share_03  zFlag,
shares_03.Share_03  pFlag,
shares_03.Share_03  dFlag,
shares_03.Share_03  vFlag,
shares_03.Share_03  duty1,
shares_03.Share_03  duty2,
shares_03.Share_03  cFlag,
shares_03.Share_03  gFlag,
shares_03.Share_03  tFlag,
shares_03.Share_03  sFlag,
shares_03.Share_03  dataPrint,
shares_03.Share_03  testData 
)

Main task function to control UI states.

Manage different User Input states, including Init, Read_Cmd, Zero_Encoder, and Print_Data. On function run, executes the logic of the current state and if appropriate shifts state for next run of function.

Parameters
task_nameTask name for the function to help with debugging
periodPeriod to run execute function at. Period defines frequency that states are executed and refreshed.
zFlagShared data object to encapsulate the z key being pressed. Signals that encoder should be zeroed.
pFlagShared data object to encapsulate the p key being pressed. Signals to print the encoder position.
dFlagShared data object to encapsulate the d key being pressed. Signals to print the encoder delta.
gFlagShared data object to encapsulate the g key being pressed. Signals to begin data collection.
sFlagShared data object to encapsulate the s key being pressed. Signals to end data collection prematurely.
dataPrintShared data object to store the recorded encoder data. Stores both the position data and time values.
testDataShared data object to act as a flag to record avg velocity and to store the velocity data during testing. @yield state If task ran, yields state the function is now in. If task did not evaluate, returns None.