fixed bugs for rotating machine execSequence
This commit is contained in:
@@ -145,6 +145,9 @@ class nodeClass {
|
||||
case "decelerating":
|
||||
symbolState = "⏪";
|
||||
break;
|
||||
case "maintenance":
|
||||
symbolState = "🔧";
|
||||
break;
|
||||
}
|
||||
const position = m.state.getCurrentPosition();
|
||||
const roundedPosition = Math.round(position * 100) / 100;
|
||||
|
||||
@@ -189,26 +189,37 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
||||
// -------- Mode and Input Management -------- //
|
||||
isValidSourceForMode(source, mode) {
|
||||
const allowedSourcesSet = this.config.mode.allowedSources[mode] || [];
|
||||
return allowedSourcesSet.has(source);
|
||||
const allowed = allowedSourcesSet.has(source);
|
||||
allowed?
|
||||
this.logger.debug(`source is allowed proceeding with ${source} for mode ${mode}`) :
|
||||
this.logger.warn(`${source} is not allowed in mode ${mode}`);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
isValidActionForMode(action, mode) {
|
||||
const allowedActionsSet = this.config.mode.allowedActions[mode] || [];
|
||||
return allowedActionsSet.has(action);
|
||||
const allowed = allowedActionsSet.has(action);
|
||||
allowed ?
|
||||
this.logger.debug(`Action is allowed proceeding with ${action} for mode ${mode}`) :
|
||||
this.logger.warn(`${action} is not allowed in mode ${mode}`);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
async handleInput(source, action, parameter) {
|
||||
|
||||
this.logger.debug("hello");
|
||||
//sanitize input
|
||||
if( typeof action !== 'string'){this.logger.error(`Action must be string`); return;}
|
||||
//convert to lower case to avoid to many mistakes in commands
|
||||
action = action.toLowerCase();
|
||||
|
||||
if (!this.isValidSourceForMode(source, this.currentMode)) {
|
||||
let warningTxt = `Source '${source}' is not valid for mode '${this.currentMode}'.`;
|
||||
this.logger.warn(warningTxt);
|
||||
return {status : false , feedback: warningTxt};
|
||||
}
|
||||
// check for validity of the request
|
||||
if(!this.isValidActionForMode(action,this.currentMode)){return ;}
|
||||
if (!this.isValidSourceForMode(source, this.currentMode)) {return ;}
|
||||
|
||||
this.logger.debug("hello2");
|
||||
|
||||
this.logger.info(`Handling input from source '${source}' with action '${action}' in mode '${this.currentMode}'.`);
|
||||
|
||||
@@ -221,6 +232,14 @@ _callMeasurementHandler(measurementType, value, position, context) {
|
||||
case "execmovement":
|
||||
return await this.setpoint(parameter);
|
||||
|
||||
case "entermaintenance":
|
||||
|
||||
return await this.executeSequence(parameter);
|
||||
|
||||
|
||||
case "exitmaintenance":
|
||||
return await this.executeSequence(parameter);
|
||||
|
||||
case "flowmovement":
|
||||
// Calculate the control value for a desired flow
|
||||
const pos = this.calcCtrl(parameter);
|
||||
|
||||
Reference in New Issue
Block a user