push to get friendly jsdoc for future devs

This commit is contained in:
Stewart Allen 2025-12-25 14:03:37 -05:00
commit dbde596903
20 changed files with 1054 additions and 20 deletions

View file

@ -11,20 +11,49 @@ import { settings } from './conf/manager.js';
const { MODES, VIEWS } = consts;
const clone = Object.clone;
/** Current operating mode ID */
let MODE = MODES.FDM;
/**
* Get current mode name as string.
* @returns {string} Mode name (FDM, CAM, SLA, LASER, etc.)
*/
function getMode() {
return settings.mode();
}
/**
* Get current mode name in lowercase.
* @returns {string} Lowercase mode name (fdm, cam, sla, etc.)
*/
function getModeLower() {
return getMode().toLowerCase();
}
/**
* Switch to a different operating mode.
* Convenience wrapper around setMode() that updates platform size after switch.
* @param {string} mode - Target mode name (FDM, CAM, SLA, LASER, DRAG, WJET, WEDM)
*/
function switchMode(mode) {
setMode(mode, null, platform.update_size);
}
/**
* Set operating mode with full initialization.
* Complex function that:
* - Validates and sets mode constant
* - Updates UI to show/hide mode-specific controls
* - Restores cached device for the mode
* - Resets view to ARRANGE
* - Saves settings
* - Updates platform and selection
* - Emits mode.set event
*
* @param {string} mode - Target mode name (FDM, CAM, SLA, LASER, DRAG, WJET, WEDM)
* @param {*} lock - Currently unused parameter
* @param {function} [then] - Optional callback after mode set complete
*/
function setMode(mode, lock, then) {
if (!MODES[mode]) {
console.log("invalid mode: "+mode);
@ -75,10 +104,18 @@ function setMode(mode, lock, then) {
}
}
/**
* Get the name of the current process profile for this mode.
* @returns {string} Process profile name
*/
function currentProcessName() {
return settings.get().cproc[getMode()];
}
/**
* Get the process configuration object for the current mode and profile.
* @returns {object} Process configuration
*/
function currentProcessCode() {
return settings.get().sproc[getMode()][currentProcessName()];
}