Skip to main content
FW version: Stable

General commands

reboot

Reboot the system. This command has no arguments.


echo [arg1] [arg2] [arg3] ...

Prints its arguments to the standard output, separated by space. Could be used in combination with variable evaluation and/or escape sequences(but as decimal numbers).

Examples

commandoutput
echo $permanents/timeprints number of secondns since start to standard output
echo run: $permanents/timesame as first command, with run: prepended. Example output: run: 11290
echo \12clears terminal window
echo \27escape - closes terminal window

delay <n>

Pauses shell from parsing for [n] milliseconds. Argument [n] has to be a positive integer.

Return value

If called correctly returns 0. Otherwise (for example no argument provided) returns -1.

Example

AM-felix#>delay 5000
<paused for 5 seconds>
AM-felix#>

logout

Ends current session and ends shell. After that, auth key for a new administrator login is displayed followed by a usual login prompt. This command has no arguments.

Return value

Returns 0 if executed correctly.


whoami

Prints 8-bit number in hexadecimal format. Write and read access rights of the currently logged user are reflected in this number. Bits 7 and 6 (counting from right to left) represent write rights, bits 5 and 4 represent read rights, and bits 3 to 0 are reserved for future use.

Return value

Returns the same number as it prints.

Example

AM-felix#>whoami
f1

Output f1 in binary is 1111 0001, so the first two bits (here first two 1s) represent write rights, the third and fourth bit (here also 1s) represents read rights, and the rest is unimportant as of now.


dump [-h] <data item>

Prints the given <data item> to standard output. Option -h writes the output in hexadecimal format, bytes are delimited by space. Without this argument, the output is written as a string of ASCII characters, each character for one byte.

It goes from the first byte to the last byte, in a matter of a number it means it goes from LSB to MSB - LSB will be the first written byte.

Return value

Returns the count of successfully dumped items.

Example

AM-felix#>dump permanents/totaltime
#~
AM-felix#>dump -h permanents/totaltime
2f 7e 00 00
AM-felix#>

version [-n] [-h] [-s] [-a] [-d]

Prints version of the device - string consisting of basename, HWID, SWID, and address of the device. Basename and HWID are delimited by colon and space, other identifiers are delimited by comma and space. Only some parts can be printed, this is chosen by options. If multiple options are used, each part is printed on a new line.

Options:

  • -n prints only the basename
  • -h prints only the HWID
  • -s prints only the SWID
  • -a prints only the address of the device
  • -d prints only the type of the device, in format <class-signature>:<class-string>.

Return value

