mycnc:popup_messages
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mycnc:popup_messages [2020/05/25 10:59] – ivan | mycnc:popup_messages [2020/11/19 11:58] – ivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME - WORK IN PROGRESS | ||
- | |||
====== Popup messages ====== | ====== Popup messages ====== | ||
+ | |||
+ | {{youtube> | ||
This is an expanded manual that serves to introduce the user to the concept of popup messages beyond the basics described in the [[mycnc: | This is an expanded manual that serves to introduce the user to the concept of popup messages beyond the basics described in the [[mycnc: | ||
Line 25: | Line 25: | ||
* Coefficient K to multiply the variable by. Useful to convert tiny incremental changes (such as fractions of a second) or large rapidly changing numbers into numbers that can be easily read by the user. | * Coefficient K to multiply the variable by. Useful to convert tiny incremental changes (such as fractions of a second) or large rapidly changing numbers into numbers that can be easily read by the user. | ||
+ | Popup messages are controlled by writing a **1** or a **0** into global variables #9100-9163 (1 to bring up the popup, 0 to close it). Therefore, the user can set up to 64 possible popup messages within the myCNC software by going into Settings > Config > Screen > Popup Messages and assigning the necessary messages there. Afterwards, the message can be brought up either through a PLC procedure, like so: | ||
+ | |||
+ | < | ||
+ | |||
+ | or by using a G-code command (for example, within a macro) such as | ||
+ | |||
+ | < | ||
+ | |||
+ | which will write a 1 in the global variable #9160. | ||
====Examples of popup messages implementation==== | ====Examples of popup messages implementation==== | ||
+ | |||
+ | ===Mandatory homing procedure=== | ||
+ | |||
+ | //The below section is an excerpt from the following manual: [[plc: | ||
+ | |||
+ | Please consult the full manual for additional information on mandatory homing setup.// | ||
+ | |||
+ | Mandatory Homing procedure handler can be implemented with **Software PLC**: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | **NOTE:** The homing procedure handler is OFF by default as it has the exit(99); line in the beginning of the program which immediately terminates the PLC as soon as it is started. In order to enable the homing procedure handler, add two forward slashes in front of the exit(99); line to comment it out so that the PLC can proceed uninterrupted: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | There are Homing flags situated in global variables 7391-7399 | ||
+ | ^ Address ^ Global variable Description ^ | ||
+ | | 7391 | X axis homing flag | | ||
+ | | 7392 | Y axis homing flag | | ||
+ | | 7393 | Z axis homing flag | | ||
+ | | 7394 | A axis homing flag | | ||
+ | | 7395 | B axis homing flag | | ||
+ | | 7396 | C axis homing flag | | ||
+ | |||
+ | |||
+ | The flags are set automatically to " | ||
+ | - The myCNC software has just loaded | ||
+ | - Emergency button has been pressed | ||
+ | - Corresponding Servo Ready alarm has been triggered | ||
+ | |||
+ | |||
+ | Software PLC Homing procedure handler monitors the flags and stops running G-code if any of the flags is set to 1. | ||
+ | |||
+ | <code C HOMING_HANDLER.plc> | ||
+ | main() | ||
+ | { | ||
+ | |||
+ | // | ||
+ | |||
+ | a=0; | ||
+ | do{ | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | // | ||
+ | |||
+ | a++; if(a> | ||
+ | |||
+ | | ||
+ | // | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | // | ||
+ | |||
+ | if (home!=0) | ||
+ | { | ||
+ | prg=gvarget(6065); | ||
+ | if (prg!=0) //Check if Program running is started and Stop it immediately | ||
+ | { | ||
+ | gvarset(0xffffff, | ||
+ | }; | ||
+ | |||
+ | gvarset(9100, | ||
+ | gvarset(8160, | ||
+ | |||
+ | }else | ||
+ | { | ||
+ | gvarset(9100, | ||
+ | if (home_old!=home) //just home | ||
+ | { | ||
+ | | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | }while(1); | ||
+ | |||
+ | exit(99); | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | Writing a " | ||
+ | Content to show in the Popup message should be programmed in the cnc-variables.xml configuration file. | ||
+ | |||
+ | myCNC software has configuration widget to add and setup a Popup Message Widget. | ||
+ | |||
+ | {{mycnc: | ||
+ | |||
+ | * Press **" | ||
+ | * **Popup message #** - ID number of popup message to show/hide. Global Variable numbers 9100...9200 are used to show hide the popup messages. \\ For example, variable number **9114** is used to show Popup message with ID **14** | ||
+ | * **Position X,Y** - used to define Popup widget position on the screen. Popup message will be shown in the center, if Position x,y are not defined. | ||
+ | * **Size** - defines size of Popup message widget | ||
+ | * **Header, Message, Footer** - Popup message widget contains 3 sections to show a message. You can define text for each section (Header, Message, Footer). Section Size (width, height) and Font size can be defined for each section as well. | ||
+ | * **Button Image, Size, Action** - Popup message may have a button at the bottom of the popup widget. A button image file, button size and action should be defined to get the button appeared in the widget. | ||
+ | * **Hide timeout** - (under developing) Popup message may disappear automatically after given timeout | ||
+ | * **Variable** - One of text lines (header, message or footer) may contain C-style format section to print variable value. If this section is present, then a variable, defined here, is printed. For example, Variable #99 will be printed in " | ||
+ | * **K** - ratio to print the variable value. For example, if " | ||
+ | |||
+ | | ||
+ | Popup message example is shown below | ||
+ | | ||
+ | {{mycnc: | ||
+ | |||
===M660=== | ===M660=== | ||
Line 46: | Line 161: | ||
flag=gvarget(1999); | flag=gvarget(1999); | ||
}; | }; | ||
+ | |||
}while(flag> | }while(flag> | ||
Line 60: | Line 176: | ||
{{: | {{: | ||
+ | |||
+ | ===M604=== | ||
+ | |||
+ | < | ||
+ | main() | ||
+ | { | ||
+ | //clamp new tool | ||
+ | portclr(OUTPUT_TOOL_CLAMP); | ||
+ | |||
+ | timer=300; | ||
+ | |||
+ | timer=2000; | ||
+ | do | ||
+ | { | ||
+ | timer--; | ||
+ | t=portget(INPUT_TOOL_CLAMPED);// | ||
+ | if (t!=0) | ||
+ | { | ||
+ | exit(99); | ||
+ | }; | ||
+ | }while(timer> | ||
+ | |||
+ | gvarset(9124, | ||
+ | timer=20; | ||
+ | |||
+ | message=PLCCMD_MOTION_BREAK; | ||
+ | timer=20; | ||
+ | |||
+ | |||
+ | exit(99); | ||
+ | };</ |
mycnc/popup_messages.txt · Last modified: 2020/11/19 11:59 by ivan