|
|
|
@ -127,8 +127,8 @@ export class ModbusSlaveConfigComponent implements ControlValueAccessor, Validat |
|
|
|
|
|
|
|
this.observeValueChanges(); |
|
|
|
this.observeTypeChange(); |
|
|
|
this.observeFormEnable(); |
|
|
|
this.observeShowSecurity(); |
|
|
|
this.observeFormEnable(); |
|
|
|
} |
|
|
|
|
|
|
|
get protocolType(): ModbusProtocolType { |
|
|
|
@ -173,15 +173,6 @@ export class ModbusSlaveConfigComponent implements ControlValueAccessor, Validat |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private observeTypeChange(): void { |
|
|
|
this.slaveConfigFormGroup.get('type').valueChanges |
|
|
|
.pipe(takeUntil(this.destroy$)) |
|
|
|
.subscribe(type => { |
|
|
|
this.updateFormEnableState(this.enableSlaveControl.value); |
|
|
|
this.updateMethodType(type); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private observeFormEnable(): void { |
|
|
|
this.enableSlaveControl.valueChanges |
|
|
|
.pipe(takeUntil(this.destroy$)) |
|
|
|
@ -191,6 +182,15 @@ export class ModbusSlaveConfigComponent implements ControlValueAccessor, Validat |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private observeTypeChange(): void { |
|
|
|
this.slaveConfigFormGroup.get('type').valueChanges |
|
|
|
.pipe(takeUntil(this.destroy$)) |
|
|
|
.subscribe(type => { |
|
|
|
this.updateFormEnableState(this.enableSlaveControl.value); |
|
|
|
this.updateMethodType(type); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private updateMethodType(type: ModbusProtocolType): void { |
|
|
|
if (this.slaveConfigFormGroup.get('method').value !== ModbusMethodType.RTU) { |
|
|
|
this.slaveConfigFormGroup.get('method').patchValue( |
|
|
|
|