If option -a is specified, returns the printed address. If option -d is specified, returns the class signature (in the printed string it's the part before the colon). Otherwise returns 0.

Example

AM-felix#>version
AM-felix: esc3-am1f_06dxh0810-A10, VECTOR_2_generic Jun 21 2021, addr: 0
class 10: AM, build target: esc3-am1_default
AM-felix#>version -nha
AM-felix
esc3-am1f_06dxh0810-A10
0
AM-felix#>

uid

Prints unique identifiers of the device - UUID, SN.

Return value

Returns the least significant part of UUID, see example

Example

AM-felix#>uid
UUID: 203932385642571100210034, S/N: 928VBW112134
AM-felix#>echo $vars/retval
2162740 // returned number in hexadecimal is 210034, which corresponds to the leftmost part of UUID

clock [-t<time>] [-d<date>]

If called without the options, it prints the current time in the device. If called with either option (or both), you can set the current time and date. This command will only work if RTC is available on the device.

Options:

  • -t<input-time> - set the time (hours, minutes, seconds).
  • -d<date> - set the date similarly.

var <name1> [name2] [name3] ... [nameN] [type]

Create dynamic variable (or more variables) with name <name1> ([name2], [name3] ... ) in directory /vars. Variable (variables) exists until YOS device is restarted. Created variable type is defined by the last parameter of command - [type] parameter. Supported variable types are:

Types

type iddescription
int8signed, 8-bit integer, range -128 - 127
uint8unsigned, 8-bit integer, range 0 - 255
int16signed, 16-bit integer, range ?32,768 - 32,767
uint16unsigned, 16-bit integer, range 0 - 65,536
int32signed, 32-bit integer, range ?2,147,483,648 - 2,147,483,647
uint32unsigned, 8-bit integer, range 0 - 4,294,967,296
float32-bit number with floating decimal point

Note: Allowed types are also int64, uint64, double, and string, but beware that these types are not fully supported yet and are mostly useless.

Return value

Returns 0 if and only if the command was successfully executed.

Arrays

With var you can also create arrays. To create an array of length N substitute any [name] with [name-of-array].N. So the final command can look something like this:

var myarray.10 int32

This creates an array of 10 int32s. To access elements in the array write name-of-array.i where i is the wanted index. Some examples of working with arrays:

AM-felix#>var myarray.10 int32
AM-felix#>set myarray.0 130
AM-felix#>set myarray.3 260
AM-felix#>echo $vars/myarray
130,0,0,260,0,0,0,0,0,0
AM-felix#>echo $vars/myarray.3
260
AM-felix#>

set <var1> [var2] [var3] ... [varN] <expression>

Sets the variable to value specified by an expression. Overflows can happen! Also, remember that no whitespace in <expression> is allowed!

The expression is C-style string format which can contain braces, operators, variables, and constants. The expression is evaluated in a floating-point scalar and considered valid when the result is nonzero. If the bitwise operators are used in the expression, it is evaluated in a 32-bit fixed-point scalar. The operators can be: *, : (for division) , +, -, >, <, >=, <=, ==, !=, &&, ||, &, |, ^. If the output should be a boolean value, we convert 1 for true and 0 for false. The expression is evaluated from the left to the right and operators are not prioritized. If a priority is required, the user must specify that with braces. 3+5*4 needs to be entered as 3+(5*4).

When setting an array of variables, values are delimited by , (comma) without any whitespaces. Following command starts to set values of variables in the array from the first position - position 0 (indexing starts from 0):

set [name of array] value0,value1,value2...

Not all values have to be assigned, setting the first 3 values of an array with length 10 is ok, the remaining values will be untouched.

Return value

Negative values are for errors, if a positive value is returned then it represents the count of successfully set variables.

Some error code mappings, other codes can be expression parsing errors or others:

retvalmeaning
-100no enough arguments
-101settable variable not found
-102write restricted
-105desired value too low
-106desired value too high
-107desired value is not allowed

Examples

commanddescription
set f (q/180)*3.141592654Converts value q from degrees to radians and saves it to f.
set i i*iSquares i and saves it to i.
set ret i>17If i is greater than 17, ret will be 1. Otherwise ret will be 0.
set myarray 1,2,3Sets first 3 values of myarray to 1, 2 and 3, assuming myarray is an array.

format [-b<base>] [-p<precision>]

Set default input/output format for the numbers in the Term tool. Different output formats can be selected by following options:

  • -b<base> - set the base for input/output format of integer numbers. -b8 for octal format, -b16 for hexadecimal, and so on.
  • -p<precision> - set the precision for float numbers. Positive values select the number of rounding digits. Negative values select the scientific notation, where the value selects the count of valid digits. 0 select default settings.

Return value

A negative value meaning an error occurred. 0 means successful execution.


restore [-y] [-r] [-f<string>] [-m] [-M] [-s] [-p<n>] [path1] [path2] ... [pathN]

Restores the given parameters or directories to preset values. If run without arguments, it restores all parametric variables in the active directory recursively.

Options:

  • -y - no confirmation prompt is displayed.
  • -r - won't list parameters recursively.
  • -f<string> - only list parameters containing <string> in their name.

Preset options:

  • -m - will set parameters to the min preset.
  • -M - will set parameters to the max preset.
  • -s - will set parameters to the step preset.
  • -p<n> - usable only if the given parameter has more presets than default, min, max and step. -p1 will use the first extra preset, -p2 the second and so on.

Arguments [path1] [path2]... [pathN] correspond to the directories and parameters we want to restore. If no argument is given the command goes through the active directory recursively.

Return value

retvalmeaning
-1given parameter not found
0no parameters restored
any positive valuenumber of parameters restored

Example

AM-felix#>restore         # restore all params to default values, recursively
restore params to 0 (y/n)? : y
93 entries done.
AM-felix#>restore -ry # restore params only in the active directory, and auto-confirm
3 entries done.
AM-felix#>restore -My # restore all params to max value, where possible
40 entries done.

save [-d] [-b] [-e] [-y] [parameter]

Save parameters to backup or user storage. If [parameter] is not given will save all the parameters. When you specify [parameter], the only option that will be significant is -y and you will always save into your userstorage.

Options:

  • -b - if specified will save to backup instead of main storage.
  • -d - will print hash size and hash as if it was saving the data to storage, but won't save anything. stands for dummy.
  • -e - erase userstorage.
  • -y - no confirmation prompt is displayed.

Return value

Negative values stand for errors while saving. When saving given parameters as arguments to userstorage, return value should be 0. When saving everything (no arguments) returns the hash of the saved files.

Examples

AM-felix#>set mode_forward 3
AM-felix#>save
save params to main (y/n)? : y
309 bytes, #05f3 hash
AM-felix#>

Set mode_forward to 3 and save it to the main flash memory. If no save was run after the assignment, after reboot the change would be lost.

AM-felix#>pr mode_forward         # check the current parameter value
-> mode_forward uint8 : 3 (2), Driver mode when cmd is positive

Total 1 entries
AM-felix#>set mode_forward 5 # set mode_forward to a different value
AM-felix#>save -y mode_forward # save the parameter to userstorage
saving 1 bytes
AM-felix#>reboot # reboot the device
...
AM-felix#>pr mode_forward # check the parameter value after reboot
-> mode_forward uint8 : 3 (2), Driver mode when cmd is positive
# i didn't save the value so the previous value got loaded after reboot
Total 1 entries
AM-felix#>load -y mode_forward # load parameter from userstorage
AM-felix#>pr mode_forward
-> mode_forward uint8 : 5 (2), Driver mode when cmd is positive

Total 1 entries

Example using userstorage and the optional argument with save and load.


load [-b] [-d] [-y]

Loads parameters saved in the flash memory. It restores recursively all parametric variables all directories and all subdirectories.

Options:

  • -b - load values from backup instead from main storage.
  • -d - will print hash size and hash as if it was loading the data from storage, but won't load anything. stands for dummy.
  • -y - no confirmation prompt is displayed.

Return value

Negative values for errors, 0 when aborted at prompt and positive values for a number of bytes restored.

Examples

AM-felix#>set mode_reverse 40    # mistakenly set mode_reverse to 40
...
AM-felix#>load -y # restore mode_reverse to its saved value
309 bytes, #5725 hash
AM-felix#>pr mode_reverse
-> mode_reverse uint8 : 8 (8), Driver mode when cmd is negative
# mode_reverse is now back 8
Total 1 entries
AM-felix#>