|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GrinderODIDScreenV02 | MachineScreenLoadScript () |
| Execute all initialization logic when the ODID Grinder machine screen is loaded. | |
| GrinderODIDScreenV02 | MachineScreenPLCScript () |
| Execute all real-time PLC script update functions for the ODID Grinder screen. | |
| GrinderODIDScreenV02 | MachineScreenLowPriorityLoop () |
| Execute all low-priority periodic screen update functions for the ODID Grinder. | |
| GrinderODIDScreenV02 | UpdateG88ReciprocatingAxis () |
| Update the G288 handwheel infeed reciprocating axis state and feed-hold notification. | |
| GrinderODIDScreenV02 | MachineScreenStartupScript () |
| Execute the machine screen startup script for the ODID Grinder. | |
| GrinderODIDScreenV02 | InitializeAxisPositionGroup () |
| Initialize the axis position group layout and DRO visibility for the grinder screen. | |
| GrinderODIDScreenV02 | IsRetracting () |
| Report whether the machine is currently executing a retraction sequence. | |
| GrinderODIDScreenV02 | SetRetracting (new_state) |
| Set the retracting interlock state and log the change. | |
| GrinderODIDScreenV02 | MoveToEmergencyRetractPosition (CustomMode) |
| Move the machine to the emergency retract position using a protected retraction sequence. | |
| GrinderODIDScreenV02 | MachinePreCycleStop () |
| Execute pre-cycle-stop checks and save the current grind state. | |
| GrinderODIDScreenV02 | MachineCycleStopFinal (CustomMode) |
| Execute the final cycle stop sequence including optional safety retract and G-code rewind. | |
| GrinderODIDScreenV02 | MoveToCycleStopRetractPosition () |
| Move the machine to the cycle stop retract position using a protected call. | |
| GrinderODIDScreenV02 | RewindGCodeOnCycleStop () |
| Rewind the G-code file to the beginning if the RewindGCode OEM parameter is enabled. | |
| GrinderODIDScreenV02 | UpdateCurrentToolDescription () |
| Update the current tool description label on the grinder screen. | |
| GrinderODIDScreenV02 | IsGCodeDisplayExtraLargeEnabled () |
| Report whether the extra-large G-code display mode is enabled. | |
| GrinderODIDScreenV02 | MachineCycleStartFinal () |
| Perform final cycle start checks before allowing G-code execution to begin. | |
| GrinderODIDScreenV02 | CalibrateActiveFlagWizard () |
| Launch a multi-step wizard to calibrate the active flagging probe. | |
| GrinderODIDScreenV02 | GapControlInitialize () |
| Initialize gap control outputs and set the initial gap control mode. | |
| GrinderODIDScreenV02 | GapControlEnable () |
| Enable gap control if the GapControlEnabled OEM parameter is set to "Yes". | |
| GrinderODIDScreenV02 | GapControlDisable () |
| Disable gap control by setting parameter 1900 to zero. | |
| GrinderODIDScreenV02 | GapControlToggle () |
| Toggle gap control between enabled and disabled states. | |
| GrinderODIDScreenV02 | IsGapControlEnabled () |
| Check whether gap control is currently enabled. | |
| GrinderODIDScreenV02 | CrashDetectionInitialize () |
| Initialize the crash detection system, creating required I/O points and GMS alarm. | |
| GrinderODIDScreenV02 | CrashDetectionResetCrash () |
| Reset the crash detection latch and optionally pulse the reset output signal. | |
| GrinderODIDScreenV02 | MachineReset () |
| Perform machine reset actions for the ODID Grinder screen. | |
| GrinderODIDScreenV02 | IsCrashDetectionCrashed () |
| Check whether the crash detection input signal is currently in a crashed state. | |
| GrinderODIDScreenV02 | IsCrashDetectionInhibited () |
| Determine whether crash detection is currently inhibited based on inputs and velocity limits. | |
| GrinderODIDScreenV02 | UpdateCrashDetection () |
| Poll crash detection state and trigger crash response if conditions are met. | |
| GrinderODIDScreenV02 | CrashDetected () |
| Execute the crash detected response sequence with re-entrancy protection. | |
| GrinderODIDScreenV02 | CrashDetectedFeedHoldNotice () |
| Create or display a GMS notice dialog when a crash causes a feed hold. | |
| GrinderODIDScreenV02 | CrashDetectedStopNotice () |
| Create or display a GMS notice dialog when a crash causes a cycle stop. | |
| GrinderODIDScreenV02 | CrashDetectedAlarm () |
| Create or display a GMS alarm notification for an acoustic crash detection event. | |
| GrinderODIDScreenV02 | CrashDetectedMoveToSafety () |
| Execute a crash-detected move-to-safety sequence, stopping motion and retracting to safety position. | |
| GrinderODIDScreenV02 | FlagInitialize () |
| Initialize the active flag hardware via the auxiliary module. | |
| GrinderODIDScreenV02 | FlagCalibration () |
| Launch the active flag calibration wizard. | |
| GrinderODIDScreenV02 | ExtendFlag () |
| Extend the active flag slide. | |
| GrinderODIDScreenV02 | RetractFlag () |
| Retract the active flag slide. | |
| GrinderODIDScreenV02 | ExtendFlagToggle () |
| Toggle the active flag slide between the extended and retracted positions. | |
| GrinderODIDScreenV02 | IsPartsPerDressCycleEnabled () |
| Report whether the Parts Per Dress Cycle feature is enabled for this machine. | |
| GrinderODIDScreenV02 | ResetPartCorrectionOffsets () |
| Reset the part correction offset pound variables to zero. | |
| GrinderODIDScreenV02 | InitializeMeasureingDevices () |
| Initialize the measuring device UI elements for the grinder screen. | |
| GrinderODIDScreenV02 | UpdateMeasureingDevices () |
| Update the active flag slide button colors on the grinder screen. | |
| GrinderODIDScreenV02 | GetWheelAttributes () |
| Retrieve the current grinding wheel attributes from the auxiliary module. | |
| GrinderODIDScreenV02 | SpindleStateChanged () |
| Handle spindle state change events for the grinder screen. | |
| GrinderODIDScreenV02 | ResetSetupInterlocks () |
| Reset all setup interlock bits for the current tool. | |
| GrinderODIDScreenV02 | CheckSetupInterlocks () |
| Check all setup interlocks and prompt the operator to continue if any are incomplete. | |
| GrinderODIDScreenV02 | SetFlaggingInterlock () |
| Set the flagging setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | ReSetFlaggingInterlock () |
| Clear the flagging setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | IsFlaggingInterlockSet () |
| Check whether the flagging setup interlock is set for the current tool. | |
| GrinderODIDScreenV02 | SetXCalibrationInterlock () |
| Set the X-axis calibration setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | ReSetXCalibrationInterlock () |
| Clear the X-axis calibration setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | IsXCalibrationInterlockSet () |
| Check whether the X-axis calibration setup interlock is set for the current tool. | |
| GrinderODIDScreenV02 | SetZCalibrationInterlock () |
| Set the Z-axis calibration setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | ReSetZCalibrationInterlock () |
| Clear the Z-axis calibration setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | IsZCalibrationInterlockSet () |
| Check whether the Z-axis calibration setup interlock is set for the current tool. | |
| GrinderODIDScreenV02 | SetChuckFaceInterlock () |
| Set the Chuck Face setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | ReSetChuckFaceInterlock () |
| Clear the Chuck Face setup interlock bit for the current tool. | |
| GrinderODIDScreenV02 | IsChuckFaceInterlockSet () |
| Check whether the Chuck Face setup interlock is set for the current tool. | |
| GrinderODIDScreenV02 | GetSetupInterlockBit (BitIdx) |
| Get the value of a specific setup interlock bit from the current tool's tool table field. | |
| GrinderODIDScreenV02 | SetSetupInterlockBit (BitIdx, value) |
| Set a specific setup interlock bit in the current tool's SetupInterlocks tool table field. | |
| GrinderODIDScreenV02 CYCLE | Initialize () |
| Initialize the ODID Grinder cycle state machine, type definitions, and pass tracking. | |
| cyc | UpdateCombLabels (dressing_passes, _type, type_passes) |
| Update the combined cycle label screen objects with current state and type descriptions. | |
| cyc STATE | GetNumber () |
| Get the current cycle state number from the configured pound variable. | |
| GrinderODIDScreenV02 | InitializeCycleSettings () |
| Initialize grinder cycle settings with default values for pound variables. | |
| GrinderODIDScreenV02 | InitializeToolTableFields () |
| Initialize the custom tool table user fields required for the ODID Grinder. | |
| GrinderODIDScreenV02 | MachineScreenUnloadScript () |
| Execute cleanup actions when the grinder screen is unloaded. | |
| GrinderODIDScreenV02 | LaunchLatheCannedCycles () |
| Launch the Lathe Canned Cycles wizard from the grinder screen. | |
| GrinderODIDScreenV02 | MachineCreatePreCannedCommands () |
| Register pre-canned commands for the ODID Grinder screen including gap control, crash detection, flagging, and setup interlocks. | |
| GrinderODIDScreenV02 CalibrateActiveFlagWizard | ( | ) |
Launch a multi-step wizard to calibrate the active flagging probe.
Only runs when the machine is in IDLE state. If the wizard is already open (m.CalibrateFlagUI is not nil), raises the existing window instead of creating a new one. The wizard guides the operator through four steps:
| GrinderODIDScreenV02 CheckSetupInterlocks | ( | ) |
Check all setup interlocks and prompt the operator to continue if any are incomplete.
Evaluates all four setup interlocks (Flagging, X Wheel to Part Calibration, Z Wheel to Part Calibration, and Wheel Face to Chuck Face Calibration) and builds a message listing any incomplete items. If any interlock is not set, displays a Yes/No dialog asking whether to continue. Returns false if the operator chooses not to continue, true if all interlocks are satisfied or the operator elects to proceed anyway.
| GrinderODIDScreenV02 CrashDetected | ( | ) |
Execute the crash detected response sequence with re-entrancy protection.
Checks the FuncTracing flag for "m.screen.CrashDetected" to prevent re-entrant calls. If a crash detection sequence is already in progress, returns immediately with an error. Otherwise sets the tracing flag, calls m.screen._CrashDetected() via w.pcall() for protected execution, clears the tracing flag, and returns the result. If the protected call fails, returns a formatted error message via w.FunctionError().
| GrinderODIDScreenV02 CrashDetectedAlarm | ( | ) |
Create or display a GMS alarm notification for an acoustic crash detection event.
Checks if a GMS dialog with the title "Acoustic Crash Detected!!" already exists. If not, creates a new GMS system global message of class "Alarm" that opens a notification and disables the machine (Enable Level 2 = 0) when the machine-enabled signal is active. The alarm auto-deletes after execution (DeleteAfterExecution = 1).
| GrinderODIDScreenV02 CrashDetectedFeedHoldNotice | ( | ) |
Create or display a GMS notice dialog when a crash causes a feed hold.
Checks if a GMS dialog with the title "Feedhold due to Crash Detected!!" already exists. If not, creates a new GMS dialog of class "Notice" with an extra line informing the operator that the control is in feed hold state and instructing them to press 'Reset Crash' then 'Cycle Start' to continue.
| GrinderODIDScreenV02 CrashDetectedMoveToSafety | ( | ) |
Execute a crash-detected move-to-safety sequence, stopping motion and retracting to safety position.
Handles the full crash response sequence when the CrashDetectionAction is set to "Move To Safety". Inhibits jogging on coordinated axes, then checks the current machine state:
| GrinderODIDScreenV02 CrashDetectedStopNotice | ( | ) |
Create or display a GMS notice dialog when a crash causes a cycle stop.
Checks if a GMS dialog with the title "Stopping due to Crash Detected!!" already exists. If not, creates a new GMS dialog of class "Notice" with an extra line instructing the operator to press Reset and jog to a safe position before restarting the program. The dialog auto-deletes after execution (DeleteAfterExecution = 1).
| GrinderODIDScreenV02 CrashDetectionInitialize | ( | ) |
Initialize the crash detection system, creating required I/O points and GMS alarm.
Reads the "CrashDetectionEnabled" OEM parameter and checks whether the "CrashDetectionInput" signal is mapped. If both conditions are met, creates two permanent output I/O points ("CrashDetection/InhibitActive" and "CrashDetection/CrashHandled") and initializes the CrashHandled state to false. If not enabled or not mapped, removes those I/O points and returns with an appropriate status. If the input is mapped but the parameter is disabled, returns a completed status; if the parameter is enabled but the input is not mapped, raises an error. When fully enabled, parses the CrashDetectionInput signal path and creates a GMS system global message of class "Warning" titled "Acoustic Crash Detected!!!" that triggers a notification when the crash input fires and the inhibit is not active. Sets IsCrashDetectionEnabled to true on success.
| GrinderODIDScreenV02 CrashDetectionResetCrash | ( | ) |
Reset the crash detection latch and optionally pulse the reset output signal.
If crash detection is enabled, clears the "CrashDetection/CrashHandled" I/O state. Then reads the CrashDetectionInput signal; if the signal is active and the "CrashDetectionResetOutput" OEM parameter is mapped, pulses the reset output high for approximately 6 seconds (via w.PleaseWaitDialog) before setting it low again. This sequence latches a hardware reset signal to the acoustic emission monitoring system.
| GrinderODIDScreenV02 ExtendFlag | ( | ) |
Extend the active flag slide.
Delegates to aux.SetActiveFlagSlideExtended() to command the active flag slide into the extended (measuring) position.
| GrinderODIDScreenV02 ExtendFlagToggle | ( | ) |
Toggle the active flag slide between the extended and retracted positions.
Checks the current retracted state of active flag 0 via aux.IsActiveFlagSlideRetracted(). If the slide is currently retracted, calls m.screen.ExtendFlag() to extend it; otherwise calls m.screen.RetractFlag() to retract it.
| GrinderODIDScreenV02 FlagCalibration | ( | ) |
Launch the active flag calibration wizard.
Delegates to m.screen.CalibrateActiveFlagWizard() to open the multi-step flag calibration wizard UI. Returns a completed status after the wizard exits.
| GrinderODIDScreenV02 FlagInitialize | ( | ) |
Initialize the active flag hardware via the auxiliary module.
Delegates to aux.FlagInitialize() to perform hardware-level initialization of the active flagging system. Called once during machine screen startup.
| GrinderODIDScreenV02 GapControlDisable | ( | ) |
Disable gap control by setting parameter 1900 to zero.
Writes the value 0 to machine parameter 1900 to deactivate gap control.
| GrinderODIDScreenV02 GapControlEnable | ( | ) |
Enable gap control if the GapControlEnabled OEM parameter is set to "Yes".
Reads the "GapControlEnabled" OEM parameter. If it is "Yes", sets machine parameter 1900 to 1 to activate gap control. If it is not "Yes", sets parameter 1900 to 0 and displays a warning message informing the operator that gap control is not enabled in the machine parameters.
| GrinderODIDScreenV02 GapControlInitialize | ( | ) |
Initialize gap control outputs and set the initial gap control mode.
Reads the "GapControlEnabled" OEM parameter. If enabled ("Yes"), calls aux.InitializeGapOutputs() and aux.SetGapControlModeGrind(true) to configure the gap control hardware outputs for grinding mode. If not enabled, sets machine parameter 1900 to 0 to ensure gap control is inactive.
| GrinderODIDScreenV02 GapControlToggle | ( | ) |
Toggle gap control between enabled and disabled states.
Calls IsGapControlEnabled() to determine the current state. If gap control is currently enabled, calls GapControlDisable(); otherwise calls GapControlEnable().
| cyc STATE GetNumber | ( | ) |
Get the current cycle state number from the configured pound variable.
Get the current number of remaining passes from pound variable #9082.
Reads the state pound variable (default #9080) using a protected call via w.pcall. Converts the result to a number with tonumber(). Returns 0 if the call fails or if the result cannot be converted to a number. This method is a member of the cyc.STATE table object.
Reads the passes pound variable using a protected call. Returns 0 if the call fails. This method is a member of the cyc.PASSES table object.
| GrinderODIDScreenV02 GetSetupInterlockBit | ( | BitIdx | ) |
Get the value of a specific setup interlock bit from the current tool's tool table field.
Reads the SetupInterlocks extended data field for the active tool pocket from the tool table and extracts the specified bit using w.GetValueBit(). Returns false if the current tool pocket number is zero (no tool loaded). Setup Interlock bit assignments: 0 = X Part, 1 = Z Part, 2 = Flagging, 3 = Chuck Face.
| BitIdx | (number) The zero-based bit index to read (0=X Part, 1=Z Part, 2=Flagging, 3=Chuck Face) |
| GrinderODIDScreenV02 GetWheelAttributes | ( | ) |
Retrieve the current grinding wheel attributes from the auxiliary module.
Delegates to aux.GetWheelAttributes() to retrieve wheel geometry and configuration data for the currently active grinding wheel.
| GrinderODIDScreenV02 CYCLE Initialize | ( | ) |
Initialize the ODID Grinder cycle state machine, type definitions, and pass tracking.
Sets up all cycle tracking structures used during grinding and dressing operations. Initializes the following sub-objects on GrinderODIDScreenV02.CYCLE:
| GrinderODIDScreenV02 InitializeAxisPositionGroup | ( | ) |
Initialize the axis position group layout and DRO visibility for the grinder screen.
Iterates over all coordinate axes and shows or hides each axis's screen objects (text label, position DRO, to-go DRO, load gauge, and zero button) based on whether the axis is enabled in AXIS_ENABLED. Sets font weight to 90 for all axis text labels. Configures the unit display (inch/mm) on X, Y, and Z position DROs from the UnitDisplayLeftRight profile string. Uses w.Distribute() to calculate evenly spaced DRO positions within the available panel area (rows 19 to 216), respecting a maximum size of 60 and maximum padding of 11. Positions and sizes each DRO group (axis text, position DRO, to-go DRO, zero button, and load gauge) according to the computed distribution. Calls m.screen.UpdateZeroButtons() and m.screen.InitializeHomeButtons() after layout is complete.
| GrinderODIDScreenV02 InitializeCycleSettings | ( | ) |
Initialize grinder cycle settings with default values for pound variables.
Reads and validates three pound variables used for cycle behavior. If a variable is zero, out of range, or negative, it is reset to a safe default value:
| GrinderODIDScreenV02 InitializeMeasureingDevices | ( | ) |
Initialize the measuring device UI elements for the grinder screen.
Hides the PassiveFlaggingGroup and GaugingGroup screen objects unconditionally. If the active flag is enabled (aux.IsActiveFlagEnabled(0) returns true), shows the ActiveFlaggingGroup; otherwise hides it. Called once during screen startup.
| GrinderODIDScreenV02 InitializeToolTableFields | ( | ) |
Initialize the custom tool table user fields required for the ODID Grinder.
Defines and registers a comprehensive set of custom tool table fields covering wheel geometry, speed settings, safety clearances, dress positions, rotary dresser parameters, and setup interlocks. If the tool table is already initialized, the function checks whether all required fields exist and only writes defaults if any fields are missing. If the tool table is not yet initialized, a log message is written and no fields are added. Fields include:
| GrinderODIDScreenV02 IsChuckFaceInterlockSet | ( | ) |
Check whether the Chuck Face setup interlock is set for the current tool.
Reads the "SetupInterlockChuckFaceEnabled" OEM register to determine if this interlock is active. If the register value is not "Yes", returns true (interlock not required). If the interlock is required, reads setup interlock bit 3 from the current tool's tool table field to determine the current interlock state.
| GrinderODIDScreenV02 IsCrashDetectionCrashed | ( | ) |
Check whether the crash detection input signal is currently in a crashed state.
If crash detection is enabled (IsCrashDetectionEnabled is true), reads the "CrashDetectionInput" OEM parameter signal via w.GetOEMParamSig() and returns its value. If crash detection is not enabled, always returns false.
| GrinderODIDScreenV02 IsCrashDetectionInhibited | ( | ) |
Determine whether crash detection is currently inhibited based on inputs and velocity limits.
Evaluates multiple conditions to decide if crash detection should be suppressed:
| GrinderODIDScreenV02 IsFlaggingInterlockSet | ( | ) |
Check whether the flagging setup interlock is set for the current tool.
First checks if the active flag is enabled via aux.IsActiveFlagEnabled(). If flagging is not enabled, returns true (interlock not required). Then reads the "SetupInterlockFlaggingEnabled" OEM register to determine if the interlock is active. If the register value is not "Yes", returns true (interlock not required). Otherwise reads setup interlock bit 2 from the current tool's tool table field via m.screen.GetSetupInterlockBit(2).
| GrinderODIDScreenV02 IsGapControlEnabled | ( | ) |
Check whether gap control is currently enabled.
Reads the "GapControlEnabled" OEM parameter string and the cached value of parameter 1900. Returns true only if GapControlEnabled is "Yes" AND parameter 1900 equals 1.
| GrinderODIDScreenV02 IsGCodeDisplayExtraLargeEnabled | ( | ) |
Report whether the extra-large G-code display mode is enabled.
Always returns false for the ODID Grinder screen, indicating that the extra-large G-code display is not active.
| GrinderODIDScreenV02 IsPartsPerDressCycleEnabled | ( | ) |
Report whether the Parts Per Dress Cycle feature is enabled for this machine.
Always returns true for the ODID Grinder screen, indicating that the parts per dress cycle counting feature is active.
| GrinderODIDScreenV02 IsRetracting | ( | ) |
Report whether the machine is currently executing a retraction sequence.
Returns the current value of the module-level _IsRetracting flag, which is managed by SetRetracting() and used as an interlock to prevent concurrent retraction attempts.
| GrinderODIDScreenV02 IsXCalibrationInterlockSet | ( | ) |
Check whether the X-axis calibration setup interlock is set for the current tool.
Reads setup interlock bit 0 from the current tool's tool table field to determine whether the X Wheel to Part Calibration has been performed.
| GrinderODIDScreenV02 IsZCalibrationInterlockSet | ( | ) |
Check whether the Z-axis calibration setup interlock is set for the current tool.
Reads setup interlock bit 1 from the current tool's tool table field to determine whether the Z Wheel to Part Calibration has been performed.
| GrinderODIDScreenV02 LaunchLatheCannedCycles | ( | ) |
Launch the Lathe Canned Cycles wizard from the grinder screen.
Logs the operator action, appends the Wizards directory to the package path, clears the cached module, and loads the "Lathe Canned Cycles" Lua module.
| GrinderODIDScreenV02 MachineCreatePreCannedCommands | ( | ) |
Register pre-canned commands for the ODID Grinder screen including gap control, crash detection, flagging, and setup interlocks.
Creates and registers all pre-canned commands available for the ODID Grinder screen module. Commands are grouped into the following categories:
| GrinderODIDScreenV02 MachineCycleStartFinal | ( | ) |
Perform final cycle start checks before allowing G-code execution to begin.
Only executes its logic when the machine is IDLE, retract is not active, and single block mode is off. Reads the total parts count (PV_PRTST) and the PartCountOnLastDressCycle pound variable (#9087). Sets pound variable #9089 to 1 if the part count matches the last dress cycle count (indicating a dress already ran for this part), or 0 otherwise. This allows the G-code to skip a dress cycle if one was already performed. Also calls CheckSetupInterlocks() if that function is defined and M00 is not active, returning false to abort cycle start if the operator declines to proceed.
| GrinderODIDScreenV02 MachineCycleStopFinal | ( | CustomMode | ) |
Execute the final cycle stop sequence including optional safety retract and G-code rewind.
Reads the "MoveToSafetyPositionEnabled" OEM parameter. If enabled ("Yes"), calls MoveToEmergencyRetractPosition() with the provided CustomMode to move the machine to its safety position. Then calls RewindGCodeOnCycleStop() to optionally rewind the G-code file and CYCLE.SetStateToIdle() to reset the cycle state machine to idle.
| CustomMode | (number) The retraction mode to pass to MoveToEmergencyRetractPosition(). Use 0 for standard cycle stop retract |
| GrinderODIDScreenV02 MachinePreCycleStop | ( | ) |
Execute pre-cycle-stop checks and save the current grind state.
Checks if a retraction is already in progress via IsRetracting(). If so, aborts the cycle stop by returning false with an "already retracting" message, preventing a second cycle stop from interrupting an active retract sequence. Otherwise reads the current grind state from pound variable #9080 and saves it to GrindStateOnCycleStop for use by the subsequent cycle stop retract logic.
| GrinderODIDScreenV02 MachineReset | ( | ) |
Perform machine reset actions for the ODID Grinder screen.
Executes two reset operations in sequence: resets the crash detection latch via CrashDetectionResetCrash(), then resets the part correction offsets to zero via ResetPartCorrectionOffsets(). Called as part of the machine reset hook.
| GrinderODIDScreenV02 MachineScreenLoadScript | ( | ) |
Execute all initialization logic when the ODID Grinder machine screen is loaded.
Performs the following setup sequence in order:
| GrinderODIDScreenV02 MachineScreenLowPriorityLoop | ( | ) |
Execute all low-priority periodic screen update functions for the ODID Grinder.
Called on each low-priority loop iteration to refresh all grinder screen elements that do not require real-time update rates. Sequentially calls the following update functions: UpdateWheelHead, UpdateRotaryDresser, UpdateWheelHeadSpeed, UpdateCurrentTabRegister, UpdateActiveToolBox, UpdateGrinderWheelAttributes, UpdateScreenToolObjects, UpdateScreenSpindleObjects, UpdateDresserDiamondSelection, UpdatePartsPerDressCycle, UpdateNewWheelOffset, UpdateG88ReciprocatingAxis, UpdateMeasureingDevices, and UpdateCurrentToolDescription.
| GrinderODIDScreenV02 MachineScreenPLCScript | ( | ) |
Execute all real-time PLC script update functions for the ODID Grinder screen.
Called on every PLC script cycle to perform time-critical screen updates. Sequentially calls UpdateCrashDetection() to poll the crash detection system, UpdateToGoDROs() to refresh the to-go distance readouts, and CYCLE.Update() to advance the cycle state machine display.
| GrinderODIDScreenV02 MachineScreenStartupScript | ( | ) |
Execute the machine screen startup script for the ODID Grinder.
Performs all one-time initialization required when the grinder screen starts up: sets the machine type name label to "Mach Grinder", initializes the flagging system via FlagInitialize(), configures the tool path view bottom button, initializes tool table fields, initializes the measuring devices UI, and initializes the fixture offsets group.
| GrinderODIDScreenV02 MachineScreenUnloadScript | ( | ) |
Execute cleanup actions when the grinder screen is unloaded.
Stops the wheel head spindle and stops the rotary dresser when the screen is unloaded. This ensures that all rotating equipment is stopped when the operator navigates away from the screen.
| GrinderODIDScreenV02 MoveToCycleStopRetractPosition | ( | ) |
Move the machine to the cycle stop retract position using a protected call.
Wraps GrinderODIDScreenV02._MoveToCycleStopRetractPosition() in a w.pcall() protected call. If the inner function raises an error, formats and returns an error message. On success, returns the boolean result from the inner function along with a completed status message.
| GrinderODIDScreenV02 MoveToEmergencyRetractPosition | ( | CustomMode | ) |
Move the machine to the emergency retract position using a protected retraction sequence.
Checks if a retraction is already in progress via IsRetracting(). If so, returns immediately with an "Already Retracting" message to prevent re-entrant retraction attempts. Otherwise selects the appropriate retract function based on CustomMode (currently only mode 0 is supported, which maps to MoveToCycleStopRetractPosition). Sets the retracting interlock via SetRetracting(true), executes the retract function via w.pcall() for protected execution, then clears the interlock via SetRetracting(false) regardless of success or failure.
| CustomMode | (number) The retraction mode selector. Use 0 for standard cycle stop retract. Unrecognized modes return an error. |
| GrinderODIDScreenV02 ReSetChuckFaceInterlock | ( | ) |
Clear the Chuck Face setup interlock bit for the current tool.
Sets setup interlock bit 3 to false for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Wheel Face to Chuck Face calibration has been invalidated and needs to be redone.
| GrinderODIDScreenV02 ReSetFlaggingInterlock | ( | ) |
Clear the flagging setup interlock bit for the current tool.
Sets setup interlock bit 2 to false for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Active Flag Calibration has been invalidated and needs to be redone.
| GrinderODIDScreenV02 ResetPartCorrectionOffsets | ( | ) |
Reset the part correction offset pound variables to zero.
Sets pound variables #5081 (X part correction offset) and #5083 (Z part correction offset) to zero using mc.mcCntlSetPoundVar(). Returns an error if either operation fails.
| GrinderODIDScreenV02 ResetSetupInterlocks | ( | ) |
Reset all setup interlock bits for the current tool.
Clears all four setup interlock bits by calling the individual reset functions: ReSetFlaggingInterlock (bit 2), ReSetXCalibrationInterlock (bit 0), ReSetZCalibrationInterlock (bit 1), and ReSetChuckFaceInterlock (bit 3). This is typically called when a new wheel is mounted or calibration is invalidated.
| GrinderODIDScreenV02 ReSetXCalibrationInterlock | ( | ) |
Clear the X-axis calibration setup interlock bit for the current tool.
Sets setup interlock bit 0 to false for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the X Wheel to Part Calibration has been invalidated and needs to be redone.
| GrinderODIDScreenV02 ReSetZCalibrationInterlock | ( | ) |
Clear the Z-axis calibration setup interlock bit for the current tool.
Sets setup interlock bit 1 to false for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Z Wheel to Part Calibration has been invalidated and needs to be redone.
| GrinderODIDScreenV02 RetractFlag | ( | ) |
Retract the active flag slide.
Delegates to aux.SetActiveFlagSlideRetracteded() to command the active flag slide into the retracted position.
| GrinderODIDScreenV02 RewindGCodeOnCycleStop | ( | ) |
Rewind the G-code file to the beginning if the RewindGCode OEM parameter is enabled.
Reads the "RewindGCode" OEM parameter string. If the value is "Yes", calls mc.mcCntlRewindFile() to rewind the currently loaded G-code file to line 0. Returns an error if the OEM parameter read fails or if the rewind operation returns a non-zero error code.
| GrinderODIDScreenV02 SetChuckFaceInterlock | ( | ) |
Set the Chuck Face setup interlock bit for the current tool.
Sets setup interlock bit 3 to true for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Wheel Face to Chuck Face calibration has been completed successfully.
| GrinderODIDScreenV02 SetFlaggingInterlock | ( | ) |
Set the flagging setup interlock bit for the current tool.
Sets setup interlock bit 2 to true for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Active Flag Calibration has been completed successfully.
| GrinderODIDScreenV02 SetRetracting | ( | new_state | ) |
Set the retracting interlock state and log the change.
Logs the new state via w.LogF() with the [Retract] prefix, then updates the module-level _IsRetracting flag to the provided value.
| new_state | (boolean) The new retracting state to set (true = retracting, false = not retracting) |
| GrinderODIDScreenV02 SetSetupInterlockBit | ( | BitIdx | , |
| value | ) |
Set a specific setup interlock bit in the current tool's SetupInterlocks tool table field.
Reads the current SetupInterlocks value for the active tool pocket from the tool table extended data field, modifies the specified bit using w.SetValueBit(), and writes the updated value back. Only operates when the current tool pocket number is greater than zero. Setup Interlock bit assignments: 0 = X Part, 1 = Z Part, 2 = Flagging, 3 = Chuck Face.
| BitIdx | (number) The zero-based bit index to set (0=X Part, 1=Z Part, 2=Flagging, 3=Chuck Face) |
| value | (boolean) The value to set the bit to (true = set, false = clear) |
| GrinderODIDScreenV02 SetXCalibrationInterlock | ( | ) |
Set the X-axis calibration setup interlock bit for the current tool.
Sets setup interlock bit 0 to true for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the X Wheel to Part Calibration has been completed successfully.
| GrinderODIDScreenV02 SetZCalibrationInterlock | ( | ) |
Set the Z-axis calibration setup interlock bit for the current tool.
Sets setup interlock bit 1 to true for the current tool via m.screen.SetSetupInterlockBit(). This indicates that the Z Wheel to Part Calibration has been completed successfully.
| GrinderODIDScreenV02 SpindleStateChanged | ( | ) |
Handle spindle state change events for the grinder screen.
Called when the spindle state changes. Updates the work head enable state by delegating to GrinderODIDScreenV02.UpdateWorkHeadEnable().
| cyc UpdateCombLabels | ( | dressing_passes | , |
| _type | , | ||
| type_passes | ) |
Update the combined cycle label screen objects with current state and type descriptions.
Formats and updates all screen objects listed in cyc.CombLabels with a combined string reflecting the current cycle state and type. When the current state is a dressing state, the remaining dressing passes count is appended to the state description. If the cycle type has no description (empty string), only the state description is shown; otherwise the format is "TypeDescription: StateDescription". Also logs the combined state/type description via w.Log.
| state | (table) The current cycle state object with a 'Description' field |
| dressing_passes | (number) The number of remaining dressing passes |
| _type | (table) The current cycle type object with a 'Description' field |
| type_passes | (number) The number of remaining type passes (currently unused) |
| GrinderODIDScreenV02 UpdateCrashDetection | ( | ) |
Poll crash detection state and trigger crash response if conditions are met.
Called from the PLC script on every cycle. If crash detection is enabled, reads the CrashDetectionInput signal and checks the inhibit state, in-progress flag, and handled flag. Triggers m.screen.CrashDetected() when all of the following are true: crash detection is not inhibited, the crash input is active, the crash has not already been handled, and no crash response is already in progress. Also resets the CrashHandled I/O state when the crash input clears and the crash has been handled and no response is in progress.
| GrinderODIDScreenV02 UpdateCurrentToolDescription | ( | ) |
Update the current tool description label on the grinder screen.
Reads the tool description for the currently active tool number via mc.mcToolGetDesc() and writes it to the "CurrentToolDescriptionLabel" screen object's Label property. Uses the current instance's tool number from CURRENT_TOOL_NUMBER_INST.
| GrinderODIDScreenV02 UpdateG88ReciprocatingAxis | ( | ) |
Update the G288 handwheel infeed reciprocating axis state and feed-hold notification.
Only executes when m.ReciprocatingAxes is not nil. Reads the current feed-hold state of the handwheel infeed cycle via m.IsFeedholdHandwheelInfeedCycleActive(). If feed hold is active and no notification exists, creates a persistent GMS notification titled "G288: Feed-hold Active". If feed hold is no longer active and a notification exists, closes it via w.CloseGMSNotification(). If the Z axis has a reciprocating axis object, reads its running state and writes the combined running-or-feedhold boolean to the "HandwheelInfeedActive" OEM parameter.
| GrinderODIDScreenV02 UpdateMeasureingDevices | ( | ) |
Update the active flag slide button colors on the grinder screen.
Polls the active flag slide state and updates the FlagExtendBtn and FlagRetractBtn background colors to reflect the current extended/retracted status. Uses BTN_COLOR_ON when the corresponding state is active and BTN_COLOR_OFF otherwise. Only runs if the active flag is enabled (aux.IsActiveFlagEnabled(0) returns true).