Loading a generic file to the specified destination flash: the type of loading is specified using the appropriate flags.
Syntax |
flashFileLoad(string source, string target, uint flags, uint @nackx, uint gid=0): bool |
---|---|
source |
Name of the source file |
target |
Name of the target file on the flash |
flags |
Loading settings |
nackx |
Reference to any extended NACK code, in case of error |
gid |
Identifier of the graph percentage element, if any, to be used, which can be created with the addGauge() function |
Result |
Returns logical outcome of operation |
Valid settings (flags) for the function are as follows:
Flag |
Description |
---|---|
flashFileLoad_Overwrite. |
Overwrite of the target file, if it already exists |
flashFileLoad_Recover |
Attempts load recovery there where interrupted: if not possible performs a load from scratch. (#1) |
flashFileLoad_NoBif16. |
Disables BIF16 handling (RRT and old handlers only). |
flashFileLoad_AsBoot. |
Load the source file as BOOT (#2) |
flashFileLoad_AsBios |
Load source file as BIOS ( #2) |
flashFileLoad_AsMain |
Load the source file as MAIN (#2) |
flashFileLoad_AsCfg |
Loads the source file as CFG (#2) |
Annotation:
•The source file, if the filename is relative, considers the current path to be that of the current workspace. If you want to reference the current shell path, which may be different from the workspace path, use the dirBase() function.
•The target file must mandatorily specify the target flash path.
•The extended NACK code contains the actual NACK code in loWord(nackx) and any additional information in hiWord(nackx).
•(#1) The flashFileLoad_Recover flag requires a rather slow operation, so there may be problems on the numerical control side if the operation is performed with energized axes (WD drop type). This functionality may not be supported on some devices or in some modes.
•(#2) This type of loading ignores the target filename (target) and if not executed properly could lead to damage or malfunction of the equipment in question. These flags cannot be combined, i.e., only one can be.
Example of use
To load the RTE.CFG file into the /FA/ folder, considering the source file in the shell base path.
uint nackx uint gid = addGauge() if(flashFileLoad(dirBase() + "/rte.cfg", "/fa/rte.cfg", 0, @nackx, gid)) ; TODO: loading ok else printNack(nackx) ; TODO: error handling end |