Other Functions (Background Operations)

Last modified by writer on 2023/09/08 19:06

bool IsGCodeRunning ()

Checks if PUMOTIX is in G-code execution mode.

Return value:

  • true - if PUMOTIX is in G-code execution mode.
bool IsMDIRunning ()

Checks if PUMOTIX is in manual command execution mode.

Return value:

  • true - if PUMOTIX is in the execution mode of the manual input command.
bool IsRunning ()

Checks if PUMOTIX is in G-code or manual entry mode.

Return value:

  • true - if either of the two IsGCodeRunning () or IsMDIRunning () modes is active.
bool IsIdle ()

Allows you to check whether the PUMOTIX is in standby mode ("on" state of the power button).

Return value:

  • true - if PUMOTIX is in standby mode.
bool IsEStop ()

Checks if PUMOTIX is in EStop mode ("off" state of the power button).

Return value:

  • true - if PUMOTIX is in EStop mode.
void FloodEnable ()

Turn on the flood coolant.

void FloodDisable ()

Turn off the flood coolant.

void MistEnable ()

Turn on spray coolant.

void MistDisable ()

Switch off the spray coolant.

void Stop ()

G-code execution stop.

void EStop ()

Emergency stop execution of the G-code and putting the system in Off mode.

void Sleep (number milliseconds)

Waiting for the specified number of milliseconds.

Options:

  • number milliseconds - the number of milliseconds during which the execution of the background macro will be suspended.
void DisplayMessage (string message)

Display in the user interface of a message from a background macro.

Options:

  • string message - the text of the message that should be shown to the user.
string Get_Message (number messageId)

Getting one of predefined localized text messages.

Options:

  • number messageId – message ID (one of the constants defined in the Messages list must be passed as this parameter).

Return value:

  • localized text message.
bool IsRealDeviceConnected ()

Allows you to check device connection.

Return value:

  • true – if a real device (not a simulator) is selected and connected.
number GetExecutingMCode ()

Getting an executing macro code. It returns -1 if no one macro is executed.

Return value:

  • macro code.
string str (number value)

Convert a real number to a string.

The Lua language supports implicit conversion of a number into a string, but by default for a very small real number the conversion result can have an exponential format, which does not allow using the string as part of a G-code string. For convenience, you can use the str function, which ensures that the number has a decimal representation.

Options:

  • number value - a real number to be converted.

Return value:

  • string representation of a given number.
number GetSystemTickCount ()

Getting the number of milliseconds since the operating system started. It can be used to measure time intervals. To get the current calendar date and time in UnixTime, you need to use the standard Lua os.time() function.

Return value:

  • the number of milliseconds since the operating system started.
void SetUserVariable (number index, number value)

Setting the value of a user variable. This value can be read when another macro is executed, including after restarting PUMOTIX.

Options:

  • number index - variable number, integer from 0 to 99;
  • number value - the value of the user variable (real number) that must be set.
number GetUserVariable (number index)

Getting the value of a user variable.

Options:

  • number index - the number of the variable, an integer from 0 to 99.

Return value:

  • current value of the user variable (real number).
bool GetLedUserValue (number index)

Getting a value of user led (boolean).

Options:

  • number index – variable number, integer from 0 to 29.

Return value:

  • bool - user variable value.
void SetLedUserValue (number index, bool a_value)

Setting a user variable value. This value can be read in another macro, including after PUMOTIX rebooting.

Options:

  • number index – variable number, integer from 0 to 29;
  • bool a_value – user variable value.
number GetNumUserValue (number index)

Getting a user number value (real).

Options:

  • number index – variable number, integer from 0 to 29.

Return value:

  • number - user variable value.
void SetNumUserValue (number index, number value)

Setting a user variable value. This value can be read in another macro, including after PUMOTIX rebooting.

Options:

  • number index – variable number, integer from 0 to 29;
  • number value – user variable value (real number) to set.
string GetStrUserValue (number index)

Getting a user string value.

Options:

  • number index – variable number, integer from 0 to 29.

Return value:

  • string – user variable value.
void SetStrUserValue (number index, string value)

Setting a user variable value. This value can be read in another macro, including after PUMOTIX rebooting.

Options:

  • number index – variable number, integer from 0 to 29;
  • string value – user variable value (string) to set.
void RunGCode ()

Start G-code running (similar to pressing the Start button).

void RunMDI (string command)

Execute a given string of G-code. The function returns immediately after the call and execution of the background operation continues.

Options:

  • string command – G-code string to execute.
void WeldOscillatorEnable ()

Oscillator on.

void WeldOscillatorDisable ()

Oscilator off.